Module Name:    src
Committed By:   jruoho
Date:           Sun Mar 18 10:12:31 UTC 2012

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/sed: Makefile t_sed.sh

Log Message:
Add a test case for PR bin/28126. Does not fail with GNU sed.


To generate a diff of this commit:
cvs rdiff -u -r1.447 -r1.448 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.64 -r1.65 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/sed/Makefile \
    src/tests/usr.bin/sed/t_sed.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.447 src/distrib/sets/lists/tests/mi:1.448
--- src/distrib/sets/lists/tests/mi:1.447	Sun Mar 18 08:52:07 2012
+++ src/distrib/sets/lists/tests/mi	Sun Mar 18 10:12:30 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.447 2012/03/18 08:52:07 jruoho Exp $
+# $NetBSD: mi,v 1.448 2012/03/18 10:12:30 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2967,6 +2967,9 @@
 ./usr/tests/usr.bin/sdiff/d_tabs1.in		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/sdiff/d_tabs2.in		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/sdiff/t_sdiff		tests-usr.bin-tests	atf
+./usr/tests/usr.bin/sed				tests-usr.bin-tests
+./usr/tests/usr.bin/sed/Atffile			tests-usr.bin-tests	atf
+./usr/tests/usr.bin/sed/t_sed			tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/shmif_dumpbus				tests-usr.bin-tests
 ./usr/tests/usr.bin/shmif_dumpbus/Atffile			tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/shmif_dumpbus/d_pcap.out.bz2.uue		tests-usr.bin-tests	atf

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.64 src/etc/mtree/NetBSD.dist.tests:1.65
--- src/etc/mtree/NetBSD.dist.tests:1.64	Sat Mar 17 17:16:41 2012
+++ src/etc/mtree/NetBSD.dist.tests	Sun Mar 18 10:12:31 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.64 2012/03/17 17:16:41 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.65 2012/03/18 10:12:31 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -282,6 +282,7 @@
 ./usr/tests/usr.bin/pr
 ./usr/tests/usr.bin/rump_server
 ./usr/tests/usr.bin/sdiff
+./usr/tests/usr.bin/sed
 ./usr/tests/usr.bin/shmif_dumpbus
 ./usr/tests/usr.bin/sort
 ./usr/tests/usr.bin/unifdef

Index: src/tests/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.9 src/tests/usr.bin/Makefile:1.10
--- src/tests/usr.bin/Makefile:1.9	Sat Mar 17 17:15:29 2012
+++ src/tests/usr.bin/Makefile	Sun Mar 18 10:12:30 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2012/03/17 17:15:29 jruoho Exp $
+#	$NetBSD: Makefile,v 1.10 2012/03/18 10:12:30 jruoho Exp $
 #
 
 .include <bsd.own.mk>
@@ -7,6 +7,6 @@ TESTSDIR=       ${TESTSBASE}/usr.bin
 
 TESTS_SUBDIRS=	awk basename bzip2 cc config cut \
 		diff dirname grep gzip id m4 make mkdep \
-		pr rump_server shmif_dumpbus sdiff sort unifdef xlint
+		pr rump_server shmif_dumpbus sdiff sed sort unifdef xlint
 
 .include <bsd.test.mk>

Added files:

Index: src/tests/usr.bin/sed/Makefile
diff -u /dev/null src/tests/usr.bin/sed/Makefile:1.1
--- /dev/null	Sun Mar 18 10:12:31 2012
+++ src/tests/usr.bin/sed/Makefile	Sun Mar 18 10:12:30 2012
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2012/03/18 10:12:30 jruoho Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/usr.bin/sed
+TESTS_SH=	t_sed
+
+.include <bsd.test.mk>
Index: src/tests/usr.bin/sed/t_sed.sh
diff -u /dev/null src/tests/usr.bin/sed/t_sed.sh:1.1
--- /dev/null	Sun Mar 18 10:12:31 2012
+++ src/tests/usr.bin/sed/t_sed.sh	Sun Mar 18 10:12:30 2012
@@ -0,0 +1,52 @@
+# $NetBSD: t_sed.sh,v 1.1 2012/03/18 10:12:30 jruoho Exp $
+#
+# Copyright (c) 2012 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# 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.
+#
+
+atf_test_case emptybackref
+emptybackref_head() {
+	atf_set "descr" "Test that sed(1) handles " \
+			"empty back references (PR bin/28126)"
+}
+
+emptybackref_body() {
+
+	atf_check -o inline:"foobar\n" -x "echo foobar"
+
+	atf_check -o inline:"foo1bar1\n" \
+		-x "echo foo1bar1 | sed -ne '/foo\(.*\)bar\1/p'"
+
+	atf_expect_fail "PR bin/28126"
+
+	atf_check -o inline:"foobar\n" \
+		-x "echo foobar | sed -ne '/foo\(.*\)bar\1/p'"
+}
+
+atf_init_test_cases() {
+	atf_add_test_case emptybackref
+}

Reply via email to