summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r--lib/igt_core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index c292343d..e52b806b 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -70,6 +70,7 @@
#include "igt_core.h"
#include "igt_aux.h"
#include "igt_sysfs.h"
+#include "igt_sysrq.h"
#include "igt_rc.h"
#define UNW_LOCAL_ONLY
@@ -1137,6 +1138,28 @@ void igt_fail(int exitcode)
}
/**
+ * igt_fatal_error: Stop test execution on fatal errors
+ *
+ * Stop test execution or optionally, if the IGT_REBOOT_ON_FATAL_ERROR
+ * environment variable is set, reboot the machine.
+ *
+ * Since out test runner (piglit) does support fatal test exit codes, we
+ * implement the default behaviour by waiting endlessly.
+ */
+void __attribute__((noreturn)) igt_fatal_error(void)
+{
+ if (igt_check_boolean_env_var("IGT_REBOOT_ON_FATAL_ERROR", false)) {
+ igt_warn("FATAL ERROR - REBOOTING\n");
+ igt_sysrq_reboot();
+ } else {
+ igt_warn("FATAL ERROR\n");
+ for (;;)
+ pause();
+ }
+}
+
+
+/**
* igt_can_fail:
*
* Returns true if called from either an #igt_fixture, #igt_subtest or a