Module Name: src Committed By: rillig Date: Tue Jun 29 08:46:10 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: lex_integer.c t_integration.sh Log Message: tests/lint: allow tests to be skipped depending on platform properties To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/lex_integer.c cvs rdiff -u -r1.63 -r1.64 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/lex_integer.c diff -u src/tests/usr.bin/xlint/lint1/lex_integer.c:1.2 src/tests/usr.bin/xlint/lint1/lex_integer.c:1.3 --- src/tests/usr.bin/xlint/lint1/lex_integer.c:1.2 Sun Jun 27 10:14:43 2021 +++ src/tests/usr.bin/xlint/lint1/lex_integer.c Tue Jun 29 08:46:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lex_integer.c,v 1.2 2021/06/27 10:14:43 rillig Exp $ */ +/* $NetBSD: lex_integer.c,v 1.3 2021/06/29 08:46:10 rillig Exp $ */ # 3 "lex_integer.c" /* @@ -7,7 +7,7 @@ * C99 6.4.4.1 "Integer constants" */ -/* lint1-not-on-arch: i386 (has 32-bit long) */ +/* lint1-only-on-lp64 */ void sinki(int); void sinku(unsigned int); Index: src/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.63 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.64 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.63 Sun Jun 27 19:41:15 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Tue Jun 29 08:46:10 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.63 2021/06/27 19:41:15 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.64 2021/06/29 08:46:10 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,24 +36,45 @@ configure_test_case() # shellcheck disable=SC2016 awk=' + function is_ilp32() { + return match(machine_arch, /^(arm|coldfire|hppa|i386|m68000|m68k|mips|mips64|or1k|powerpc|riscv32|sh3|sparc|vax)$/) + } + + function is_lp64() { + return match(machine_arch, /^(aarch64|alpha|ia64|mipsn64|powerpc64|riscv64|sparc64|x86_64)$/) + } + BEGIN { machine_arch = "'"$machine_arch"'" flags = "-g -S -w" + seen_only_on_arch = 0 + match_only_on_arch = 0 skip = 0 } - /^\/\* (lint1-flags|lint1-extra-flags): .*\*\/$/ { - if ($2 == "lint1-flags:") - flags = "" - for (i = 3; i < NF; i++) - flags = flags " " $i - } - /^\/\* lint1-only-on-arch: .* \*\/$/ && $3 != machine_arch { - skip = 1 - } - /^\/\* lint1-not-on-arch: .* \*\/$/ && $3 == machine_arch { - skip = 1 + $1 == "/*" && $2 ~ /^lint1-/ && $NF == "*/" { + if ($2 == "lint1-flags:" || $2 == "lint1-extra-flags:") { + if ($2 == "lint1-flags:") + flags = "" + for (i = 3; i < NF; i++) + flags = flags " " $i + } + if ($2 == "lint1-only-on-arch") { + seen_only_on_arch = 1 + if ($3 == machine_arch) + match_only_on_arch = 1 + } + if ($2 == "lint1-not-on-arch" && $3 == machine_arch) + skip = 1 + if ($2 == "lint1-only-on-ilp32" && !is_ilp32()) + skip = 1 + if ($2 == "lint1-only-on-lp64" && !is_lp64()) + skip = 1 } + END { + if (seen_only_on_arch && !match_only_on_arch) + skip = 1 + printf("flags='\''%s'\''\n", flags) printf("skip=%s\n", skip ? "yes" : "no") }