From 52085b7dddf779746373e35d5c70546cc3633553 Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Tue, 26 Aug 2014 15:58:42 -0400 Subject: 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. * Add the architecture specified by "" if it is the native architecture. * + Add the architecture specified by "" to the list. * - Remove the architecture specified by "" to the list if present. Signed-off-by: Paul Moore --- tests/regression | 73 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file 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 -- cgit v1.2.1