blob: 65419b1998eac8bf3e64f4dba5306c21a4c6ec61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/bin/bash
init edit
# add configs to ck
path1=$BIN/test1.conf
path2=$BIN/test2.conf
path3=$BIN/test3.conf
path4=$BIN/test4.conf
path5=$BIN/test5.conf
add_config prog1 $path1 "" -p
add_config prog1 $path2
add_config prog2 $path3
add_config prog2 $path4
add_config prog3 $path5
# edit primary
exec $BIN/ck -c $BIN e prog1 --command ":" > __test_file &
wait $!
TEST_STR=$(cat __test_file)
EXPECTED_STR="Running: : $(realpath $path1)"
echo "Expected: $EXPECTED_STR" >&${V}
echo " Actual: $TEST_STR" >&${V}
if [[ "$TEST_STR" != "$EXPECTED_STR" ]]; then
err "Worng edit."
exit 1;
fi
# edit specific
exec $BIN/ck -c $BIN e prog1 test2.conf --command ":" > __test_file &
wait $!
echo "Expected: $EXPECTED_STR" >&${V}
echo " Actual: $TEST_STR" >&${V}
TEST_STR=$(cat __test_file)
EXPECTED_STR="Running: : $(realpath $path2)"
if [[ "$TEST_STR" != "$EXPECTED_STR" ]]; then
err "Worng edit."
exit 1;
fi
# Ambiguous config
exec $BIN/ck -c $BIN e prog2 --command ":" > __test_file &
wait $!
echo "Expected: $EXPECTED_STR" >&${V}
echo " Actual: $TEST_STR" >&${V}
TEST_STR=$(head -1 __test_file)
EXPECTED_STR="Ambiguous config. Please type the config name after the program."
if [[ "$TEST_STR" != "$EXPECTED_STR" ]]; then
err "Worng edit."
exit 1;
fi
# solo program
exec $BIN/ck -c $BIN e prog3 --command ":" > __test_file &
wait $!
echo "Expected: $EXPECTED_STR" >&${V}
echo " Actual: $TEST_STR" >&${V}
TEST_STR=$(cat __test_file)
EXPECTED_STR="Running: : $(realpath $path5)"
if [[ "$TEST_STR" != "$EXPECTED_STR" ]]; then
err "Worng edit."
exit 1;
fi
rm __test_file
clear_tests
echo -e $PASS
|