diff options
author | Paul Moore <paul@paul-moore.com> | 2021-08-03 11:07:43 -0400 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2021-08-12 12:37:34 -0400 |
commit | 8c28d83da9206a89b4f490dd4a862c69dae0e9f0 (patch) | |
tree | c7f14b7aaf0f8f2bfbc8645cf6305c778a486e7e | |
parent | f93a872fbc404df3dd3739dd399ad67f139fb1fa (diff) | |
download | libseccomp-8c28d83da9206a89b4f490dd4a862c69dae0e9f0.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>
(imported from commit b465f2329183adf9735c81e98500cee93eb720c9)
-rwxr-xr-x | tests/regression | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/regression b/tests/regression index 1496294..d7d24eb 100755 --- a/tests/regression +++ b/tests/regression @@ -109,6 +109,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: @@ -847,7 +862,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 |