* [PATCH igt] lib: compute exitcode first
@ 2016-05-03 10:05 Chris Wilson
2016-05-03 10:22 ` Tvrtko Ursulin
0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2016-05-03 10:05 UTC (permalink / raw
To: intel-gfx
Before we print the exitcode to the debug/kmsg logs, we should inspect
what it's final value will be. For example, in the case of running
multiple subtests which all happen to be skipped, igt_exitcode is 0, but
the final exit code will be 77.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
lib/igt_core.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index b0bc60c..8c4bbc4 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1258,10 +1258,22 @@ void igt_exit(void)
exit(IGT_EXIT_INVALID);
}
-
if (igt_only_list_subtests())
exit(IGT_EXIT_SUCCESS);
+ /* Calling this without calling one of the above is a failure */
+ assert(!tests_with_subtests ||
+ skipped_one ||
+ succeeded_one ||
+ failed_one);
+
+ if (test_with_subtests && !failed_one) {
+ if (succeeded_one)
+ igt_exitcode = IGT_EXIT_SUCCESS;
+ else
+ igt_exitcode = IGT_EXIT_SKIP;
+ }
+
kmsg(KMSG_INFO "%s: exiting, ret=%d\n", command_str, igt_exitcode);
igt_debug("Exiting with status code %d\n", igt_exitcode);
@@ -1288,19 +1300,11 @@ void igt_exit(void)
result = "FAIL";
}
- printf("%s (%.3fs)\n", result, time_elapsed(&subtest_time, &now));
- exit(igt_exitcode);
+ printf("%s (%.3fs)\n",
+ result, time_elapsed(&subtest_time, &now));
}
- /* Calling this without calling one of the above is a failure */
- assert(skipped_one || succeeded_one || failed_one);
-
- if (failed_one)
- exit(igt_exitcode);
- else if (succeeded_one)
- exit(IGT_EXIT_SUCCESS);
- else
- exit(IGT_EXIT_SKIP);
+ exit(igt_exitcode);
}
/* fork support code */
--
2.8.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH igt] lib: compute exitcode first
2016-05-03 10:05 [PATCH igt] lib: compute exitcode first Chris Wilson
@ 2016-05-03 10:22 ` Tvrtko Ursulin
0 siblings, 0 replies; 2+ messages in thread
From: Tvrtko Ursulin @ 2016-05-03 10:22 UTC (permalink / raw
To: Chris Wilson, intel-gfx
On 03/05/16 11:05, Chris Wilson wrote:
> Before we print the exitcode to the debug/kmsg logs, we should inspect
> what it's final value will be. For example, in the case of running
> multiple subtests which all happen to be skipped, igt_exitcode is 0, but
> the final exit code will be 77.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> lib/igt_core.c | 28 ++++++++++++++++------------
> 1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index b0bc60c..8c4bbc4 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1258,10 +1258,22 @@ void igt_exit(void)
> exit(IGT_EXIT_INVALID);
> }
>
> -
> if (igt_only_list_subtests())
> exit(IGT_EXIT_SUCCESS);
>
> + /* Calling this without calling one of the above is a failure */
> + assert(!tests_with_subtests ||
test_with_subtests
With that fixed it seems to work,
Tested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
> + skipped_one ||
> + succeeded_one ||
> + failed_one);
> +
> + if (test_with_subtests && !failed_one) {
> + if (succeeded_one)
> + igt_exitcode = IGT_EXIT_SUCCESS;
> + else
> + igt_exitcode = IGT_EXIT_SKIP;
> + }
> +
> kmsg(KMSG_INFO "%s: exiting, ret=%d\n", command_str, igt_exitcode);
> igt_debug("Exiting with status code %d\n", igt_exitcode);
>
> @@ -1288,19 +1300,11 @@ void igt_exit(void)
> result = "FAIL";
> }
>
> - printf("%s (%.3fs)\n", result, time_elapsed(&subtest_time, &now));
> - exit(igt_exitcode);
> + printf("%s (%.3fs)\n",
> + result, time_elapsed(&subtest_time, &now));
> }
>
> - /* Calling this without calling one of the above is a failure */
> - assert(skipped_one || succeeded_one || failed_one);
> -
> - if (failed_one)
> - exit(igt_exitcode);
> - else if (succeeded_one)
> - exit(IGT_EXIT_SUCCESS);
> - else
> - exit(IGT_EXIT_SKIP);
> + exit(igt_exitcode);
> }
>
> /* fork support code */
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-03 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 10:05 [PATCH igt] lib: compute exitcode first Chris Wilson
2016-05-03 10:22 ` Tvrtko Ursulin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.