diff options
-rwxr-xr-x | res/test-ck | 24 | ||||
-rw-r--r-- | test/00_init | 2 | ||||
-rw-r--r-- | test/01_add | 2 | ||||
-rw-r--r-- | test/03_delete | 6 | ||||
-rw-r--r-- | test/04_search | 2 | ||||
-rw-r--r-- | test/05_restore | 4 |
6 files changed, 25 insertions, 15 deletions
diff --git a/res/test-ck b/res/test-ck index 647f43d..a7a7cf8 100755 --- a/res/test-ck +++ b/res/test-ck @@ -2,9 +2,12 @@ BIN=$(realpath @CMAKE_BINARY_DIR@) # solve symlink problems TEST_LOCATION=$(realpath @PROJECT_TESTING_GROUNDS@) +V=3 # used in regression tests function running { + # open devnul in fd 3 + exec 3<> /dev/null echo "[$COUNT/$TOTAL] testing $1" ((++COUNT)) } @@ -29,7 +32,13 @@ function add_config { fi } +function set_verbose { + V=1; +} + function clear_tests { + # close fd + exec 3>&- rm $BIN/ckrc rm $BIN/ckdb rm $BIN/test*.conf @@ -75,6 +84,7 @@ function print_help { echo -e " -r, --regression\trun only the regression tests" echo -e " -c, --clear\t\tremove test files" echo -e " \t\t use if the tests crush unexpectedly" + echo -e " -v, --verbose\t\tverbose test output" echo -e " -h, --help, *\t\tprint this" exit } @@ -87,10 +97,7 @@ while [[ $# -gt 0 ]] do key="$1" case $key in - -h | --help) - print_help - ;; - -c | --clear) + -c | --clear) clear_tests exit ;; @@ -102,11 +109,14 @@ do regression_tests exit ;; - *) # unknown option + -v | --verbose) + set_verbose + shift + ;; + -h | --help | *) print_help - exit ;; - esac + esac done run diff --git a/test/00_init b/test/00_init index daba787..a38c81c 100644 --- a/test/00_init +++ b/test/00_init @@ -5,7 +5,7 @@ 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 & +exec $BIN/ck -c $BIN init $TEST_LOCATION/vc $TEST_LOCATION/sec >&${V} & wait $! if [ $? -ne 0 ]; then diff --git a/test/01_add b/test/01_add index 5f156da..05cf13f 100644 --- a/test/01_add +++ b/test/01_add @@ -9,7 +9,7 @@ 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 & + exec $BIN/ck -c $BIN add $1 $BIN/$2 $3 $4 >&${V} & wait $! if [ $? -ne 0 ]; then diff --git a/test/03_delete b/test/03_delete index e4663bd..7e31d66 100644 --- a/test/03_delete +++ b/test/03_delete @@ -15,7 +15,7 @@ add_config prog2 $path3 add_config prog2 $path4 # delete path1 -exec $BIN/ck -c $BIN del prog1 `basename $path1` > /dev/null & +exec $BIN/ck -c $BIN del prog1 `basename $path1` >&${V} & wait $! for i in $($BIN/ck -c $BIN list paths); do @@ -26,7 +26,7 @@ for i in $($BIN/ck -c $BIN list paths); do done # delete path2 (also prog1) -exec $BIN/ck -c $BIN del prog1 `basename $path2` > /dev/null & +exec $BIN/ck -c $BIN del prog1 `basename $path2` >&${V} & wait $! for i in $($BIN/ck -c $BIN list programs); do @@ -36,7 +36,7 @@ for i in $($BIN/ck -c $BIN list programs); do done # delete prog2 -exec $BIN/ck -c $BIN del prog2 > /dev/null & +exec $BIN/ck -c $BIN del prog2 >&${V} & wait $! for i in $($BIN/ck -c $BIN list paths); do diff --git a/test/04_search b/test/04_search index c3600c1..a315730 100644 --- a/test/04_search +++ b/test/04_search @@ -13,7 +13,7 @@ add_config prog1 $path2 "search-term" add_config prog2 $path3 "search-term" add_config prog3 $path4 "search-term" -# delete path1 +# search if [[ $($BIN/ck -c $BIN search search-term | wc -l) != 4 ]]; then err "search failed." fi diff --git a/test/05_restore b/test/05_restore index b27ed35..013e252 100644 --- a/test/05_restore +++ b/test/05_restore @@ -18,7 +18,7 @@ add_config prog2 $path4 rm $path1 $path2 # restore them -exec $BIN/ck -c $BIN restore -p prog1 > /dev/null & +exec $BIN/ck -c $BIN restore -p prog1 >&${V} & wait $! for i in $($BIN/ck -c $BIN list -p prog1); do @@ -32,7 +32,7 @@ done rm $path1 $path2 $path3 $path4 # restore all -exec $BIN/ck -c $BIN restore all > /dev/null & +exec $BIN/ck -c $BIN restore all >&${V} & wait $! for i in $($BIN/ck -c $BIN list paths); do |