diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-12-06 14:14:50 -0800 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2013-01-02 19:52:25 -0500 |
commit | 06f097c51edb91911fd7dec6165c37a15aaf1f5a (patch) | |
tree | 5f332eafeb892b590f50229967f0fdf1be110e77 | |
parent | 2c85e405c19c612f2afbe37fce129e22692e095b (diff) |
cl: Have program-tester report subtest results v2
v2:
-Print each subtest result on its own line
-rw-r--r-- | tests/cl/program/program-tester.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c index 645691e4..27a20ede 100644 --- a/tests/cl/program/program-tester.c +++ b/tests/cl/program/program-tester.c @@ -1106,6 +1106,21 @@ get_test_arg(const char* src, struct test* test, bool arg_in) } } +/** + * Helper function for parsing a test name and checking for illegal characters. + */ +static char* +parse_name(const char *input) +{ + char *name = add_dynamic_str_copy(input); + if (strrchr(name, '/')) { + fprintf(stderr, "Illegal character in test name '%s': /\n", + input); + return NULL; + } + return name; +} + void parse_config(const char* config_str, struct piglit_cl_program_test_config* config) @@ -1253,7 +1268,10 @@ parse_config(const char* config_str, break; case SECTION_CONFIG: if(regex_match(key, "^name$")) { - config->name = add_dynamic_str_copy(value); + config->name = parse_name(value); + if (!config->name) { + exit_report_result(PIGLIT_FAIL); + } } else if(regex_match(key, "^clc_version_min$")) { config->clc_version_min = get_int(value); } else if(regex_match(key, "clc_version_max$")) { @@ -1318,7 +1336,10 @@ parse_config(const char* config_str, break; case SECTION_TEST: if(regex_match(key, "^name$")) { - test->name = add_dynamic_str_copy(value); + test->name = parse_name(value); + if (!test->name) { + exit_report_result(PIGLIT_FAIL); + } } else if(regex_match(key, "^kernel_name$")) { test->kernel_name = add_dynamic_str_copy(value); // test can't have kernel_name == NULL like config section } else if(regex_match(key, "^expect_test_fail$")) { @@ -1921,20 +1942,7 @@ piglit_cl_test(const int argc, test_result = test_kernel(config, env, tests[i]); piglit_merge_result(&result, test_result); - switch(test_result) { - case PIGLIT_FAIL: - printf("Test FAILED\n"); - break; - case PIGLIT_SKIP: - printf("Test SKIPPED\n"); - break; - case PIGLIT_WARN: - printf("Test produced a WARNING\n"); - break; - case PIGLIT_PASS: - printf("Test PASSED\n"); - break; - } + piglit_report_subtest_result(tests[i].name, test_result); } /* Print result */ |