diff options
author | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-07 14:10:52 +0300 |
---|---|---|
committer | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-07 14:10:52 +0300 |
commit | d202883e6d642ba5a973996654cfed674420da22 (patch) | |
tree | 498b07bbba9d16a76cf06d84e45929540222dc87 /tests/01_add | |
parent | a0db476bed7d7b814c426d23b55a74d585a6d8cb (diff) | |
download | ck-d202883e6d642ba5a973996654cfed674420da22.tar.gz ck-d202883e6d642ba5a973996654cfed674420da22.tar.bz2 ck-d202883e6d642ba5a973996654cfed674420da22.zip |
Update regression tests
Diffstat (limited to 'tests/01_add')
-rw-r--r-- | tests/01_add | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/01_add b/tests/01_add new file mode 100644 index 0000000..15ff2b0 --- /dev/null +++ b/tests/01_add @@ -0,0 +1,53 @@ +#!/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 > /dev/null & + 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 +run_add prog2 test2.conf -s +run_add prog3 test3.conf -p -s + +clear_tests +echo -e $PASS |