summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <pmoore@redhat.com>2014-08-26 15:58:42 -0400
committerPaul Moore <pmoore@redhat.com>2014-08-27 09:57:11 -0400
commit52085b7dddf779746373e35d5c70546cc3633553 (patch)
tree2fb0ad10ac137b2f77981bceb393fb3fae178748
parente2b795068dd8ec92ce5cfaade81a915af0dbd61c (diff)
downloadlibseccomp-52085b7dddf779746373e35d5c70546cc3633553.tar.gz
tests: better architecture selection support in the automated tests
This patch adds support for a number of new enhancements to the automated test suite, all of which are focused on the architecture selection of the bpf-sim test type. With this patch, the architecture field can now contain a comma delimited list of architecture names with the following values: * all Add the current native arch to the list. * all_le Add the current native arch to the list only if it is little endian. * +all_le Add all of the supported little endian architectures to the list. * all_be Add the current native arch to the list only if it is big endian. * +all_be Add all of the supported big endian architectures to the list. * <arch> Add the architecture specified by "<arch>" if it is the native architecture. * +<arch> Add the architecture specified by "<arch>" to the list. * -<arch> Remove the architecture specified by "<arch>" to the list if present. Signed-off-by: Paul Moore <pmoore@redhat.com>
-rwxr-xr-xtests/regression73
1 files changed, 60 insertions, 13 deletions
diff --git a/tests/regression b/tests/regression
index 18a537b..e7465d3 100755
--- a/tests/regression
+++ b/tests/regression
@@ -342,23 +342,70 @@ function run_test_bpf_sim() {
local -a high_arg #line[3-8]
local result=${line[9]}
- if [[ "${testarch:0:1}" == "+" ]]; then
- # run the tests on the specified architecture(s)
- simarch_list="${testarch:1}"
- if [[ "$simarch_list" == "all_le" ]]; then
- simarch_list="$GLBL_ARCH_LE_SUPPORT"
- elif [[ "$simarch_list" == "all_be" ]]; then
- simarch_list="$GLBL_ARCH_BE_SUPPORT"
+ # expand the architecture list
+ local simarch_tmp
+ local simarch_avoid
+ simarch_tmp=""
+ simarch_avoid=""
+ for arch_i in $(echo $testarch | sed -e 's/,/ /g'); do
+ case $arch_i in
+ all)
+ # add the native arch
+ simarch_tmp+=" $arch"
+ ;;
+ all_le)
+ # add the native arch only if it is little endian
+ if echo "$GLBL_ARCH_LE_SUPPORT" | grep -qw "$arch"; then
+ simarch_tmp+=" $arch"
+ fi
+ ;;
+ +all_le)
+ # add all of the little endian architectures
+ simarch_tmp+=" $GLBL_ARCH_LE_SUPPORT"
+ ;;
+ all_be)
+ # add the native arch only if it is big endian
+ if echo "$GLBL_ARCH_BE_SUPPORT" | grep -qw "$arch"; then
+ simarch_tmp+=" $arch"
+ fi
+ ;;
+ +all_be)
+ # add all of the big endian architectures
+ simarch_tmp+=" $GLBL_ARCH_BE_SUPPORT"
+ ;;
+ +*)
+ # add the architecture specified
+ simarch_tmp+=" ${arch_i:1}"
+ ;;
+ -*)
+ # remove the architecture specified
+ simarch_avoid+=" ${arch_i:1}"
+ ;;
+ *)
+ # add the architecture specified if it is native
+ if [[ "$arch_i" == "$arch" ]]; then
+ simarch_tmp+=" $arch_i"
+ fi
+ ;;
+ esac
+ done
+
+ # make sure we remove any undesired architectures
+ local simarch_list
+ simarch_list=""
+ for arch_i in $simarch_tmp; do
+ if echo "$simarch_avoid" | grep -q -v -w "$arch_i"; then
+ simarch_list+=" $arch_i"
fi
- elif [[ "$testarch" != "all" ]] && [[ "$testarch" != "$arch" ]]; then
- # only run tests that match the current architecture
+ done
+ simarch_list=$(echo $simarch_list | sed -e 's/ / /g;s/^ //;')
+
+ # do we have any architectures remaining in the list?
+ if [[ $simarch_list == "" ]]; then
print_result $(generate_test_num "$1" $2 1) "INFO" \
- "Test skipped due to test/system architecture difference"
+ "Test skipped due to architecture difference"
stats_skipped=$(($stats_skipped+1))
return
- else
- # run the tests on the native architecture
- simarch_list="$arch"
fi
# get low and high range arg values