Module Name: src Committed By: rillig Date: Sun Jul 11 22:41:36 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: t_integration.sh Log Message: tests/lint: rework ATF test driver To skip tests that work only on particular platforms, a simple 'eval' from the shell does not work since it does not exit on failure. Fix this by storing the commands in a local variable first. Remove configuration knobs 'lint1-only-if-arch' and 'lint1-skip-if-arch' since they are unused. When skipping a test, actually mark it as skipped in the ATF statistics. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/tests/usr.bin/xlint/lint1/t_integration.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.66 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.67 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.66 Tue Jun 29 13:58:13 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sun Jul 11 22:41:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.66 2021/06/29 13:58:13 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.67 2021/07/11 22:41:36 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -65,12 +65,12 @@ configure_test_case() function platform_has(prop) { if (!match(prop, /^(schar|uchar|ilp32|lp64|int|long|ldbl-64|ldbl-96|ldbl-128)$/)) { - printf("bad property '\''%s'\''\n", prop) > "/dev/stderr"; - exit(1); + printf("bad property '\''%s'\''\n", prop) > "/dev/stderr" + exit(1) } if (platform[machine_arch] == "") { - printf("bad machine_arch '\''%s'\''\n", machine_arch) > "/dev/stderr"; - exit(1); + printf("bad machine_arch '\''%s'\''\n", machine_arch) > "/dev/stderr" + exit(1) } return match(" " platform[machine_arch] " ", " " prop " ") } @@ -78,9 +78,7 @@ configure_test_case() BEGIN { machine_arch = "'"$machine_arch"'" flags = "-g -S -w" - seen_only_on_arch = 0 - match_only_on_arch = 0 - skip = 0 + skip = "no" } $1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" { if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") { @@ -89,29 +87,21 @@ configure_test_case() for (i = 3; i < NF; i++) flags = flags " " $i } - if ($2 == "lint1-only-if-arch") { - seen_only_on_arch = 1 - if ($3 == machine_arch) - match_only_on_arch = 1 - } - if ($2 == "lint1-skip-if-arch" && $3 == machine_arch) - skip = 1 if ($2 == "lint1-only-if" && !platform_has($3)) - skip = 1 + skip = "yes" if ($2 == "lint1-skip-if" && platform_has($3)) - skip = 1 + skip = "yes" } END { - if (seen_only_on_arch && !match_only_on_arch) - skip = 1 - printf("flags='\''%s'\''\n", flags) - printf("skip=%s\n", skip ? "yes" : "no") + printf("skip=%s\n", skip) } ' - eval "$(awk "$awk" "$1")" + local config + config="$(awk "$awk" "$1")" || exit 1 + eval "$config" } # shellcheck disable=SC2155 @@ -129,11 +119,10 @@ check_lint1() wrk_ln='/dev/null' fi - configure_test_case "$src" + configure_test_case "$src" # sets 'skip' and 'flags' if [ "$skip" = "yes" ]; then - atf_check -o 'ignore' echo 'skipped' - return + atf_skip "unsuitable platform" fi if [ -f "$exp" ]; then