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: demonstrate assertion ...



details:   https://anonhg.NetBSD.org/src/rev/3b7fbcfef7ea
branches:  trunk
changeset: 362035:3b7fbcfef7ea
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 26 16:43:20 2022 +0000

description:
tests/lint: demonstrate assertion failure in GCC compound expression

diffstat:

 tests/usr.bin/xlint/lint1/t_integration.sh |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 1acea466947d -r 3b7fbcfef7ea tests/usr.bin/xlint/lint1/t_integration.sh
--- a/tests/usr.bin/xlint/lint1/t_integration.sh        Sat Feb 26 16:21:59 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/t_integration.sh        Sat Feb 26 16:43:20 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.73 2021/10/10 18:16:12 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.74 2022/02/26 16:43:20 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -145,6 +145,27 @@
        fi
 }
 
+atf_test_case 'assertion_failures'
+assertion_failures_body()
+{
+       # seen in sys/external/bsd/drm2/include/linux/kref.h:73
+
+       cat <<'EOF' > input.c
+# 2 "input.c"
+void
+fn(unsigned int u)
+{
+       u = ({
+               do {} while (0);
+               u;
+       });
+}
+EOF
+
+       atf_check -s 'signal' -e 'match:lint: assertion ".*" failed' \
+           "$lint1" -gS 'input.c' '/dev/null'
+}
+
 atf_init_test_cases()
 {
        local src name
@@ -162,4 +183,6 @@
                }"
                atf_add_test_case "$name"
        done
+
+       atf_add_test_case 'assertion_failures'
 }



Home | Main Index | Thread Index | Old Index