aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-12-23 13:57:55 +0100
committerFlorian Weimer <fweimer@redhat.com>2024-12-23 13:57:55 +0100
commitd0b8aa6de4529231fadfe604ac2c434e559c2d9e (patch)
tree71d275d465bf3d0e35eccc8989aa42490188f23f
parent55618e13968a60b89e5b226a23afaa8f17c5ef48 (diff)
downloadglibc-d0b8aa6de4529231fadfe604ac2c434e559c2d9e.zip
glibc-d0b8aa6de4529231fadfe604ac2c434e559c2d9e.tar.gz
glibc-d0b8aa6de4529231fadfe604ac2c434e559c2d9e.tar.bz2
support: Add support_record_failure_barrier
This can be used to stop execution after a TEST_COMPARE_BLOB failure, for example.
-rw-r--r--support/check.h3
-rw-r--r--support/support_record_failure.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/support/check.h b/support/check.h
index 7ea22c7..8f41e5b 100644
--- a/support/check.h
+++ b/support/check.h
@@ -207,6 +207,9 @@ void support_record_failure_reset (void);
failures or not. */
int support_record_failure_is_failed (void);
+/* Terminate the process if any failures have been encountered so far. */
+void support_record_failure_barrier (void);
+
__END_DECLS
#endif /* SUPPORT_CHECK_H */
diff --git a/support/support_record_failure.c b/support/support_record_failure.c
index 9781237..72ee2b2 100644
--- a/support/support_record_failure.c
+++ b/support/support_record_failure.c
@@ -112,3 +112,13 @@ support_record_failure_is_failed (void)
synchronization for reliable test error reporting anyway. */
return __atomic_load_n (&state->failed, __ATOMIC_RELAXED);
}
+
+void
+support_record_failure_barrier (void)
+{
+ if (__atomic_load_n (&state->failed, __ATOMIC_RELAXED))
+ {
+ puts ("error: exiting due to previous errors");
+ exit (1);
+ }
+}