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: guard against typos in...



details:   https://anonhg.NetBSD.org/src/rev/18ff8b7e0154
branches:  trunk
changeset: 1023053:18ff8b7e0154
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 21 11:50:57 2021 +0000

description:
tests/lint: guard against typos in test environment configuration

Some tests had "lint1-only-if" without a trailing colon, others included
the trailing colon.  The tests that included the trailing colon were run
even though they were supposed to be skipped, and they failed, as could
be expected.

To prevent further typos, always require the trailing colon, just as in
"lint1-flags" and fail fast on unknown "lint1" comments.

diffstat:

 tests/usr.bin/xlint/lint1/lex_char_uchar.c    |   4 ++--
 tests/usr.bin/xlint/lint1/lex_integer.c       |   4 ++--
 tests/usr.bin/xlint/lint1/lex_integer_ilp32.c |   4 ++--
 tests/usr.bin/xlint/lint1/msg_142.c           |   4 ++--
 tests/usr.bin/xlint/lint1/msg_230.c           |   4 ++--
 tests/usr.bin/xlint/lint1/msg_230_uchar.c     |   4 ++--
 tests/usr.bin/xlint/lint1/msg_259.c           |   4 ++--
 tests/usr.bin/xlint/lint1/msg_259_ilp32.c     |   4 ++--
 tests/usr.bin/xlint/lint1/op_shl_lp64.c       |   4 ++--
 tests/usr.bin/xlint/lint1/t_integration.sh    |  15 ++++++++++-----
 10 files changed, 28 insertions(+), 23 deletions(-)

diffs (179 lines):

diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/lex_char_uchar.c
--- a/tests/usr.bin/xlint/lint1/lex_char_uchar.c        Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_char_uchar.c        Sat Aug 21 11:50:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex_char_uchar.c,v 1.3 2021/06/29 21:33:09 rillig Exp $        */
+/*     $NetBSD: lex_char_uchar.c,v 1.4 2021/08/21 11:50:57 rillig Exp $        */
 # 3 "lex_char_uchar.c"
 
 /*
@@ -6,7 +6,7 @@
  * char has the same representation as unsigned char.
  */
 
-/* lint1-only-if uchar */
+/* lint1-only-if: uchar */
 
 /*
  * Before inittyp.c 1.23 from 2021-06-29, the following initialization
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/lex_integer.c
--- a/tests/usr.bin/xlint/lint1/lex_integer.c   Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_integer.c   Sat Aug 21 11:50:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex_integer.c,v 1.6 2021/07/13 19:38:10 rillig Exp $   */
+/*     $NetBSD: lex_integer.c,v 1.7 2021/08/21 11:50:57 rillig Exp $   */
 # 3 "lex_integer.c"
 
 /*
@@ -7,7 +7,7 @@
  * C99 6.4.4.1 "Integer constants"
  */
 
-/* lint1-only-if lp64 */
+/* lint1-only-if: lp64 */
 
 void sinki(int);
 void sinku(unsigned int);
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/lex_integer_ilp32.c
--- a/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c     Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/lex_integer_ilp32.c     Sat Aug 21 11:50:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lex_integer_ilp32.c,v 1.2 2021/06/29 13:58:13 rillig Exp $     */
+/*     $NetBSD: lex_integer_ilp32.c,v 1.3 2021/08/21 11:50:57 rillig Exp $     */
 # 3 "lex_integer_ilp32.c"
 
 /*
@@ -7,7 +7,7 @@
  * C99 6.4.4.1 "Integer constants"
  */
 
-/* lint1-only-if ilp32 */
+/* lint1-only-if: ilp32 */
 
 void sinki(int);
 void sinku(unsigned int);
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/msg_142.c
--- a/tests/usr.bin/xlint/lint1/msg_142.c       Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_142.c       Sat Aug 21 11:50:57 2021 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: msg_142.c,v 1.5 2021/07/13 19:11:35 rillig Exp $       */
+/*     $NetBSD: msg_142.c,v 1.6 2021/08/21 11:50:57 rillig Exp $       */
 # 3 "msg_142.c"
 
 // Test for message: floating point overflow detected, op %s [142]
 
