xref: /aosp_15_r20/external/ltp/testcases/commands/gdb/gdb01.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (C) 2017 Red Hat, Inc.
4#
5# Test if gdb can successfully attach to a process and
6# this process exits normally.
7
8TST_TESTFUNC=simple_test
9TST_NEEDS_CMDS="gdb /bin/cat"
10
11simple_test()
12{
13	gdb /bin/cat -ex "run /etc/passwd" -ex quit < /dev/null
14	RC=$?
15	if [ $RC -eq 0 ] ; then
16		tst_res TPASS "gdb attached to process and completed run"
17	else
18		tst_res TFAIL "gdb test failed with" $RC
19	fi
20}
21
22. tst_test.sh
23tst_run
24