aboutsummaryrefslogtreecommitdiffstats
path: root/res/test-ck
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-11-16 18:05:57 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-11-16 18:05:57 +0200
commit8eb4df24eb30353bea82268440396e50ed8b1bbc (patch)
treec885ab94952315f64bd596512cd23d0ef5509b3e /res/test-ck
parent2919a5e2c1d33d170bffc93dfeaa6292b9fa3dca (diff)
downloadck-8eb4df24eb30353bea82268440396e50ed8b1bbc.tar.gz
ck-8eb4df24eb30353bea82268440396e50ed8b1bbc.tar.bz2
ck-8eb4df24eb30353bea82268440396e50ed8b1bbc.zip
Fix bugs in test-ck and simplify clparser
Diffstat (limited to 'res/test-ck')
-rwxr-xr-xres/test-ck50
1 files changed, 33 insertions, 17 deletions
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