summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2015-01-27 14:12:27 +0000
committerThomas Wood <thomas.wood@intel.com>2015-02-09 14:39:41 +0000
commit16cfa37a505aaafd26b09b463a562c6985453fae (patch)
tree75a9dfe60936ef135badc020796c4cc5bfc3e450 /lib
parent9942a404379c1a021a6d26b8b2fcd9b70818a971 (diff)
lib: add exit status message to simple tests
Add an exit status message to simple tests, similar to the one printed for subtests. This includes the test outcome and the time taken to run the test. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_core.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 41f84bb9..0ae6918c 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -591,6 +591,9 @@ out:
/* install exit handler, to ensure we clean up */
igt_install_exit_handler(common_exit_handler);
+ if (!test_with_subtests)
+ gettime(&subtest_time);
+
return ret;
}
@@ -975,8 +978,33 @@ void igt_exit(void)
kmsg(KERN_INFO "%s: exiting, ret=%d\n", command_str, igt_exitcode);
igt_debug("Exiting with status code %d\n", igt_exitcode);
- if (!test_with_subtests)
+ if (!test_with_subtests) {
+ struct timespec now;
+ double elapsed;
+ const char *result;
+
+ gettime(&now);
+ elapsed = now.tv_sec - subtest_time.tv_sec;
+ elapsed += (now.tv_nsec - subtest_time.tv_nsec) * 1e-9;
+
+ switch (igt_exitcode) {
+ case IGT_EXIT_SUCCESS:
+ result = "SUCCESS";
+ break;
+ case IGT_EXIT_TIMEOUT:
+ result = "TIMEOUT";
+ break;
+ case IGT_EXIT_SKIP:
+ result = "SKIP";
+ break;
+ default:
+ result = "FAIL";
+ }
+
+
+ printf("%s (%.3fs)\n", result, elapsed);
exit(igt_exitcode);
+ }
/* Calling this without calling one of the above is a failure */
assert(skipped_one || succeeded_one || failed_one);