summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabian Bieler <fabianbieler@fastmail.fm>2018-01-23 22:41:20 +0100
committerFabian Bieler <fabianbieler@fastmail.fm>2018-02-05 19:44:16 +0100
commit9b3091eaab8d3d4e36a51668f0c55da1209af997 (patch)
tree798abb74c56d7ab10fc9d44c4d7c65e0d2a7c23e /tests
parent8ca6c82cdd00d9e1104ef7f9565632dbfc2d3fc4 (diff)
util: make piglit_run_selected_subtests print all tests to run.
For informing the python framework of the number and order of subtests that will be run. Signed-off-by: Fabian Bieler <fabianbieler@fastmail.fm> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/util/piglit-util.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index e33d055f2..7f33afb90 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -752,19 +752,41 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
{
enum piglit_result result = previous_result;
+ /* print JSON list of subtests */
+ printf("PIGLIT: {\"enumerate subtests\": [");
if (num_selected_subtests) {
- unsigned i;
-
- for (i = 0; i < num_selected_subtests; i++) {
- enum piglit_result subtest_result;
+ const char *prefix = "";
+ for (int i = 0; i < num_selected_subtests; i++) {
const char *const name = selected_subtests[i];
const struct piglit_subtest *subtest =
piglit_find_subtest(all_subtests, name);
if (subtest == NULL) {
+ printf("]}\n");
+ fflush(stdout);
piglit_loge("Unknown subtest \"%s\"", name);
piglit_report_result(PIGLIT_FAIL);
}
+ printf("%s\"%s\"", prefix, name);
+ prefix = ", ";
+
+ }
+ } else {
+ const char *prefix = "";
+ for (int i = 0; !PIGLIT_SUBTEST_END(&all_subtests[i]); i++) {
+ printf("%s\"%s\"", prefix, all_subtests[i].name);
+ prefix = ", ";
+ }
+ }
+ printf("]}\n");
+ fflush(stdout);
+
+ if (num_selected_subtests) {
+ for (int i = 0; i < num_selected_subtests; i++) {
+ enum piglit_result subtest_result;
+ const char *const name = selected_subtests[i];
+ const struct piglit_subtest *subtest =
+ piglit_find_subtest(all_subtests, name);
subtest_result = subtest->subtest_func(subtest->data);
piglit_report_subtest_result(subtest_result, "%s",
@@ -773,9 +795,7 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
piglit_merge_result(&result, subtest_result);
}
} else {
- unsigned i;
-
- for (i = 0; !PIGLIT_SUBTEST_END(&all_subtests[i]); i++) {
+ for (int i = 0; !PIGLIT_SUBTEST_END(&all_subtests[i]); i++) {
const enum piglit_result subtest_result =
all_subtests[i].subtest_func(all_subtests[i].data);
piglit_report_subtest_result(subtest_result, "%s",