Module Name: src Committed By: rillig Date: Wed Jun 28 09:35:43 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: t_usage.sh src/tests/usr.bin/xlint/xlint: t_xlint.sh Log Message: tests/lint: use standard form of ATF tests, test removing output file To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/t_usage.sh cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/xlint/t_xlint.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_usage.sh diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.7 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.8 --- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.7 Sat Jun 24 08:11:12 2023 +++ src/tests/usr.bin/xlint/lint1/t_usage.sh Wed Jun 28 09:35:42 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_usage.sh,v 1.7 2023/06/24 08:11:12 rillig Exp $ +# $NetBSD: t_usage.sh,v 1.8 2023/06/28 09:35:42 rillig Exp $ # # Copyright (c) 2023 The NetBSD Foundation, Inc. # All rights reserved. @@ -28,11 +28,7 @@ : "${lint1:=/usr/libexec/lint1}" -suppress_messages_head() -{ - : -} - +atf_test_case 'suppress_messages' suppress_messages_body() { printf 'typedef int dummy;\n' > code.c @@ -80,11 +76,7 @@ suppress_messages_body() "$lint1" -X '1,,,,,,,' code.c /dev/null } -enable_queries_head() -{ - : -} - +atf_test_case 'enable_queries' enable_queries_body() { printf 'typedef int dummy;\n' > code.c Index: src/tests/usr.bin/xlint/xlint/t_xlint.sh diff -u src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.1 src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.2 --- src/tests/usr.bin/xlint/xlint/t_xlint.sh:1.1 Sun Jan 15 23:18:05 2023 +++ src/tests/usr.bin/xlint/xlint/t_xlint.sh Wed Jun 28 09:35:43 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_xlint.sh,v 1.1 2023/01/15 23:18:05 rillig Exp $ +# $NetBSD: t_xlint.sh,v 1.2 2023/06/28 09:35:43 rillig Exp $ # # Copyright (c) 2023 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,13 +25,9 @@ # POSSIBILITY OF SUCH DAMAGE. # -: ${lint:='/usr/bin/lint'} - -run_lint1_error_head() -{ - : -} +: "${lint:=/usr/bin/lint}" +atf_test_case 'run_lint1_error' run_lint1_error_body() { cat <<-EOF >input.c || atf_fail 'prepare input.c' @@ -43,24 +39,22 @@ run_lint1_error_body() return 1; } EOF + echo 'previous content' > input.ln atf_check \ -s 'exit:1' \ -o "inline:input.c(6): error: function has return type '_Bool' but returns 'int' [211]\n" \ "$lint" -aabceghiprSTxz input.c - # In case of an error, no output file is written. + # In case of an error, any previous output file is overwritten, and the + # (possibly unfinished) output file is removed. atf_check \ -s 'exit:1' \ test -f input.ln } -run_lint1_warning_head() -{ - : -} - +atf_test_case 'run_lint1_warning' run_lint1_warning_body() { cat <<-EOF >input.c || atf_fail 'prepare input.c' @@ -88,11 +82,8 @@ run_lint1_warning_body() cat input.ln } -run_lint2_head() -{ - : -} +atf_test_case 'run_lint2' run_lint2_body() { cat <<-EOF >input.ln || atf_fail 'prepare input.ln'