Module Name: src Committed By: rillig Date: Sat Aug 26 10:06:16 UTC 2023
Modified Files: src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/usr.bin: Makefile Added Files: src/tests/usr.bin/error: Makefile t_error.sh Log Message: tests/usr.bin/error: add basic tests for several error message styles To generate a diff of this commit: cvs rdiff -u -r1.1292 -r1.1293 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.200 -r1.201 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.37 -r1.38 src/tests/usr.bin/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/error/Makefile \ src/tests/usr.bin/error/t_error.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.1292 src/distrib/sets/lists/tests/mi:1.1293 --- src/distrib/sets/lists/tests/mi:1.1292 Sat Aug 26 05:27:14 2023 +++ src/distrib/sets/lists/tests/mi Sat Aug 26 10:06:16 2023 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1292 2023/08/26 05:27:14 riastradh Exp $ +# $NetBSD: mi,v 1.1293 2023/08/26 10:06:16 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4846,6 +4846,10 @@ ./usr/tests/usr.bin/dirname/Atffile tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/dirname/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua ./usr/tests/usr.bin/dirname/t_dirname tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/error tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/error/Atffile tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/error/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua +./usr/tests/usr.bin/error/t_error tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/find tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/find/Atffile tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/find/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.200 src/etc/mtree/NetBSD.dist.tests:1.201 --- src/etc/mtree/NetBSD.dist.tests:1.200 Sat Aug 26 05:27:14 2023 +++ src/etc/mtree/NetBSD.dist.tests Sat Aug 26 10:06:16 2023 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.200 2023/08/26 05:27:14 riastradh Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.201 2023/08/26 10:06:16 rillig Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -445,6 +445,7 @@ ./usr/tests/usr.bin/cut ./usr/tests/usr.bin/diff ./usr/tests/usr.bin/dirname +./usr/tests/usr.bin/error ./usr/tests/usr.bin/find ./usr/tests/usr.bin/fstat ./usr/tests/usr.bin/gdb Index: src/tests/usr.bin/Makefile diff -u src/tests/usr.bin/Makefile:1.37 src/tests/usr.bin/Makefile:1.38 --- src/tests/usr.bin/Makefile:1.37 Thu Jul 21 09:52:48 2022 +++ src/tests/usr.bin/Makefile Sat Aug 26 10:06:16 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.37 2022/07/21 09:52:48 kre Exp $ +# $NetBSD: Makefile,v 1.38 2023/08/26 10:06:16 rillig Exp $ # .include <bsd.own.mk> @@ -6,7 +6,7 @@ TESTSDIR= ${TESTSBASE}/usr.bin TESTS_SUBDIRS= awk basename bzip2 cc cmp compress config cpio col cut \ - diff dirname find fstat gdb grep gzip id indent \ + diff dirname error find fstat gdb grep gzip id indent \ infocmp jot ld locale m4 make mixerctl mkdep nbperf \ netpgpverify patch pkill pr printf pwhash realpath rump_server \ shmif_dumpbus sdiff sed sort tar tmux tr unifdef uniq \ Added files: Index: src/tests/usr.bin/error/Makefile diff -u /dev/null src/tests/usr.bin/error/Makefile:1.1 --- /dev/null Sat Aug 26 10:06:16 2023 +++ src/tests/usr.bin/error/Makefile Sat Aug 26 10:06:16 2023 @@ -0,0 +1,6 @@ +# $NetBSD: Makefile,v 1.1 2023/08/26 10:06:16 rillig Exp $ + +TESTSDIR= ${TESTSBASE}/usr.bin/error +TESTS_SH= t_error + +.include <bsd.test.mk> Index: src/tests/usr.bin/error/t_error.sh diff -u /dev/null src/tests/usr.bin/error/t_error.sh:1.1 --- /dev/null Sat Aug 26 10:06:16 2023 +++ src/tests/usr.bin/error/t_error.sh Sat Aug 26 10:06:16 2023 @@ -0,0 +1,101 @@ +# $NetBSD: t_error.sh,v 1.1 2023/08/26 10:06:16 rillig Exp $ +# +# Copyright (c) 2023 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Roland Illig. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +create_file() { + local fn="$1"; shift + printf '%s\n' "$@" > "$fn" +} + +atf_test_case cc +cc_body() { + create_file code.c \ + 'goto error' + create_file err \ + 'code.c:1: error: syntax error' + create_file expected \ + '/*###1 [cc] error: syntax error%%%*/' \ + 'goto error' + + atf_check -o ignore \ + error err + atf_check -o 'file:expected' cat code.c +} + +atf_test_case f77 +f77_body() { + create_file code.f \ + 'doi=1,1,1' + create_file err \ + 'Compiler error line 1 of code.f: syntax error' + create_file expected \ + 'C###1 [f77] Compiler error line 1 of code.f syntax error%%%' \ + 'doi=1,1,1' + + atf_check -o ignore \ + error err + atf_check -o 'file:expected' cat code.f +} + +atf_test_case lint +lint_body() { + create_file code.c \ + 'goto error' + create_file err \ + 'code.c(1): syntax error' + create_file expected \ + '/*###1 [lint] syntax error%%%*/' \ + 'goto error' + + atf_check -o ignore \ + error err + atf_check -o 'file:expected' cat code.c +} + +atf_test_case mod2 +mod2_body() { + create_file code.m2 \ + 'END.' + create_file err \ + 'File code.m2, line 1: missing BEGIN' + create_file expected \ + '(*###1 [mod2] missing BEGIN%%%*)' \ + 'END.' + + atf_check -o ignore \ + error err + atf_check -o 'file:expected' cat code.m2 +} + +atf_init_test_cases() { + atf_add_test_case cc + atf_add_test_case f77 + atf_add_test_case lint + atf_add_test_case mod2 +}