Fix a few 'gcc -fanalyzer' warnings.
[pwmd.git] / tests / copy.test
blob1dfa0e83030a6baf525868ea8ed30f6b63eac594
1 #!/bin/sh
3 # Tests for the COPY protocol command.
5 MAX_TESTS=6
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 invoking_user=$USER
15 log_level=9
16 #enable_logging=true
17 [copy]
18 passphrase_file=$WDIR/passphrase.key
19 EOF
20 mv -f data/list data/copy || bail_out "Could not move data/list."
21 launch_pwmd copy
24 test_1() {
25 run_pwmc "-S copy" $DEVNULL <<EOF
26 COPY a a
27 EOF
28 test_failure $test_n $? 536903715 "Fail to copy element to self."
31 test_2() {
32 run_pwmc "-S copy" $DEVNULL <<EOF
33 COPY a new
34 EOF
35 list_recurse copy
36 test_result $test_n $? copy "Copy element to new root."
39 test_3() {
40 run_pwmc "-S copy" $DEVNULL <<EOF
41 COPY new a new
42 EOF
43 list_recurse copy
44 test_result $test_n $? copy "Copy element to new child."
47 test_4() {
48 run_pwmc "-S copy" $DEVNULL <<EOF
49 COPY new a
50 EOF
51 list_recurse copy
52 test_result $test_n $? copy "Copy element to root and overwrite."
55 test_5() {
56 run_pwmc "-S copy" $DEVNULL <<EOF
57 COPY new a b
58 EOF
59 list_recurse copy
60 test_result $test_n $? copy "Copy element to child and overwrite."
63 test_6() {
64 run_pwmc "-S copy" $DEVNULL <<EOF
65 COPY new b
66 EOF
67 list_recurse copy
68 test_result $test_n $? copy "Copy element to target."
71 run_tests $@