blob: b1c592fbafcdfecad3860f70f980078fb3841cec (
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
|
#!/bin/bash
init add
# setup test configs
echo "Test 1" > $BIN/test1.conf
echo "Test 2" > $BIN/test2.conf
echo "Test 3" > $BIN/test3.conf
function run_add {
# add configs to ck
exec $BIN/ck conf $BIN add $1 $BIN/$2 $3 $4 &
wait $!
if [ $? -ne 0 ]; then
echo -e $ERROR" ck crashed."
exit 1
fi
# check db
if [ "$(sqlite3 $BIN/ckdb "select name from program where name = '$1'")" != "$1" ]; then
echo -e $ERROR $1" is not in the db."
exit 1
fi
if [ "$(sqlite3 $BIN/ckdb "select path from config where path = '$BIN/$2'")" != "$BIN/$2" ]; then
echo -e $ERROR $2" is not in the db."
exit 1
fi
# check files
FOLDER=vc
if [[ "$3" = "-s" || "$4" = "-s" ]]; then
FOLDER=sec
fi
if [ ! -f $TEST_LOCATION/$FOLDER/$1/$2 ]; then
echo -e $ERROR$2" No move (add "$3" "$4")"
exit 1
fi
if [ ! -L $BIN/$2 ]; then
echo -e $ERROR$2" No symlink (add "$3" "$4")"
exit 1
fi
}
run_add prog1 test1.conf -p
echo ""
run_add prog2 test2.conf -s
echo ""
run_add prog3 test3.conf -p -s
clear_tests
echo -e $PASS
|