Fix commit 3c72e54.
[pwmd.git] / tests / realpath.test
blobe2545df848c49c98be8c20ad49886e354026891a
1 #!/bin/sh
3 # Tests for the REALPATH protocol command.
5 MAX_TESTS=3
7 . $AM_SRCDIR/common.sh
8 . $AM_SRCDIR/import-common.sh
10 init_tests() {
11 do_import list
12 cat >$OUTDIR/config << EOF
13 [global]
14 log_level=9
15 #enable_logging=true
16 [realpath]
17 passphrase_file=$WDIR/list.key
18 EOF
19 mv -f data/list data/realpath || bail_out "Could not move data/list."
20 launch_pwmd realpath
23 test_1() {
24 run_pwmc "realpath" $DEVNULL <<EOF
25 REALPATH target-loop-a
26 EOF
27 test_failure $test_n $? 536903743 "Fail due to recursion loop."
30 test_2() {
31 run_pwmc "realpath" >result $DEVNULL <<EOF
32 REALPATH b b c d
33 EOF
34 test_result $test_n $? realpath "Path with targets."
37 test_3() {
38 run_pwmc "realpath" $DEVNULL <<EOF
39 REALPATH bad-target
40 EOF
41 test_failure $test_n $? 536871048 "Fail due to non-existing target element."
44 run_tests $@