aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-09-20 19:21:23 +0300
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-09-20 19:21:23 +0300
commit90a3a45ce58fbc7c1303c746ba174128db732004 (patch)
tree36231e4f47a8fba35883a93ac6a4e76ba4c3c7a9
parent22fca0324c162fa9a6abc5192aea2b5453c057b5 (diff)
downloadck-90a3a45ce58fbc7c1303c746ba174128db732004.tar.gz
ck-90a3a45ce58fbc7c1303c746ba174128db732004.tar.bz2
ck-90a3a45ce58fbc7c1303c746ba174128db732004.zip
add list test
-rw-r--r--CMakeLists.txt2
-rw-r--r--tests/list55
2 files changed, 56 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 008a402..ffd50c9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,6 +82,6 @@ set(BIN_TESTS_DIR ${CMAKE_BINARY_DIR}/res/tests)
set(PROJECT_TESTING_GROUNDS ${CMAKE_BINARY_DIR}/test_files)
configure_file(${TESTS_DIR}/init ${BIN_TESTS_DIR}/init @ONLY)
configure_file(${TESTS_DIR}/add ${BIN_TESTS_DIR}/add @ONLY)
-
+configure_file(${TESTS_DIR}/list ${BIN_TESTS_DIR}/list @ONLY)
# check_ck
configure_file(${RES_DIR}/check_ck check_ck @ONLY)
diff --git a/tests/list b/tests/list
new file mode 100644
index 0000000..7fb4891
--- /dev/null
+++ b/tests/list
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+init list
+
+# setup test configs
+echo "Test 1" > $BIN/test1.conf
+echo "Test 2" > $BIN/test2.conf
+echo "Test 3" > $BIN/test3.conf
+
+function run_list {
+ # add configs to ck
+ path1=$BIN/test1.conf
+ exec $BIN/ck conf $BIN add prog1 $path1 -p > /dev/null &
+ wait $!
+
+ if [ $? -ne 0 ]; then
+ echo -e $ERROR" ck crashed."
+ exit 1
+ fi
+
+ path2=$BIN/test2.conf
+ exec $BIN/ck conf $BIN add prog2 $path2 -s > /dev/null &
+ wait $!
+
+ if [ $? -ne 0 ]; then
+ echo -e $ERROR" ck crashed."
+ exit 1
+ fi
+
+ path3=$BIN/test3.conf
+ exec $BIN/ck conf $BIN add prog3 $path3 -p -s > /dev/null &
+ wait $!
+
+ if [ $? -ne 0 ]; then
+ echo -e $ERROR" ck crashed."
+ exit 1
+ fi
+
+ for i in $($BIN/ck conf $BIN list paths); do
+ if [[ "$i" == "$path1" ]] || [[ "$i" == "$path2" ]] || [[ "$i" == "$path3" ]]; then
+ echo "path good";
+ fi
+ done
+
+ for i in $($BIN/ck conf $BIN list programs); do
+ if [[ "$i" == "prog1" ]] || [[ "$i" == "prog2" ]] || [[ "$i" == "prog3" ]]; then
+ echo "program good";
+ fi
+ done
+}
+
+run_list
+
+clear_tests
+echo -e $PASS