diff options
author | Pedro Alves <palves@redhat.com> | 2014-09-12 22:16:31 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-09-12 22:16:31 +0100 |
commit | fa43b1d7ca8d9699a253b1f227e91c406a043a0b (patch) | |
tree | cde814e330d7e2657020cf31199edbddc47934fe /gdb/testsuite/gdb.base/a2-run.exp | |
parent | f37f681c2bb884e74cd33340617a6d1a408d1a75 (diff) | |
download | gdb-fa43b1d7ca8d9699a253b1f227e91c406a043a0b.zip gdb-fa43b1d7ca8d9699a253b1f227e91c406a043a0b.tar.gz gdb-fa43b1d7ca8d9699a253b1f227e91c406a043a0b.tar.bz2 |
after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test
See:
https://sourceware.org/ml/gdb-patches/2014-09/msg00404.html
We have a number of places that do gdb_run_cmd followed by gdb_expect,
when it would be better to use gdb_test_multiple or gdb_test.
This converts all that "grep gdb_run_cmd -A 2 | grep gdb_expect"
found.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/testsuite/
2014-09-12 Pedro Alves <palves@redhat.com>
* gdb.arch/gdb1558.exp: Replace uses of gdb_expect after
gdb_run_cmd with gdb_test_multiple or gdb_test throughout.
* gdb.arch/i386-size-overlap.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.
* gdb.arch/i386-unwind.exp: Likewise.
* gdb.base/a2-run.exp: Likewise.
* gdb.base/break.exp: Likewise.
* gdb.base/charset.exp: Likewise.
* gdb.base/chng-syms.exp: Likewise.
* gdb.base/commands.exp: Likewise.
* gdb.base/dbx.exp: Likewise.
* gdb.base/find.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/jit-simple.exp: Likewise.
* gdb.base/reread.exp: Likewise.
* gdb.base/sepdebug.exp: Likewise.
* gdb.base/step-bt.exp: Likewise.
* gdb.cp/mb-inline.exp: Likewise.
* gdb.cp/mb-templates.exp: Likewise.
* gdb.objc/basicclass.exp: Likewise.
* gdb.threads/killed.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.base/a2-run.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/a2-run.exp | 78 |
1 files changed, 14 insertions, 64 deletions
diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index 49fcb92..10aaf67 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -34,48 +34,28 @@ if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } { # On VxWorks this justs make sure the program was run. gdb_run_cmd +set test "run \"$testfile\" with no args" + if [istarget "*-*-vxworks*"] then { - set timeout 120 - verbose "Timeout is now $timeout seconds" 2 - gdb_expect { - "$inferior_exited_re normally" { - unresolved "run \"$testfile\" with no args" - } - -re "usage: factorial <number>" { - pass "run \"$testfile\" with no args" - } - timeout { - fail "(timeout) run \"$testfile\" with no args" - } - } - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - gdb_expect -re "$gdb_prompt $" {} + gdb_test "" "usage: factorial <number>.*" $test } else { - gdb_expect { + gdb_test_multiple "" $test { -re ".*usage: factorial <number>.*$inferior_exited_re with code 01.\r\n$gdb_prompt $" { - pass "run \"$testfile\" with no args" + pass $test pass "no spurious messages at program exit" } -re ".*usage: factorial <number>.*$inferior_exited_re with code 01.*$gdb_prompt $" { - pass "run \"$testfile\" with no args" + pass $test fail "no spurious messages at program exit" } -re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.\r\n$gdb_prompt $" { - pass "run \"$testfile\" with no args (exit wrapper)" + pass "$test (exit wrapper)" pass "no spurious messages at program exit" } -re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.*$gdb_prompt $" { - pass "run \"$testfile\" with no args (exit wrapper)" + pass "$test (exit wrapper)" fail "no spurious messages at program exit" } - -re ".*$gdb_prompt $" { - fail "run \"$testfile\" with no args" - verbose "expect_out is $expect_out(buffer)" 2 - } - timeout { - fail "(timeout) run \"$testfile\" no args" - } } } @@ -107,14 +87,9 @@ if [istarget "*-*-vxworks*"] then { verbose "Timeout is now $timeout seconds" 2 gdb_expect -re "$gdb_prompt $" {} } else { - setup_xfail "arm-*-coff" - gdb_run_cmd 5 - gdb_expect { - -re ".*120.*$gdb_prompt $"\ - { pass "run \"$testfile\" with arg" } - -re ".*$gdb_prompt $" { fail "run \"$testfile\" with arg" } - timeout { fail "(timeout) run \"$testfile\" with arg" } - } + setup_xfail "arm-*-coff" + gdb_run_cmd 5 + gdb_test "" "120.*" "run \"$testfile\" with arg" } # Run again with same arguments. @@ -135,12 +110,7 @@ if [istarget "*-*-vxworks*"] then { gdb_expect -re "$gdb_prompt $" {} } else { setup_xfail "arm-*-coff" - gdb_expect { - -re ".*120.*$gdb_prompt $"\ - { pass "run \"$testfile\" again with same args" } - -re ".*$gdb_prompt $" { fail "run \"$testfile\" again with same args" } - timeout { fail "(timeout) run \"$testfile\" again with same args" } - } + gdb_test "" "120.*" "run \"$testfile\" again with same args" } # Use "set args" command to specify no arguments as default and run again. @@ -170,17 +140,7 @@ if [istarget "*-*-vxworks*"] then { verbose "Timeout is now $timeout seconds" 2 gdb_expect -re "$gdb_prompt $" {} } else { - gdb_expect { - -re ".*usage: factorial <number>.*$gdb_prompt $" { - pass "run after setting args to nil" - } - -re ".*$gdb_prompt $" { - fail "run after setting args to nil" - } - timeout { - fail "(timeout) run after setting args to nil" - } - } + gdb_test "" "usage: factorial <number>.*" "run after setting args to nil" } # Use "set args" command to specify an argument and run again. @@ -211,17 +171,7 @@ if [istarget "*-*-vxworks*"] then { gdb_expect -re "$gdb_prompt $" {} } else { setup_xfail "arm-*-coff" - gdb_expect { - -re ".*720.*$gdb_prompt $" { - pass "run \"$testfile\" again after setting args" - } - -re ".*$gdb_prompt $" { - fail "run \"$testfile\" again after setting args" - } - timeout { - fail "(timeout) run \"$testfile\" again after setting args" - } - } + gdb_test "" "720.*" "run \"$testfile\" again after setting args" } # GOAL: Test that shell is being used with "run". For remote debugging |