xref: /aosp_15_r20/external/libcups/test/5.1-lpadmin.sh (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1#!/bin/sh
2#
3# Test the lpadmin command.
4#
5# Copyright © 2007-2018 by Apple Inc.
6# Copyright © 1997-2005 by Easy Software Products, all rights reserved.
7#
8# Licensed under Apache License v2.0.  See the file "LICENSE" for more
9# information.
10#
11
12echo "Add Printer Test"
13echo ""
14echo "    lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd"
15$runcups $VALGRIND ../systemv/lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd 2>&1
16if test $? != 0; then
17	echo "    FAILED"
18	exit 1
19else
20	if test -f $CUPS_SERVERROOT/ppd/Test3.ppd; then
21		echo "    PASSED"
22	else
23		echo "    FAILED (No PPD)"
24		exit 1
25	fi
26fi
27echo ""
28
29echo "Modify Printer Test"
30echo ""
31echo "    lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4"
32$runcups $VALGRIND ../systemv/lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4 2>&1
33if test $? != 0; then
34	echo "    FAILED"
35	exit 1
36else
37	echo "    PASSED"
38fi
39echo ""
40
41echo "Delete Printer Test"
42echo ""
43echo "    lpadmin -x Test3"
44$runcups $VALGRIND ../systemv/lpadmin -x Test3 2>&1
45if test $? != 0; then
46	echo "    FAILED"
47	exit 1
48else
49	echo "    PASSED"
50fi
51echo ""
52
53echo "Add Shared Printer Test"
54echo ""
55echo "    lpadmin -p Test3 -E -v ipp://localhost:$IPP_PORT/printers/Test2 -m everywhere"
56$runcups $VALGRIND ../systemv/lpadmin -p Test3 -E -v ipp://localhost:$IPP_PORT/printers/Test2 -m everywhere 2>&1
57if test $? != 0; then
58	echo "    FAILED"
59	exit 1
60else
61	echo "    PASSED"
62fi
63echo ""
64