[gcc r17-188] testsuite: flag failure to detect failures
Alexandre Oliva
aoliva@gcc.gnu.org
Wed Apr 29 02:00:39 GMT 2026
https://gcc.gnu.org/g:7596229507660a49f8065a75251fd311533f01c6
commit r17-188-g7596229507660a49f8065a75251fd311533f01c6
Author: Alexandre Oliva <oliva@adacore.com>
Date: Tue Apr 28 22:31:13 2026 -0300
testsuite: flag failure to detect failures
There are various ways for tests to report an execution failure.
Make sure the testing infrastructure can detect all of them, so that
failures don't go silent.
for gcc/testsuite/ChangeLog
* gcc.dg/shouldfail-abort.c: New.
* gcc.dg/shouldfail-exit-neg.c: New.
* gcc.dg/shouldfail-exit-pos.c: New.
* gcc.dg/shouldfail-return-neg.c: New.
* gcc.dg/shouldfail-return-pos.c: New.
Diff:
---
gcc/testsuite/gcc.dg/shouldfail-abort.c | 10 ++++++++++
gcc/testsuite/gcc.dg/shouldfail-exit-neg.c | 10 ++++++++++
gcc/testsuite/gcc.dg/shouldfail-exit-pos.c | 10 ++++++++++
gcc/testsuite/gcc.dg/shouldfail-return-neg.c | 10 ++++++++++
gcc/testsuite/gcc.dg/shouldfail-return-pos.c | 10 ++++++++++
5 files changed, 50 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/shouldfail-abort.c b/gcc/testsuite/gcc.dg/shouldfail-abort.c
new file mode 100644
index 000000000000..a00c483a56ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/shouldfail-abort.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-shouldfail "" } */
+
+/* Raise red flags if the way programs are meant to flag failures aren't
+ detected as such. This is unlikely to indicate a compiler problem, but
+ maybe a runtime or test infrastructure problem. */
+
+int main() {
+ __builtin_abort();
+}
diff --git a/gcc/testsuite/gcc.dg/shouldfail-exit-neg.c b/gcc/testsuite/gcc.dg/shouldfail-exit-neg.c
new file mode 100644
index 000000000000..57d66814120a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/shouldfail-exit-neg.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-shouldfail "" } */
+
+/* Raise red flags if the way programs are meant to flag failures aren't
+ detected as such. This is unlikely to indicate a compiler problem, but
+ maybe a runtime or test infrastructure problem. */
+
+int main() {
+ __builtin_exit(-1);
+}
diff --git a/gcc/testsuite/gcc.dg/shouldfail-exit-pos.c b/gcc/testsuite/gcc.dg/shouldfail-exit-pos.c
new file mode 100644
index 000000000000..2ae16fa2879f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/shouldfail-exit-pos.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-shouldfail "" } */
+
+/* Raise red flags if the way programs are meant to flag failures aren't
+ detected as such. This is unlikely to indicate a compiler problem, but
+ maybe a runtime or test infrastructure problem. */
+
+int main() {
+ __builtin_exit(1);
+}
diff --git a/gcc/testsuite/gcc.dg/shouldfail-return-neg.c b/gcc/testsuite/gcc.dg/shouldfail-return-neg.c
new file mode 100644
index 000000000000..6d32d260ad5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/shouldfail-return-neg.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-shouldfail "" } */
+
+/* Raise red flags if the way programs are meant to flag failures aren't
+ detected as such. This is unlikely to indicate a compiler problem, but
+ maybe a runtime or test infrastructure problem. */
+
+int main() {
+ return -1;
+}
diff --git a/gcc/testsuite/gcc.dg/shouldfail-return-pos.c b/gcc/testsuite/gcc.dg/shouldfail-return-pos.c
new file mode 100644
index 000000000000..ceb4f4cf95a7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/shouldfail-return-pos.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-shouldfail "" } */
+
+/* Raise red flags if the way programs are meant to flag failures aren't
+ detected as such. This is unlikely to indicate a compiler problem, but
+ maybe a runtime or test infrastructure problem. */
+
+int main() {
+ return 1;
+}
More information about the Gcc-cvs
mailing list