1*0bd3c92eSjruoho# $NetBSD: t_regress.sh,v 1.3 2020/06/25 11:12:03 jruoho Exp $ 2e2140365Sgson# 3e2140365Sgson# Copyright (c) 2016 The NetBSD Foundation, Inc. 4e2140365Sgson# All rights reserved. 5e2140365Sgson# 6e2140365Sgson# Redistribution and use in source and binary forms, with or without 7e2140365Sgson# modification, are permitted provided that the following conditions 8e2140365Sgson# are met: 9e2140365Sgson# 1. Redistributions of source code must retain the above copyright 10e2140365Sgson# notice, this list of conditions and the following disclaimer. 11e2140365Sgson# 2. Redistributions in binary form must reproduce the above copyright 12e2140365Sgson# notice, this list of conditions and the following disclaimer in the 13e2140365Sgson# documentation and/or other materials provided with the distribution. 14e2140365Sgson# 15e2140365Sgson# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16e2140365Sgson# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17e2140365Sgson# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18e2140365Sgson# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19e2140365Sgson# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20e2140365Sgson# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21e2140365Sgson# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22e2140365Sgson# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23e2140365Sgson# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24e2140365Sgson# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25e2140365Sgson# POSSIBILITY OF SUCH DAMAGE. 26e2140365Sgson# 27e2140365Sgson 28e2140365Sgson# Regression tests for some GDB PRs 29e2140365Sgson 30e2140365Sgsonatf_test_case threads 31e2140365Sgsonthreads_head() { 32*0bd3c92eSjruoho atf_set "descr" "Test that gdb works with " \ 33*0bd3c92eSjruoho "threaded programs (PR bin/47430)" 34e2140365Sgson atf_set "require.progs" "gdb" 35e2140365Sgson} 36e2140365Sgsonthreads_body() { 37e2140365Sgson # Dig at an unused IP address so that dig fails the 38e2140365Sgson # same way on machines with Internet connectivity 39e2140365Sgson # as on those without. 40e2140365Sgson cat <<EOF >test.gdb 41e2140365Sgsonrun +time=1 +tries=1 @127.0.0.177 42e2140365Sgsoncont 43e2140365Sgsoncont 44e2140365Sgsoncont 45e2140365Sgsoncont 46e2140365Sgsoncont 47e2140365SgsonEOF 48e2140365Sgson gdb --batch -x test.gdb dig >gdb.out 49e2140365Sgson atf_check -s exit:1 -o ignore -e ignore grep "Program received signal SIGTRAP" gdb.out 50e2140365Sgson} 51e2140365Sgson 52e2140365Sgsonatf_test_case pie 53e2140365Sgsonpie_head() { 54*0bd3c92eSjruoho atf_set "descr" "Test that gdb works with " \ 55*0bd3c92eSjruoho "PIE executables (PR bin/48250)" 56e2140365Sgson atf_set "require.progs" "cc gdb" 57e2140365Sgson} 58e2140365Sgsonpie_body() { 59e2140365Sgson cat <<\EOF >test.c 60e2140365Sgson#include <stdio.h> 61e2140365Sgsonint main(int argc, char **argv) { printf ("hello\n"); return 0; } 62e2140365SgsonEOF 63e2140365Sgson cc -fpie -pie -g test.c -o test 64e2140365Sgson cat <<EOF >test.gdb 65e2140365Sgsonbreak main 66e2140365Sgsonrun 67e2140365SgsonEOF 68e2140365Sgson gdb --batch -x test.gdb ./test >gdb.out 2>&1 69e2140365Sgson atf_check -s exit:1 -o ignore -e ignore grep "annot access memory" gdb.out 70e2140365Sgson} 71e2140365Sgson 729fc7ccb0Sgsonatf_test_case xml 739fc7ccb0Sgsonxml_head() { 74*0bd3c92eSjruoho atf_set "descr" "Test that gdb was built " \ 75*0bd3c92eSjruoho "with XML support (PR bin/54154)" 769fc7ccb0Sgson atf_set "require.progs" "gdb" 779fc7ccb0Sgson} 789fc7ccb0Sgsonxml_body() { 799fc7ccb0Sgson cat <<\EOF >target.xml 809fc7ccb0Sgson<target version="1.0"> 819fc7ccb0Sgson <architecture>i386:x86-64</architecture> 829fc7ccb0Sgson</target> 839fc7ccb0SgsonEOF 849fc7ccb0Sgson cat <<EOF >test.gdb 859fc7ccb0Sgsonset tdesc filename "target.xml" 869fc7ccb0SgsonEOF 879fc7ccb0Sgson gdb --batch -x test.gdb >gdb.out 2>&1 889fc7ccb0Sgson atf_check -s exit:1 -o ignore -e ignore grep "Can not parse XML" gdb.out 899fc7ccb0Sgson} 909fc7ccb0Sgson 91e2140365Sgsonatf_init_test_cases() { 92e2140365Sgson atf_add_test_case threads 93e2140365Sgson atf_add_test_case pie 949fc7ccb0Sgson atf_add_test_case xml 95e2140365Sgson} 96