blob: 5729344be2e5e6567a77967360eee52a9fae8625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/sh
if [ $# -lt 4 ]; then
cat <<EOF
Usage: test_printing_var_exp.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD
EOF
exit 1
fi
SERVER="$1"
SERVER_IP="$2"
DOMAIN="$3"
USERNAME="$4"
PASSWORD="$5"
shift 5
ADDARGS="$@"
incdir=$(dirname $0)/../../../testprogs/blackbox
. $incdir/subunit.sh
. $incdir/common_test_fns.inc
smbclient="$BINDIR/smbclient"
rpcclient="$BINDIR/rpcclient"
test_var_expansion()
{
logfile="${SELFTEST_TMPDIR}/${USER}_printing_var_exp.log"
$smbclient -U $DOMAIN/$USERNAME%$PASSWORD \
//$SERVER_IP/print_var_exp \
-c "print $SRCDIR/testdata/printing/example.ps"
if [ $? -ne 0 ]; then
rm -f "$logfile"
return 1
fi
cat "$logfile"
grep "Windows user: $USERNAME" "$logfile"
if [ $? -ne 0 ]; then
rm -f "$logfile"
return 1
fi
grep "UNIX user: $USERNAME" "$logfile"
if [ $? -ne 0 ]; then
rm -f "$logfile"
return 1
fi
grep "Domain: $DOMAIN" "$logfile"
if [ $? -ne 0 ]; then
rm -f "$logfile"
return 1
fi
rm -f "$logfile"
return 0
}
test_empty_queue()
{
# Try several times until the bgqd daemon updates the print queue status
tries="3"
for i in $(seq 1 $tries); do
echo "Try $i"
JOBS=$($rpcclient ncacn_np:$SERVER_IP \
-U $DOMAIN/$USERNAME%$PASSWORD \
-c "enumjobs print_var_exp 2")
if [ $? -ne 0 ]; then
return 1
fi
if [[ -z $JOBS ]]; then
return 0
fi
if [[ $i -gt $tries ]]; then
echo "Print queue not empty after $tries seconds:"
echo $JOBS
echo "Queue must be empty before leaving this test or" \
"following ones may fail."
return 1
fi
sleep 1
done
return 0
}
testit "Test variable expansion for '%U', '%u' and '%D'" \
test_var_expansion ||
failed=$(expr $failed + 1)
testit "Test queue is empty" \
test_empty_queue ||
failed=$(expr $failed + 1)
exit $failed
|