3 source import-common.sh
12 passphrase_file=`pwd`/passphrase.key
14 passphrase_file=`pwd`/passphrase.key
20 test_header
"Test 1. An element with the same value as the element name."
21 cp -f data
/datafile data
/datafile.tmp
22 echo -ne 'a\ta' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile.tmp
23 echo -ne 'GET a' | pwmc
$PWMC_ARGS datafile.tmp
> result
25 cmp store.result1 result
29 test_header
"Test 2. Empty content (fail)."
30 cp -f data
/datafile data
/datafile.tmp
31 echo -ne 'a\t' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile.tmp
33 echo -ne 'GET a' | pwmc
$PWMC_ARGS datafile.tmp
> result
34 if [ ${PIPESTATUS[1]} == 0 ]; then
35 echo "The previous command should have failed. Stopping."
42 test_header
"Test 3. Child element content."
43 echo -ne 'a\tb\ta b value' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile
44 echo -ne 'GET a\tb' | pwmc
$PWMC_ARGS datafile
> result
45 cmp store.result3 result
49 test_header
"Test 4. Root targets."
50 echo -ne 'ATTR SET target b a' | pwmc
$PWMC_ARGS -S datafile
51 echo -ne 'GET b\tb' | pwmc
$PWMC_ARGS datafile
> result
52 cmp store.result4 result
56 test_header
"Test 5. Store target content."
57 echo -ne 'b\tb\ta b value' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile
58 echo -ne 'GET b\tb' | pwmc
$PWMC_ARGS datafile
> result
59 cmp store.result5 result
62 test_header
"Test 6. Recursion loop."
63 cp -f data
/datafile data
/datafile.tmp
64 echo -ne 'ATTR SET target a b' | pwmc
$PWMC_ARGS -S datafile.tmp
65 echo -ne 'LIST --recurse' | pwmc
$PWMC_ARGS datafile.tmp
> result
66 cmp store.result6 result
70 test_header
"Test 7. Recursion to parent (fail)."
72 echo -ne 'ATTR SET target a\tb a' | pwmc
$PWMC_ARGS -S datafile.tmp
73 if [ ${PIPESTATUS[1]} == 0 ]; then
74 echo "The previous command should have failed. Stopping."
81 test_header
"Test 8. Target to child."
82 cp -f data
/datafile data
/datafile.tmp
83 echo -ne 'ATTR SET target a a\tb' | pwmc
$PWMC_ARGS -S datafile.tmp
84 echo -ne 'LIST --recurse' | pwmc
$PWMC_ARGS datafile.tmp
> result
85 cmp store.result8 result
89 test_header
"Test 9. Create element at element with recursion loop (fail)."
90 echo -ne 'ATTR SET target a\tb b' | pwmc
$PWMC_ARGS -S datafile
92 echo -ne 'a\tb\tc\t' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile
93 if [ ${PIPESTATUS[1]} == 0 ]; then
94 echo "The previous command should have failed. Stopping."
101 test_header
"Test 10. Create content at element with recursion loop (fail)."
103 echo -ne 'a\tb\tcontent' | pwmc
$PWMC_ARGS --inquire STORE
-S datafile
104 if [ ${PIPESTATUS[1]} == 0 ]; then
105 echo "The previous command should have failed. Stopping."