BULK: Fix tests.
[pwmd.git] / tests / bulk.test
blob82ef9a35f9463de9984b078d5dbe60c596860a9e
1 #!/bin/bash
2 source common.sh
3 source import-common.sh
5 do_import datafile
7 cat > config << EOF
8 [global]
9 log_level=9
10 #enable_logging=true
11 [datafile]
12 passphrase_file=`pwd`/passphrase.key
13 [datafile.tmp]
14 passphrase_file=`pwd`/passphrase.key
15 EOF
17 launch_pwmd datafile
18 begin_test
20 test_header "Test 1. Inquire syntax (fail)."
21 cp -f data/datafile data/datafile.tmp
22 set +o errexit
23 cat <<EOF | pwmc $PWMC_ARGS --inquire 'BULK --inquire' datafile.tmp
24 (2:id 1:1 7:getinfo7:vrsion)
25 EOF
27 if [ ${PIPESTATUS[1]} == 0 ]; then
28 echo "The previous command should have failed. Stopping."
29 exit 1
32 set -e
34 echo
35 test_header "Test 2. Command branching."
36 cp -f data/datafile data/datafile.tmp
37 cat <<EOF | pwmc $PWMC_ARGS --inquire 'BULK --inquire' datafile.tmp > result
38 (2:id 1:1 7:getinfo7:clients
39 2:rc 1:0
40 (2:id1:2 4:list5:--all
41 2:rc 1:0
42 (2:id1:3 3:get0:
43 2:rc 9:536870941
44 (2:id1:4 7:getinfo7:clients)
45 2:id1:5 7:getinfo5:cache))
46 2:id1:6 9:getconfig12:client-state
47 2:rc 9:536871086
48 (2:id1:1 4:list0:))
49 EOF
51 cmp bulk.result2 result
52 rm -f result
54 echo
55 test_header "Test 3. Command branching (next rc)."
56 cp -f data/datafile data/datafile.tmp
57 cat <<EOF | pwmc $PWMC_ARGS --inquire 'BULK --inquire' datafile.tmp > result
58 (2:id 1:1 7:getinfo7:clients
59 2:rc 1:0
60 (2:id1:2 4:list5:--all
61 2:rc 1:0
62 (2:id1:3 3:get3:a b
63 2:rc 9:536870941
64 (2:id1:4 3:nop0:)
65 2:rc 1:0
66 (2:id1:5 7:getinfo14:--data clients))
67 2:id1:6 9:getconfig3:nop
68 2:rc 9:536871086
69 (2:id1:7 4:list0:))
70 2:id1:8 7:getinfo 3:nop)
71 EOF
73 cmp bulk.result3 result
74 rm -f result
76 test_success