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

Indexes created Thu Nov 07 10:32:03 CST 2024