Add a client state field to GETINFO.
[libpwmd.git] / tests / xpath.test
blob5112598a48c87025e424be29cc5bf5e743174faa
1 #!/bin/bash
2 source common.sh
3 source import-common.sh
5 do_import list
7 cat > config << EOF
8 [global]
9 log_level=9
10 #enable_logging=true
11 [xpath]
12 passphrase_file=`pwd`/list.key
13 EOF
15 set -e
16 mv -f data/list data/xpath
17 launch_pwmd xpath
19 begin_test
20 echo "Test 1. XPATH no matching elements (fail)."
21 set +o errexit
22 echo -ne 'XPATH /element' | pwmc $PWMC_ARGS xpath
23 if [ ${PIPESTATUS[1]} == 0 ]; then
24 echo "The previous command should have failed. Stopping."
25 exit 1
28 set -e
30 echo
31 echo "Test 2. XPATH invalid expression syntax (fail)."
32 set +o errexit
33 echo -ne 'XPATH /element[]' | pwmc $PWMC_ARGS xpath
34 if [ ${PIPESTATUS[1]} == 0 ]; then
35 echo "The previous command should have failed. Stopping."
36 exit 1
39 set -e
41 echo
42 echo "Test 3. Retrieve expression."
43 echo -ne 'XPATH //element[@_name="a"]' | pwmc $PWMC_ARGS xpath > result
44 cmp xpath.result3 result
45 rm -f result
47 echo
48 echo "Test 4. Set expression value."
49 echo -ne 'XPATH /pwmd/element[@_name="a"]\tnew value' | pwmc $PWMC_ARGS -S xpath
50 echo -ne 'LIST --all --with-target' | pwmc $PWMC_ARGS xpath > result
51 cmp xpath.result4 result
52 rm -f result
54 test_success