Module Name: src
Committed By: rillig
Date: Sat Jan 2 19:22:42 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: t_integration.sh
Log Message:
lint: fix integration test
The body of an ATF test must never return 1 but instead report failure
via atf_fail. Otherwise the following error message appears:
Failed: Test case body returned a non-ok exit code, but this is
not allowed
The test program t_integration intentionally bypasses the official ATF
API for performance reasons. But even then, it should stick to the API
as close as possible.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.20
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.19 Sat Jan 2 11:12:34 2021
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh Sat Jan 2 19:22:42 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.19 2021/01/02 11:12:34 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.20 2021/01/02 19:22:42 rillig Exp $
#
# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -147,10 +147,10 @@ test_case long_double_int "Checks for co
test_case all_messages
all_messages_body() {
- local srcdir status msg base flags
+ local srcdir ok msg base flags
srcdir="$(atf_get_srcdir)"
- status="0"
+ ok="true"
for msg in $(seq 0 329); do
base="$(printf '%s/msg_%03d' "${srcdir}" "${msg}")"
@@ -160,9 +160,10 @@ all_messages_body() {
# shellcheck disable=SC2154 disable=SC2086
${Atf_Check} -s not-exit:0 -o "file:${base}.exp" -e empty \
${LINT1} ${flags} "${base}.c" /dev/null \
- || status="1"
+ || ok="false"
done
- return "${status}"
+
+ atf_check "${ok}"
}