[v2,04/11] gdb.base/exitsignal.exp: Exit with non-zero
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
gdb.base/exitsignal.exp currently tests exiting with exit code 0.
But, testing for 0 is typically more "dangerous" in the sense that
it's easy for some bug in GDB or the target backend to fail to extract
the exit code and return 0. Make it test exit code 1 instead.
gdb.base/coredump-filter-build-id.exp currently reuses normal.c. It
could still use it with this patch, but it seems better to me to
remove the coupling. Simply add a new .c file for that testcase,
which still returns 0.
Change-Id: I49ccfdbbe4be4445172476e7dd4e06142c8a672e
commit-id: d6b526ac
---
.../gdb.base/coredump-filter-build-id.c | 22 +++++++++++++++++++
.../gdb.base/coredump-filter-build-id.exp | 2 +-
gdb/testsuite/gdb.base/exitsignal.exp | 8 +++----
gdb/testsuite/gdb.base/normal.c | 7 ++++--
4 files changed, 32 insertions(+), 7 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/coredump-filter-build-id.c
new file mode 100644
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2013-2026 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/>. */
+
+int
+main ()
+{
+ return 0;
+}
@@ -21,7 +21,7 @@
# external tool, eu-unstrip, to verify if the corefile contains
# build-ids.
-standard_testfile "normal.c"
+standard_testfile
# This test is Linux x86_64 only.
if { ![istarget *-*-linux*] } {
@@ -128,11 +128,11 @@ proc test_normal {} {
return
}
- gdb_continue_to_end
+ gdb_test "continue" " exited with code 01\\\].*" "continue to exit"
- # Check $_exitcode. It should be 0.
- gdb_test "print \$_exitcode" " = 0" \
- "\$_exitcode is zero after normal inferior is executed"
+ # Check $_exitcode. It should be 1.
+ gdb_test "print \$_exitcode" " = 1" \
+ "\$_exitcode is one after normal inferior is executed"
# Check $_exitsignal. It should still be void, since the inferior
# has not received any signal.
@@ -15,10 +15,13 @@
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 test is just a normal return 0. */
+/* This test is just a normal return 1. */
int
main (int argc, char *argv[])
{
- return 0;
+ /* Non-zero specifically, as it would be otherwise easier for a
+ buggy GDB to report exit code 0 when it shouldn't and that
+ wouldn't be noticed. */
+ return 1;
}