gdb/testsuite: remove perror calls when failing to run
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 5 Dec 2022 21:38:24 +0000 (16:38 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 5 Dec 2022 21:38:24 +0000 (16:38 -0500)
commit30add7ee24bf88630ee38cd73b6a1dd3aa384999
tree31126cc2c4495ec816d449387c35fe90fdeb5f16
parent09a5d200e6166522e0d0a9276bd6b2227ac5ace1
gdb/testsuite: remove perror calls when failing to run

I noticed that when running these two tests in sequence:

    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/arrayptr.exp ...
    ERROR: GDB process no longer exists
    ERROR: Couldn't run foo-all
    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/assign_1.exp ...

The results in gdb.sum are:

    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/arrayptr.exp ...
    PASS: gdb.ada/arrayptr.exp: scenario=all: compilation foo.adb
    ERROR: GDB process no longer exists
    UNRESOLVED: gdb.ada/arrayptr.exp: scenario=all: gdb_breakpoint: set breakpoint at foo.adb:40 (eof)
    ERROR: Couldn't run foo-all
    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.ada/assign_1.exp ...
    UNRESOLVED: gdb.ada/assign_1.exp: changing the language to ada
    PASS: gdb.ada/assign_1.exp: set convenience variable $xxx to 1

The UNRESOLVED for arrayptr.exp is fine, as GDB crashes in that test,
while trying to run to main.  However, the UNRESOLVED in assign_1.exp
doesn't make sense, GDB behaves as expected in that test:

    (gdb) set lang ada^M
    (gdb) UNRESOLVED: gdb.ada/assign_1.exp: changing the language to ada
    print $xxx := 1^M
    $1 = 1^M
    (gdb) PASS: gdb.ada/assign_1.exp: set convenience variable $xxx to 1

The problem is that arrayptr.exp calls perror when failing to run to
main, then returns.  perror makes it so that the next test (as in
pass/fail) will be recorded as UNRESOLVED.  However, here, the next test
(as in pass/fail) is in the next test (as in .exp).  Hence the spurious
UNRESOLVED in assign_1.exp.

These perror when failing to run to X are not really useful, especially
since runto records a FAIL on error, by default.  Remove all the
perrors on runto failure I could find.

When there wasn't one already, add a return statement when failing to
run, to avoid running the test of the test unnecessarily.

I thought of adding a check ran between test (in gdb_finish
probably) where we would emit a warning if errcnt > 0, meaning a test
quit and left a perror "active".  However, reading that variable would
poke into the DejaGNU internals, not sure it's a good idea.

Change-Id: I2203df6d06e199540b36f56470d1c5f1dc988f7b
185 files changed:
gdb/testsuite/gdb.ada/access_tagged_param.exp
gdb/testsuite/gdb.ada/addr_arith.exp
gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
gdb/testsuite/gdb.ada/arr_arr.exp
gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
gdb/testsuite/gdb.ada/array_bounds.exp
gdb/testsuite/gdb.ada/arrayptr.exp
gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
gdb/testsuite/gdb.ada/call_pn.exp
gdb/testsuite/gdb.ada/convvar_comp.exp
gdb/testsuite/gdb.ada/disc_arr_bound.exp
gdb/testsuite/gdb.ada/discrete-char.exp
gdb/testsuite/gdb.ada/dot_all.exp
gdb/testsuite/gdb.ada/formatted_ref.exp
gdb/testsuite/gdb.ada/frame_args.exp
gdb/testsuite/gdb.ada/fun_in_declare.exp
gdb/testsuite/gdb.ada/ghost.exp
gdb/testsuite/gdb.ada/info_addr_mixed_case.exp
gdb/testsuite/gdb.ada/local-enum.exp
gdb/testsuite/gdb.ada/minsyms.exp
gdb/testsuite/gdb.ada/mod_from_name.exp
gdb/testsuite/gdb.ada/optim_drec.exp
gdb/testsuite/gdb.ada/rec_comp.exp
gdb/testsuite/gdb.ada/rec_return.exp
gdb/testsuite/gdb.ada/ref_param.exp
gdb/testsuite/gdb.ada/scalar_storage.exp
gdb/testsuite/gdb.ada/set_wstr.exp
gdb/testsuite/gdb.ada/small_reg_param.exp
gdb/testsuite/gdb.ada/str_uninit.exp
gdb/testsuite/gdb.ada/taft_type.exp
gdb/testsuite/gdb.ada/varsize_limit.exp
gdb/testsuite/gdb.ada/whatis_array_val.exp
gdb/testsuite/gdb.ada/widewide.exp
gdb/testsuite/gdb.base/all-bin.exp
gdb/testsuite/gdb.base/arithmet.exp
gdb/testsuite/gdb.base/arrayidx.exp
gdb/testsuite/gdb.base/assign.exp
gdb/testsuite/gdb.base/async.exp
gdb/testsuite/gdb.base/bfp-test.exp
gdb/testsuite/gdb.base/call-ar-st.exp
gdb/testsuite/gdb.base/call-rt-st.exp
gdb/testsuite/gdb.base/call-strs.exp
gdb/testsuite/gdb.base/completion.exp
gdb/testsuite/gdb.base/cond-expr.exp
gdb/testsuite/gdb.base/consecutive.exp
gdb/testsuite/gdb.base/constvars.exp
gdb/testsuite/gdb.base/ctf-constvars.exp
gdb/testsuite/gdb.base/dfp-test.exp
gdb/testsuite/gdb.base/enum_cond.exp
gdb/testsuite/gdb.base/eval-skip.exp
gdb/testsuite/gdb.base/exe-lock.exp
gdb/testsuite/gdb.base/exprs.exp
gdb/testsuite/gdb.base/fileio.exp
gdb/testsuite/gdb.base/float.exp
gdb/testsuite/gdb.base/float128.exp
gdb/testsuite/gdb.base/floatn.exp
gdb/testsuite/gdb.base/frame-args.exp
gdb/testsuite/gdb.base/gdb1821.exp
gdb/testsuite/gdb.base/interrupt.exp
gdb/testsuite/gdb.base/jump.exp
gdb/testsuite/gdb.base/logical.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.base/miscexprs.exp
gdb/testsuite/gdb.base/nested-subp1.exp
gdb/testsuite/gdb.base/nested-subp2.exp
gdb/testsuite/gdb.base/nested-subp3.exp
gdb/testsuite/gdb.base/opaque.exp
gdb/testsuite/gdb.base/pc-fp.exp
gdb/testsuite/gdb.base/permissions.exp
gdb/testsuite/gdb.base/pointers.exp
gdb/testsuite/gdb.base/prologue.exp
gdb/testsuite/gdb.base/readnever.exp
gdb/testsuite/gdb.base/relational.exp
gdb/testsuite/gdb.base/setvar.exp
gdb/testsuite/gdb.base/shlib-call.exp
gdb/testsuite/gdb.base/sizeof.exp
gdb/testsuite/gdb.base/store.exp
gdb/testsuite/gdb.base/varargs.exp
gdb/testsuite/gdb.base/volatile.exp
gdb/testsuite/gdb.base/whatis-exp.exp
gdb/testsuite/gdb.cp/ambiguous.exp
gdb/testsuite/gdb.cp/anon-ns.exp
gdb/testsuite/gdb.cp/anon-union.exp
gdb/testsuite/gdb.cp/breakpoint.exp
gdb/testsuite/gdb.cp/bs15503.exp
gdb/testsuite/gdb.cp/casts.exp
gdb/testsuite/gdb.cp/class2.exp
gdb/testsuite/gdb.cp/classes.exp
gdb/testsuite/gdb.cp/constexpr-field.exp
gdb/testsuite/gdb.cp/converts.exp
gdb/testsuite/gdb.cp/ctti.exp
gdb/testsuite/gdb.cp/derivation.exp
gdb/testsuite/gdb.cp/disasm-func-name.exp
gdb/testsuite/gdb.cp/dispcxx.exp
gdb/testsuite/gdb.cp/filename.exp
gdb/testsuite/gdb.cp/fpointer.exp
gdb/testsuite/gdb.cp/gdb1355.exp
gdb/testsuite/gdb.cp/gdb2384.exp
gdb/testsuite/gdb.cp/gdb2495.exp
gdb/testsuite/gdb.cp/impl-this.exp
gdb/testsuite/gdb.cp/inherit.exp
gdb/testsuite/gdb.cp/iostream.exp
gdb/testsuite/gdb.cp/koenig.exp
gdb/testsuite/gdb.cp/local.exp
gdb/testsuite/gdb.cp/m-data.exp
gdb/testsuite/gdb.cp/m-static.exp
gdb/testsuite/gdb.cp/many-args.exp
gdb/testsuite/gdb.cp/mb-ctor.exp
gdb/testsuite/gdb.cp/member-name.exp
gdb/testsuite/gdb.cp/member-ptr.exp
gdb/testsuite/gdb.cp/meth-typedefs.exp
gdb/testsuite/gdb.cp/method.exp
gdb/testsuite/gdb.cp/method2.exp
gdb/testsuite/gdb.cp/namespace-nested-import.exp
gdb/testsuite/gdb.cp/namespace.exp
gdb/testsuite/gdb.cp/nextoverthrow.exp
gdb/testsuite/gdb.cp/nsdecl.exp
gdb/testsuite/gdb.cp/nsimport.exp
gdb/testsuite/gdb.cp/nsnested.exp
gdb/testsuite/gdb.cp/nsnoimports.exp
gdb/testsuite/gdb.cp/nsrecurs.exp
gdb/testsuite/gdb.cp/nsstress.exp
gdb/testsuite/gdb.cp/nsusing.exp
gdb/testsuite/gdb.cp/operator.exp
gdb/testsuite/gdb.cp/oranking.exp
gdb/testsuite/gdb.cp/overload.exp
gdb/testsuite/gdb.cp/ovldbreak.exp
gdb/testsuite/gdb.cp/ovsrch.exp
gdb/testsuite/gdb.cp/pr-1023.exp
gdb/testsuite/gdb.cp/pr-1210.exp
gdb/testsuite/gdb.cp/pr-574.exp
gdb/testsuite/gdb.cp/pr10728.exp
gdb/testsuite/gdb.cp/pr12028.exp
gdb/testsuite/gdb.cp/pr9067.exp
gdb/testsuite/gdb.cp/pr9631.exp
gdb/testsuite/gdb.cp/printmethod.exp
gdb/testsuite/gdb.cp/ptype-flags.exp
gdb/testsuite/gdb.cp/ref-types.exp
gdb/testsuite/gdb.cp/rtti.exp
gdb/testsuite/gdb.cp/rvalue-ref-types.exp
gdb/testsuite/gdb.cp/shadow.exp
gdb/testsuite/gdb.cp/smartp.exp
gdb/testsuite/gdb.cp/static-method.exp
gdb/testsuite/gdb.cp/try_catch.exp
gdb/testsuite/gdb.cp/userdef.exp
gdb/testsuite/gdb.cp/var-tag.exp
gdb/testsuite/gdb.cp/virtbase.exp
gdb/testsuite/gdb.cp/virtbase2.exp
gdb/testsuite/gdb.cp/virtfunc.exp
gdb/testsuite/gdb.cp/virtfunc2.exp
gdb/testsuite/gdb.cp/watch-cp.exp
gdb/testsuite/gdb.dwarf2/count.exp
gdb/testsuite/gdb.dwarf2/dw2-common-block.exp
gdb/testsuite/gdb.fortran/array-element.exp
gdb/testsuite/gdb.fortran/charset.exp
gdb/testsuite/gdb.fortran/common-block.exp
gdb/testsuite/gdb.fortran/complex.exp
gdb/testsuite/gdb.fortran/derived-type-function.exp
gdb/testsuite/gdb.fortran/derived-type-striding.exp
gdb/testsuite/gdb.fortran/derived-type.exp
gdb/testsuite/gdb.fortran/function-calls.exp
gdb/testsuite/gdb.fortran/library-module.exp
gdb/testsuite/gdb.fortran/module.exp
gdb/testsuite/gdb.fortran/multi-dim.exp
gdb/testsuite/gdb.fortran/namelist.exp
gdb/testsuite/gdb.fortran/nested-funcs-2.exp
gdb/testsuite/gdb.fortran/nested-funcs.exp
gdb/testsuite/gdb.fortran/ptype-on-functions.exp
gdb/testsuite/gdb.fortran/short-circuit-argument-list.exp
gdb/testsuite/gdb.fortran/string-types.exp
gdb/testsuite/gdb.fortran/subarray.exp
gdb/testsuite/gdb.fortran/vla-value.exp
gdb/testsuite/gdb.modula2/multidim.exp
gdb/testsuite/gdb.modula2/unbounded-array.exp
gdb/testsuite/gdb.opt/fortran-string.exp
gdb/testsuite/gdb.python/py-format-string.exp
gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
gdb/testsuite/gdb.python/py-framefilter.exp
gdb/testsuite/gdb.python/py-objfile-script.exp
gdb/testsuite/gdb.python/py-prettyprint.exp
gdb/testsuite/gdb.python/py-section-script.exp
gdb/testsuite/gdb.python/py-template.exp
gdb/testsuite/gdb.python/py-type.exp
gdb/testsuite/gdb.python/py-value.exp
gdb/testsuite/gdb.stabs/exclfwd.exp