From 8eb4df24eb30353bea82268440396e50ed8b1bbc Mon Sep 17 00:00:00 2001 From: gramanas Date: Fri, 16 Nov 2018 18:05:57 +0200 Subject: Fix bugs in test-ck and simplify clparser --- res/test-ck | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'res/test-ck') diff --git a/res/test-ck b/res/test-ck index a7a7cf8..35837fa 100755 --- a/res/test-ck +++ b/res/test-ck @@ -3,7 +3,9 @@ BIN=$(realpath @CMAKE_BINARY_DIR@) # solve symlink problems TEST_LOCATION=$(realpath @PROJECT_TESTING_GROUNDS@) V=3 - +FILTER="" +REG=1 +UNIT=1 # used in regression tests function running { # open devnul in fd 3 @@ -52,15 +54,19 @@ function unit_tests { } function regression_tests { - echo -e "Regression Tests:" + FL="" + if [ "$FILTER" != "" ]; then + FL=" (Using filter: *$FILTER*)" + fi + echo -e "Regression Tests:$FL" echo -e "~~~~~~~~~~~~~~~~~" DIR=@BIN_TEST_DIR@ COUNT=1 - TOTAL=$(ls $DIR | wc -l) - for i in $(ls $DIR); do - ERROR="TEST "$i" FAILED:" - PASS="=> $i passed\n" - source $DIR/$i + TOTAL=$(ls $DIR/*$FILTER* | wc -l) + for i in $(ls $DIR/*$FILTER*); do + ERROR="TEST "`basename $i`" FAILED:" + PASS="=> `basename $i` passed\n" + source $i wait $! done } @@ -72,8 +78,16 @@ function err { } function run { - unit_tests - regression_tests + if [ $UNIT -eq 1 ]; then + unit_tests + fi + + if [ $REG -eq 1 ]; then + regression_tests + elif [ $REG -eq $UNIT ]; then + unit_tests + regression_tests + fi } function print_help { @@ -82,6 +96,7 @@ function print_help { echo -e "\nflags:" echo -e " -u, --unit\t\trun only the unit tests" echo -e " -r, --regression\trun only the regression tests" + echo -e " -f, --filter\trun regression test matching the argument" 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" @@ -89,10 +104,6 @@ function print_help { exit } -if [[ $# -gt 1 ]]; then - print_help -fi - while [[ $# -gt 0 ]] do key="$1" @@ -102,12 +113,17 @@ do exit ;; -u | --unit) - unit_tests - exit + REG=0; + shift ;; + -f | --filter) + FILTER=$2; + shift + shift + ;; -r | --regression) - regression_tests - exit + UNIT=0; + shift ;; -v | --verbose) set_verbose -- cgit v1.2.3