Module Name:    src
Committed By:   gson
Date:           Fri Apr  8 10:09:16 UTC 2016

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/gdb: Makefile t_regress.sh

Log Message:
Add regression tests for some past gdb bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.670 -r1.671 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.125 -r1.126 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.20 -r1.21 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/gdb/Makefile \
    src/tests/usr.bin/gdb/t_regress.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.670 src/distrib/sets/lists/tests/mi:1.671
--- src/distrib/sets/lists/tests/mi:1.670	Wed Apr  6 00:47:15 2016
+++ src/distrib/sets/lists/tests/mi	Fri Apr  8 10:09:16 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.670 2016/04/06 00:47:15 christos Exp $
+# $NetBSD: mi,v 1.671 2016/04/08 10:09:16 gson Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3523,6 +3523,10 @@
 ./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
 ./usr/tests/usr.bin/find/t_find			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/gdb				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/gdb/Atffile			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/gdb/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua
+./usr/tests/usr.bin/gdb/t_regress		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/grep			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/grep/Atffile		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/grep/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.125 src/etc/mtree/NetBSD.dist.tests:1.126
--- src/etc/mtree/NetBSD.dist.tests:1.125	Fri Mar  4 02:44:45 2016
+++ src/etc/mtree/NetBSD.dist.tests	Fri Apr  8 10:09:16 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.125 2016/03/04 02:44:45 ozaki-r Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.126 2016/04/08 10:09:16 gson Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -375,6 +375,7 @@
 ./usr/tests/usr.bin/diff
 ./usr/tests/usr.bin/dirname
 ./usr/tests/usr.bin/find
+./usr/tests/usr.bin/gdb
 ./usr/tests/usr.bin/grep
 ./usr/tests/usr.bin/gzip
 ./usr/tests/usr.bin/id

Index: src/tests/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.20 src/tests/usr.bin/Makefile:1.21
--- src/tests/usr.bin/Makefile:1.20	Fri Nov 14 09:03:39 2014
+++ src/tests/usr.bin/Makefile	Fri Apr  8 10:09:16 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.20 2014/11/14 09:03:39 uebayasi Exp $
+#	$NetBSD: Makefile,v 1.21 2016/04/08 10:09:16 gson Exp $
 #
 
 .include <bsd.own.mk>
@@ -6,7 +6,8 @@
 TESTSDIR=       ${TESTSBASE}/usr.bin
 
 TESTS_SUBDIRS=	awk basename bzip2 cc cmp config cut \
-		diff dirname find grep gzip id infocmp jot ld m4 make mkdep \
+		diff dirname find gdb grep gzip id \
+		infocmp jot ld m4 make mkdep \
 		nbperf netpgpverify pr rump_server shmif_dumpbus sdiff \
 		sed sort tmux tr unifdef vmstat xlint
 

Added files:

Index: src/tests/usr.bin/gdb/Makefile
diff -u /dev/null src/tests/usr.bin/gdb/Makefile:1.1
--- /dev/null	Fri Apr  8 10:09:16 2016
+++ src/tests/usr.bin/gdb/Makefile	Fri Apr  8 10:09:16 2016
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2016/04/08 10:09:16 gson Exp $
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/usr.bin/gdb
+
+TESTS_SH=	t_regress
+
+.include <bsd.test.mk>
Index: src/tests/usr.bin/gdb/t_regress.sh
diff -u /dev/null src/tests/usr.bin/gdb/t_regress.sh:1.1
--- /dev/null	Fri Apr  8 10:09:16 2016
+++ src/tests/usr.bin/gdb/t_regress.sh	Fri Apr  8 10:09:16 2016
@@ -0,0 +1,77 @@
+# $NetBSD: t_regress.sh,v 1.1 2016/04/08 10:09:16 gson Exp $
+#
+# Copyright (c) 2016 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# 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.
+#
+
+# Regression tests for some GDB PRs
+
+# PR 47430
+
+atf_test_case threads
+threads_head() {
+	atf_set "descr" "Test that gdb works with threaded programs"
+	atf_set "require.progs" "gdb"
+}
+threads_body() {
+	# Dig at an unused IP address so that dig fails the
+	# same way on machines with Internet connectivity
+	# as on those without.
+	cat <<EOF >test.gdb
+run +time=1 +tries=1 @127.0.0.177
+cont
+cont
+cont
+cont
+cont
+EOF
+	gdb --batch -x test.gdb dig >gdb.out
+	atf_check -s exit:1 -o ignore -e ignore grep "Program received signal SIGTRAP" gdb.out
+}
+
+# PR 48250
+
+atf_test_case pie
+pie_head() {
+	atf_set "descr" "Test that gdb works with PIE executables"
+	atf_set "require.progs" "cc gdb"
+}
+pie_body() {
+	cat <<\EOF >test.c
+#include <stdio.h>
+int main(int argc, char **argv) { printf ("hello\n"); return 0; }
+EOF
+	cc -fpie -pie -g test.c -o test
+	cat <<EOF >test.gdb
+break main
+run
+EOF
+	gdb --batch -x test.gdb ./test >gdb.out 2>&1
+	atf_check -s exit:1 -o ignore -e ignore grep "annot access memory" gdb.out
+}
+
+atf_init_test_cases() {
+	atf_add_test_case threads
+	atf_add_test_case pie
+}

Reply via email to