mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-05 12:53:16 +08:00
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
148 lines
4.2 KiB
Plaintext
148 lines
4.2 KiB
Plaintext
# Copyright 1998-2022 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
|
|
|
|
# This file is part of the gdb testsuite
|
|
|
|
#
|
|
# tests to cover evaluate_subexp_standard with the EVAL_SKIP flag set.
|
|
# this happens for instance when there is short circuit evaluation in the && and ||
|
|
# operators, or in the non returned part of a (x ? y: z) expression.
|
|
# the part that is not evaluated is parsed and evaluated anyway, but with
|
|
# the EVAL_SKIP flag set
|
|
#
|
|
# source file "int-type.c"
|
|
#
|
|
|
|
|
|
# Check to see if we have an executable to test. If not, then either we
|
|
# haven't tried to compile one, or the compilation failed for some reason.
|
|
# In either case, just notify the user and skip the tests in this file.
|
|
|
|
standard_testfile int-type.c
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
|
|
untested "failed to compile"
|
|
return -1
|
|
}
|
|
|
|
clean_restart ${binfile}
|
|
|
|
|
|
if {![runto_main]} {
|
|
return
|
|
}
|
|
|
|
# This is used as an expected result value.
|
|
set false 0
|
|
|
|
gdb_test_no_output "set variable x=14" "set variable x=14"
|
|
gdb_test_no_output "set variable y=2" "set variable y=2"
|
|
gdb_test_no_output "set variable z=2" "set variable z=2"
|
|
gdb_test_no_output "set variable w=3" "set variable w=3"
|
|
|
|
gdb_test "print (0 && (x+y))" ".$decimal = $false" \
|
|
"print value of (0 && (x+y))"
|
|
|
|
gdb_test "print (0 && (x-y))" ".$decimal = $false" \
|
|
"print value of (0 && (x-y))"
|
|
|
|
gdb_test "print (0 && (x*y))" ".$decimal = $false" \
|
|
"print value of (0 && (x*y))"
|
|
|
|
gdb_test "print (0 && (x/y))" ".$decimal = $false" \
|
|
"print value of (0 && (x/y))"
|
|
|
|
gdb_test "print (0 && (x%y))" ".$decimal = $false" \
|
|
"print value of (0 && (x%y))"
|
|
|
|
gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
|
|
"print value of (0 && (x&&y))"
|
|
|
|
gdb_test "print (0 && (x||y))" ".$decimal = $false" \
|
|
"print value of (0 && (x||y))"
|
|
|
|
gdb_test "print (0 && (x&y))" ".$decimal = $false" \
|
|
"print value of (0 && (x&y))"
|
|
|
|
gdb_test "print (0 && (x|y))" ".$decimal = $false" \
|
|
"print value of (0 && (x|y))"
|
|
|
|
gdb_test "print (0 && (x^y))" ".$decimal = $false" \
|
|
"print value of (0 && (x^y))"
|
|
|
|
gdb_test "print (0 && (x < y))" ".$decimal = $false" \
|
|
"print value of (0 && (x < y))"
|
|
|
|
gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
|
|
"print value of (0 && (x <= y))"
|
|
|
|
gdb_test "print (0 && (x>y))" ".$decimal = $false" \
|
|
"print value of (0 && (x>y))"
|
|
|
|
gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
|
|
"print value of (0 && (x>=y))"
|
|
|
|
gdb_test "print (0 && (x==y))" ".$decimal = $false" \
|
|
"print value of (0 && (x==y))"
|
|
|
|
gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
|
|
"print value of (0 && (x!=y))"
|
|
|
|
gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
|
|
"print value of (0 && (x<<31))"
|
|
|
|
gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
|
|
"print value of (0 && (x>>31))"
|
|
|
|
gdb_test "print (0 && (!x))" ".$decimal = $false" \
|
|
"print value of (0 && (!x))"
|
|
|
|
gdb_test "print (0 && (~x))" ".$decimal = $false" \
|
|
"print value of (0 && (~x))"
|
|
|
|
gdb_test "print (0 && (-x))" ".$decimal = $false" \
|
|
"print value of (0 && (-x))"
|
|
|
|
gdb_test "print (0 && (x++))" ".$decimal = $false" \
|
|
"print value of (0 && (x++))"
|
|
|
|
gdb_test "print (0 && (++x))" ".$decimal = $false" \
|
|
"print value of (0 && (++x))"
|
|
|
|
gdb_test "print (0 && (x--))" ".$decimal = $false" \
|
|
"print value of (0 && (x--))"
|
|
|
|
gdb_test "print (0 && (--x))" ".$decimal = $false" \
|
|
"print value of (0 && (--x))"
|
|
|
|
gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
|
|
"print value of (0 && (x+=7))"
|
|
|
|
gdb_test "print (0 && (x=y))" ".$decimal = $false" \
|
|
"print value of (0 && (x=y))"
|
|
|
|
|
|
gdb_exit
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|