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