Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: allow tests to be skip...
details: https://anonhg.NetBSD.org/src/rev/bc8ce6262235
branches: trunk
changeset: 379961:bc8ce6262235
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Jun 29 08:46:10 2021 +0000
description:
tests/lint: allow tests to be skipped depending on platform properties
diffstat:
tests/usr.bin/xlint/lint1/lex_integer.c | 4 +-
tests/usr.bin/xlint/lint1/t_integration.sh | 45 ++++++++++++++++++++++--------
2 files changed, 35 insertions(+), 14 deletions(-)
diffs (84 lines):
diff -r 2f7774d44162 -r bc8ce6262235 tests/usr.bin/xlint/lint1/lex_integer.c
--- a/tests/usr.bin/xlint/lint1/lex_integer.c Tue Jun 29 08:02:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_integer.c Tue Jun 29 08:46:10 2021 +0000
@@ -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);
diff -r 2f7774d44162 -r bc8ce6262235 tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh Tue Jun 29 08:02:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh Tue Jun 29 08:46:10 2021 +0000
@@ -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
+ $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
}
- /^\/\* lint1-only-on-arch: .* \*\/$/ && $3 != machine_arch {
- skip = 1
- }
- /^\/\* lint1-not-on-arch: .* \*\/$/ && $3 == machine_arch {
- 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")
}
Home |
Main Index |
Thread Index |
Old Index