1 #!/bin/sh 2 3 # Copyright (C) 2017 Red Hat, Inc. 4 # 5 # This program is free software; you can redistribute it and#or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 2 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, but 11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 # for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, see <http://www.gnu.org/licenses/>. 17 # 18 19 # Test description: See if gdb can successfully attach to a process and 20 # this process exits normally. 21 22 # Usage 23 # ./gdb01.sh 24 25 TST_TESTFUNC=simple_test 26 TST_NEEDS_CMDS="gdb /bin/cat" 27 28 . tst_test.sh 29 30 simple_test() 31 { 32 gdb /bin/cat -ex "run /etc/passwd" -ex quit < /dev/null 33 RC=$? 34 if [ $RC -eq 0 ] ; then 35 tst_res TPASS "gdb attached to process and completed run" 36 else 37 tst_res TFAIL "gdb test failed with" $RC 38 fi 39 } 40 41 tst_run 42