1 # Copyright 1988-2015 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file was written by Rob Savoye. (rob@cygnus.com)
18 # Can't do this test without stdio support.
19 if [gdb_skip_stdio_test "a2run.exp"] {
24 # test running programs
27 standard_testfile run.c
29 if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
33 # Run with no arguments.
36 set test "run \"$testfile\" with no args"
38 gdb_test_multiple "" $test {
39 -re ".*usage: factorial <number>.*$inferior_exited_re with code 01.\r\n$gdb_prompt $" {
41 pass "no spurious messages at program exit"
43 -re ".*usage: factorial <number>.*$inferior_exited_re with code 01.*$gdb_prompt $" {
45 fail "no spurious messages at program exit"
47 -re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.\r\n$gdb_prompt $" {
48 pass "$test (exit wrapper)"
49 pass "no spurious messages at program exit"
51 -re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.*$gdb_prompt $" {
52 pass "$test (exit wrapper)"
53 fail "no spurious messages at program exit"
57 # The remaining tests don't work for targets can't take arguments...
59 if [target_info exists noargs] then {
60 verbose "Skipping rest of a2-run.exp because of noargs."
64 # Now run with some arguments
65 setup_xfail "arm-*-coff"
67 gdb_test "" "120.*" "run \"$testfile\" with arg"
69 # Run again with same arguments.
72 setup_xfail "arm-*-coff"
73 gdb_test "" "120.*" "run \"$testfile\" again with same args"
75 # Use "set args" command to specify no arguments as default and run again.
76 gdb_test_no_output "set args"
80 gdb_test "" "usage: factorial <number>.*" "run after setting args to nil"
82 # Use "set args" command to specify an argument and run again.
83 gdb_test_no_output "set args 6"
87 setup_xfail "arm-*-coff"
88 gdb_test "" "720.*" "run \"$testfile\" again after setting args"
90 # GOAL: Test that shell is being used with "run". For remote debugging
91 # targets, there is no guarantee that a "shell" (whatever that is) is used.
92 if ![is_remote target] then {
93 gdb_test "run `echo 8`" \
94 "Starting program.*40320.*" \
95 "run \"$testfile\" with shell"