-/* lint1-only-if ldbl-64 */
+/* lint1-only-if: ldbl-64 */
 /*
  * For 96-bit and 128-bit floating point numbers, a different number of
  * multipliers is needed to produce an overflow.
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/msg_230.c
--- a/tests/usr.bin/xlint/lint1/msg_230.c       Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230.c       Sat Aug 21 11:50:57 2021 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: msg_230.c,v 1.4 2021/07/03 19:31:22 rillig Exp $       */
+/*     $NetBSD: msg_230.c,v 1.5 2021/08/21 11:50:57 rillig Exp $       */
 # 3 "msg_230.c"
 
 // Test for message: nonportable character comparison, op %s [230]
 
 /* lint1-flags: -S -g -p -w */
-/* lint1-only-if schar */
+/* lint1-only-if: schar */
 
 void example(char c, unsigned char uc, signed char sc)
 {
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/msg_230_uchar.c
--- a/tests/usr.bin/xlint/lint1/msg_230_uchar.c Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230_uchar.c Sat Aug 21 11:50:57 2021 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: msg_230_uchar.c,v 1.1 2021/07/03 19:31:22 rillig Exp $ */
+/*     $NetBSD: msg_230_uchar.c,v 1.2 2021/08/21 11:50:57 rillig Exp $ */
 # 3 "msg_230_uchar.c"
 
 // Test for message: nonportable character comparison, op %s [230]
 
 /* lint1-flags: -S -g -p -w */
-/* lint1-only-if uchar */
+/* lint1-only-if: uchar */
 
 void example(char c, unsigned char uc, signed char sc)
 {
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/msg_259.c
--- a/tests/usr.bin/xlint/lint1/msg_259.c       Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.c       Sat Aug 21 11:50:57 2021 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: msg_259.c,v 1.10 2021/08/21 11:19:38 rillig Exp $      */
+/*     $NetBSD: msg_259.c,v 1.11 2021/08/21 11:50:57 rillig Exp $      */
 # 3 "msg_259.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
 
-/* lint1-only-if lp64 */
+/* lint1-only-if: lp64 */
 /* lint1-extra-flags: -h */
 
 void farg_char(char);
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/msg_259_ilp32.c
--- a/tests/usr.bin/xlint/lint1/msg_259_ilp32.c Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259_ilp32.c Sat Aug 21 11:50:57 2021 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: msg_259_ilp32.c,v 1.2 2021/06/29 13:58:13 rillig Exp $ */
+/*     $NetBSD: msg_259_ilp32.c,v 1.3 2021/08/21 11:50:57 rillig Exp $ */
 # 3 "msg_259_ilp32.c"
 
 // Test for message: argument #%d is converted from '%s' to '%s' due to prototype [259]
 
-/* lint1-only-if ilp32 */
+/* lint1-only-if: ilp32 */
 /* lint1-extra-flags: -h */
 
 void farg_char(char);
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/op_shl_lp64.c
--- a/tests/usr.bin/xlint/lint1/op_shl_lp64.c   Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/op_shl_lp64.c   Sat Aug 21 11:50:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: op_shl_lp64.c,v 1.2 2021/07/31 19:52:44 rillig Exp $   */
+/*     $NetBSD: op_shl_lp64.c,v 1.3 2021/08/21 11:50:57 rillig Exp $   */
 # 3 "op_shl_lp64.c"
 
 /*
@@ -11,7 +11,7 @@
  * These warnings had been discovered in ecp_nistp256.c(296).
  */
 
-/* lint1-only-if lp64 */
+/* lint1-only-if: lp64 */
 
 const __uint128_t zero105 =
     (((__uint128_t)1) << 105)
diff -r 948829bc78aa -r 18ff8b7e0154 tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh        Sat Aug 21 11:27:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh        Sat Aug 21 11:50:57 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.68 2021/07/13 18:50:16 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.69 2021/08/21 11:50:57 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -85,11 +85,16 @@
                                        flags = ""
                                for (i = 3; i < NF; i++)
                                        flags = flags " " $i
+                       } else if ($2 == "lint1-only-if:") {
+                                if (!platform_has($3))
+                                       skip = "yes"
+                       } else if ($2 == "lint1-skip-if:") {
+                               if (platform_has($3))
+                                       skip = "yes"
+                       } else {
+                               printf("bad lint1 comment '\''%s'\''\n", $2) > "/dev/stderr"
+                               exit(1)
                        }
-                       if ($2 == "lint1-only-if" && !platform_has($3))
-                               skip = "yes"
-                       if ($2 == "lint1-skip-if" && platform_has($3))
-                               skip = "yes"
                }
 
                END {



Home | Main Index | Thread Index | Old Index