summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c24
-rw-r--r--lib/igt_core.h22
2 files changed, 34 insertions, 12 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 54f87c0f..05bc19bc 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -564,7 +564,7 @@ void igt_skip(const char *f, ...)
assert(in_fixture);
__igt_fixture_end();
} else {
- exit(77);
+ exit(IGT_EXIT_SKIP);
}
}
@@ -630,7 +630,7 @@ void igt_success(void)
*/
void igt_fail(int exitcode)
{
- assert(exitcode != 0 && exitcode != 77);
+ assert(exitcode != IGT_EXIT_SUCCESS && exitcode != IGT_EXIT_SKIP);
if (!failed_one)
igt_exitcode = exitcode;
@@ -642,7 +642,7 @@ void igt_fail(int exitcode)
exit(exitcode);
if (in_subtest) {
- if (exitcode == 78)
+ if (exitcode == IGT_EXIT_TIMEOUT)
exit_subtest("TIMEOUT");
else
exit_subtest("FAIL");
@@ -710,10 +710,10 @@ void igt_exit(void)
igt_exit_called = true;
if (igt_only_list_subtests())
- exit(0);
+ exit(IGT_EXIT_SUCCESS);
if (!test_with_subtests)
- exit(0);
+ exit(IGT_EXIT_SUCCESS);
/* Calling this without calling one of the above is a failure */
assert(skipped_one || succeeded_one || failed_one);
@@ -721,9 +721,9 @@ void igt_exit(void)
if (failed_one)
exit(igt_exitcode);
else if (succeeded_one)
- exit(0);
+ exit(IGT_EXIT_SUCCESS);
else
- exit(77);
+ exit(IGT_EXIT_SKIP);
}
/* fork support code */
@@ -1233,8 +1233,8 @@ static void igt_alarm_handler(int signal)
/* subsequent tests are skipped */
skip_subtests_henceforth = SKIP;
- /* exit with status 78 to indicate timeout */
- igt_fail(78);
+ /* exit with timeout status */
+ igt_fail(IGT_EXIT_TIMEOUT);
}
/**
@@ -1242,9 +1242,9 @@ static void igt_alarm_handler(int signal)
* @seconds: number of seconds before timeout
*
* Stop the current test and skip any subsequent tests after the specified
- * number of seconds have elapsed. The test will exit with "timeout" status
- * (78). Any previous timer is cancelled and no timeout is scheduled if @seconds
- * is zero.
+ * number of seconds have elapsed. The test will exit with #IGT_EXIT_TIMEOUT
+ * status. Any previous timer is cancelled and no timeout is scheduled if
+ * @seconds is zero.
*
*/
void igt_set_timeout(unsigned int seconds)
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 3a6ee1a4..f7f7015a 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -37,6 +37,28 @@
#include <sys/types.h>
#include <stdarg.h>
+/**
+ * IGT_EXIT_TIMEOUT:
+ *
+ * Exit status indicating a timeout occurred.
+ */
+#define IGT_EXIT_TIMEOUT 78
+
+/**
+ * IGT_EXIT_SKIP:
+ *
+ * Exit status indicating the test was skipped.
+ */
+#define IGT_EXIT_SKIP 77
+
+/**
+ * IGT_EXIT_SUCCESS
+ *
+ * Exit status indicating the test executed successfully.
+ */
+#define IGT_EXIT_SUCCESS 0
+
+
bool __igt_fixture(void);
void __igt_fixture_complete(void);
void __igt_fixture_end(void) __attribute__((noreturn));