Module Name:    src
Committed By:   rillig
Date:           Sun Jan 10 18:06:39 UTC 2021

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
Added Files:
        src/tests/usr.bin/xlint/lint1: d_lint_assert.c d_lint_assert.exp

Log Message:
lint: add test for triggering assertion failures in lint1


To generate a diff of this commit:
cvs rdiff -u -r1.1009 -r1.1010 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.27 -r1.28 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_lint_assert.c \
    src/tests/usr.bin/xlint/lint1/d_lint_assert.exp
cvs rdiff -u -r1.23 -r1.24 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/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1009 src/distrib/sets/lists/tests/mi:1.1010
--- src/distrib/sets/lists/tests/mi:1.1009	Sun Jan 10 17:43:46 2021
+++ src/distrib/sets/lists/tests/mi	Sun Jan 10 18:06:38 2021
@@ -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

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.27 src/tests/usr.bin/xlint/lint1/Makefile:1.28
--- src/tests/usr.bin/xlint/lint1/Makefile:1.27	Sun Jan 10 17:43:46 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Jan 10 18:06:38 2021
@@ -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.c
 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

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.23 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.24
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.23	Sun Jan 10 17:43:46 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Sun Jan 10 18:06:38 2021
@@ -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 decl_old_style_arguments
 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

Added files:

Index: src/tests/usr.bin/xlint/lint1/d_lint_assert.c
diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_lint_assert.c:1.1
--- /dev/null	Sun Jan 10 18:06:39 2021
+++ src/tests/usr.bin/xlint/lint1/d_lint_assert.c	Sun Jan 10 18:06:38 2021
@@ -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."
Index: src/tests/usr.bin/xlint/lint1/d_lint_assert.exp
diff -u /dev/null src/tests/usr.bin/xlint/lint1/d_lint_assert.exp:1.1
--- /dev/null	Sun Jan 10 18:06:39 2021
+++ src/tests/usr.bin/xlint/lint1/d_lint_assert.exp	Sun Jan 10 18:06:38 2021
@@ -0,0 +1 @@
+d_lint_assert.c(19): syntax error '"' [249]

Reply via email to