Update m4/ macros.
[pwmd.git] / tests / rename.test
blobc88b77c31e296e0ec5e6b7587a52dd29361c7464
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 [rename]
12 passphrase_file=`pwd`/passphrase.key
13 EOF
15 set -e
16 mv -f data/list data/rename
17 launch_pwmd rename
19 begin_test
20 test_header "Test 1. Rename to self (fail)."
21 set +o errexit
22 echo -ne 'RENAME d\te e' | pwmc $PWMC_ARGS -S rename
23 if [ ${PIPESTATUS[1]} == 0 ]; then
24 echo "The previous command should have failed. Stopping."
25 exit 1
28 set -e
30 echo
31 test_header "Test 2. Rename to self target."
32 echo -ne 'RENAME b a' | pwmc $PWMC_ARGS -S rename
33 echo -ne 'LIST --recurse' | pwmc $PWMC_ARGS rename > result
34 cmp rename.result2 result
35 rm -f result
37 echo
38 test_header "Test 3. Rename."
39 echo -ne 'RENAME a b' | pwmc $PWMC_ARGS -S rename
40 echo -ne 'LIST --recurse' | pwmc $PWMC_ARGS rename > result
41 cmp rename.result3 result
42 rm -f result
44 test_success