Module Name: src Committed By: rillig Date: Sat Jan 9 14:33:53 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: t_integration.sh Log Message: lint: allow tests to specify additional flags Several of the tests only need to add the -p flag. Mentioning the (current) default flags in each of these tests is redundant. Therefore, allow them to specify "lint1-extra-flags: -p" instead of the current "lint1-flags: -g -S -w -p". To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 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/tests/usr.bin/xlint/lint1/t_integration.sh diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.20 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.21 --- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.20 Sat Jan 2 19:22:42 2021 +++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sat Jan 9 14:33:53 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_integration.sh,v 1.20 2021/01/02 19:22:42 rillig Exp $ +# $NetBSD: t_integration.sh,v 1.21 2021/01/09 14:33:53 rillig Exp $ # # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -152,10 +152,25 @@ all_messages_body() { srcdir="$(atf_get_srcdir)" ok="true" + # shellcheck disable=SC2016 + extract_flags_awk=' + BEGIN { + flags = "-g -S -w" + } + /^\/\* (lint1-flags|lint1-extra-flags): .*\*\/$/ { + if ($2 == "lint1-flags:") + flags = "" + for (i = 3; i < NF; i++) + flags = flags " " $i + } + END { + print flags + } + ' + for msg in $(seq 0 329); do base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")" - flags="$(sed -n 's,^/\* lint1-flags: \(.*\) \*/$,\1,p' "${base}.c")" - flags="${flags:--g -S -w}" + flags="$(awk "$extract_flags_awk" "${base}.c")" # shellcheck disable=SC2154 disable=SC2086 ${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \