summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2021-08-03 11:07:43 -0400
committerPaul Moore <paul@paul-moore.com>2021-08-12 12:30:10 -0400
commitb465f2329183adf9735c81e98500cee93eb720c9 (patch)
tree2cafff8d5d408a73fb8a9197831499d70f7873c6 /tests
parent255801bccf89343c684b2b94e85d9e0df484c133 (diff)
downloadlibseccomp-b465f2329183adf9735c81e98500cee93eb720c9.tar.gz
tests: allow multiple test types using comma separated values
You can now run multiple test types using the '-T' argument and the LIBSECCOMP_TSTCFG_TYPE environment variable, for example: % cd tests % ./regression -T bpf-valgrind,live Acked-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/regression19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/regression b/tests/regression
index 53dab75..09ac643 100755
--- a/tests/regression
+++ b/tests/regression
@@ -114,6 +114,21 @@ EOF
}
#
+# Match on a single word/column in a CSV string
+#
+# Arguments:
+# 1 string containing the CSV
+# 2 string containing the word to match
+#
+# Returns true/0 if a match is found false/1 otherwise.
+#
+function match_csv_word() {
+ [[ -z $1 || -z $2 ]] && return 1
+
+ echo "$1" | sed 's/,/ /g' | grep -w "$2"
+}
+
+#
# Generate a string representing the test number
#
# Arguments:
@@ -852,7 +867,9 @@ function run_test() {
local testnumstr=$(generate_test_num "$1" $2 1)
# ensure we only run tests which match the specified type
- [[ -n $type && "$4" != "$type" ]] && return
+ match_csv_word "$type" "$4"
+ local type_match=$?
+ [[ -n $type && $type_match -eq 1 ]] && return
# execute the function corresponding to the test type
if [[ "$4" == "basic" ]]; then