aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/00_init24
-rw-r--r--tests/01_add48
-rw-r--r--tests/02_list27
-rw-r--r--tests/03_delete55
-rw-r--r--tests/04_search22
5 files changed, 0 insertions, 176 deletions
diff --git a/tests/00_init b/tests/00_init
deleted file mode 100644
index 1f3f2a6..0000000
--- a/tests/00_init
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-running init
-
-mkdir -p $TEST_LOCATION/vc
-mkdir $TEST_LOCATION/sec
-
-exec $BIN/ck -c $BIN init $TEST_LOCATION/vc $TEST_LOCATION/sec > /dev/null &
-wait $!
-
-if [ $? -ne 0 ]; then
- err "ck crashed."
-fi
-
-if [ ! -f $BIN/ckrc ]; then
- err "Config file not created."
-fi
-
-if [ ! -f $BIN/ckdb ]; then
- err "DB file not created."
-fi
-
-clear_tests 2&>1 /dev/null
-echo -e $PASS
diff --git a/tests/01_add b/tests/01_add
deleted file mode 100644
index 1de64bf..0000000
--- a/tests/01_add
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/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 -c $BIN add $1 $BIN/$2 $3 $4 > /dev/null &
- wait $!
-
- if [ $? -ne 0 ]; then
- err "ck crashed."
- fi
-
- # check db
- if [ "$(sqlite3 $BIN/ckdb "select name from program where name = '$1'")" != "$1" ]; then
- err "$1 is not in the db."
- fi
-
- if [ "$(sqlite3 $BIN/ckdb "select path from config where path = '$BIN/$2'")" != "$BIN/$2" ]; then
- err "$2 is not in the db."
- fi
-
- # check files
- FOLDER=vc
- if [[ "$3" = "-s" || "$4" = "-s" ]]; then
- FOLDER=sec
- fi
-
- if [ ! -f $TEST_LOCATION/$FOLDER/$1/$2 ]; then
- err "$2 No move (add $3 $4)"
- fi
-
- if [ ! -L $BIN/$2 ]; then
- err "$2 No symlink (add $3 $4)"
- 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
diff --git a/tests/02_list b/tests/02_list
deleted file mode 100644
index e330dad..0000000
--- a/tests/02_list
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-init list
-
-# add configs to ck
-path1=$BIN/test1.conf
-path2=$BIN/test2.conf
-path3=$BIN/test3.conf
-
-add_config prog1 $path1
-add_config prog2 $path2
-add_config prog3 $path3
-
-for i in $($BIN/ck -c $BIN list paths); do
- if [[ "$i" != "$path1" ]] && [[ "$i" != "$path2" ]] && [[ "$i" != "$path3" ]]; then
- err "Listing paths"
- fi
-done
-
-for i in $($BIN/ck -c $BIN list programs); do
- if [[ "$i" != "prog1" ]] && [[ "$i" != "prog2" ]] && [[ "$i" != "prog3" ]]; then
- err "Listing programs"
- fi
-done
-
-clear_tests
-echo -e $PASS
diff --git a/tests/03_delete b/tests/03_delete
deleted file mode 100644
index 1668576..0000000
--- a/tests/03_delete
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-init delete
-
-# setup test configs
-path1=$BIN/test1.conf
-path2=$BIN/test2.conf
-path3=$BIN/test3.conf
-path4=$BIN/test4.conf
-
-add_config prog1 $path1
-add_config prog1 $path2
-
-add_config prog2 $path3
-add_config prog2 $path4
-
-# delete path1
-exec $BIN/ck -c $BIN del -c $path1 > /dev/null &
-wait $!
-
-for i in $($BIN/ck -c $BIN list paths); do
- if [[ "$i" == "$path1" ]]; then
- err "Couldn't delete path."
- exit 1
- fi
-done
-
-# delete path2 (also prog1)
-exec $BIN/ck -c $BIN del -c $path2 > /dev/null &
-wait $!
-
-for i in $($BIN/ck -c $BIN list programs); do
- if [[ "$i" == "prog1" ]]; then
- err "Removing all configs should delete the correspondig program."
- fi
-done
-
-# delete prog2
-exec $BIN/ck -c $BIN del prog2 > /dev/null &
-wait $!
-
-for i in $($BIN/ck -c $BIN list paths); do
- if [[ "$i" == "$path3" ]] || [[ "$i" == "$path4" ]]; then
- err "Removing the program should delete all it's configs."
- fi
-done
-
-for i in $($BIN/ck -c $BIN list programs); do
- if [[ "$i" == "prog1" ]]; then
- err "Couldn't remove program."
- fi
-done
-
-clear_tests
-echo -e $PASS
diff --git a/tests/04_search b/tests/04_search
deleted file mode 100644
index c3600c1..0000000
--- a/tests/04_search
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-init search
-
-# setup test configs
-path1=$BIN/test1.conf
-path2=$BIN/test2.conf
-path3=$BIN/test3.conf
-path4=$BIN/test4.conf
-
-add_config prog1 $path1 "search-term"
-add_config prog1 $path2 "search-term"
-add_config prog2 $path3 "search-term"
-add_config prog3 $path4 "search-term"
-
-# delete path1
-if [[ $($BIN/ck -c $BIN search search-term | wc -l) != 4 ]]; then
- err "search failed."
-fi
-
-clear_tests
-echo -e $PASS