Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src lint: add test for triggering assertion failures in lint1



details:   https://anonhg.NetBSD.org/src/rev/e8e63a2c9ce4
branches:  trunk
changeset: 979787:e8e63a2c9ce4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 10 18:06:38 2021 +0000

description:
lint: add test for triggering assertion failures in lint1

diffstat:

 distrib/sets/lists/tests/mi                 |   4 +++-
 tests/usr.bin/xlint/lint1/Makefile          |   4 +++-
 tests/usr.bin/xlint/lint1/d_lint_assert.c   |  19 +++++++++++++++++++
 tests/usr.bin/xlint/lint1/d_lint_assert.exp |   1 +
 tests/usr.bin/xlint/lint1/t_integration.sh  |   3 ++-
 5 files changed, 28 insertions(+), 3 deletions(-)

diffs (81 lines):

diff -r 9f50e5c4b17f -r e8e63a2c9ce4 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Jan 10 17:43:46 2021 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Jan 10 18:06:38 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1009 2021/01/10 17:43:46 rillig Exp $
+# $NetBSD: mi,v 1.1010 2021/01/10 18:06:38 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5799,6 +5799,8 @@
 ./usr/tests/usr.bin/xlint/lint1/d_incorrect_array_size.exp     tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_init_pop_member.c            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_init_pop_member.exp          tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_lint_assert.c                        tests-usr.bin-tests     compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_lint_assert.exp              tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_long_double_int.c            tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_long_double_int.exp          tests-usr.bin-tests     compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_nested_structs.c             tests-usr.bin-tests     compattestfile,atf
diff -r 9f50e5c4b17f -r e8e63a2c9ce4 tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Sun Jan 10 17:43:46 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Sun Jan 10 18:06:38 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.27 2021/01/10 17:43:46 rillig Exp $
+# $NetBSD: Makefile,v 1.28 2021/01/10 18:06:38 rillig Exp $
 
 NOMAN=         # defined
 
@@ -67,6 +67,8 @@
 FILES+=                d_incorrect_array_size.exp
 FILES+=                d_init_pop_member.c
 FILES+=                d_init_pop_member.exp
+FILES+=                d_lint_assert.c
+FILES+=                d_lint_assert.exp
 FILES+=                d_long_double_int.c
 FILES+=                d_long_double_int.exp
 FILES+=                d_nested_structs.c
diff -r 9f50e5c4b17f -r e8e63a2c9ce4 tests/usr.bin/xlint/lint1/d_lint_assert.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.c Sun Jan 10 18:06:38 2021 +0000
@@ -0,0 +1,19 @@
+/*     $NetBSD: d_lint_assert.c,v 1.1 2021/01/10 18:06:38 rillig Exp $ */
+# 3 "d_lint_assert.c"
+
+/*
+ * Trigger the various assertions in the lint1 code.  Several of them are
+ * just hard to trigger, but not impossible.
+*/
+
+/* lint1-extra-flags: -p */
+
+enum {
+       // lint: assertion "sym->s_scl == EXTERN || sym->s_scl == STATIC"
+       // failed in check_global_variable at decl.c:3135
+       // near d_lint_assert.c:14
+       //A = +++
+       DUMMY = 0
+};
+
+"syntax error to keep the .exp file."
diff -r 9f50e5c4b17f -r e8e63a2c9ce4 tests/usr.bin/xlint/lint1/d_lint_assert.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.exp       Sun Jan 10 18:06:38 2021 +0000
@@ -0,0 +1,1 @@
+d_lint_assert.c(19): syntax error '"' [249]
diff -r 9f50e5c4b17f -r e8e63a2c9ce4 tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh        Sun Jan 10 17:43:46 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh        Sun Jan 10 18:06:38 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.23 2021/01/10 17:43:46 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.24 2021/01/10 18:06:38 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -79,6 +79,7 @@
 test_case fold_test
 test_case gcc_extension
 test_case init_pop_member
+test_case lint_assert
 test_case return_type
 test_case type_question_colon
 test_case typefun



Home | Main Index | Thread Index | Old Index