summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-02-10 00:15:10 -0500
committerAndreas Boll <andreas.boll.dev@gmail.com>2013-04-17 12:36:38 +0200
commit80a4d818d9ab766acee6057e64a92ffaf04e866f (patch)
treefe831fc5507697c5488e83219da2fc9748fe2f37
parent5000be2fd7b461591e9289806e125095073cbf6e (diff)
r300g/tests: Exit test runner with a valid status code
This way make check can report whether or not the tests pass. NOTE: This is a candidate for the stable branches. Reviewed-by: Marek Olšák <maraeo@gmail.com> (cherry picked from commit bcf2e157caeb2ee607a1398de9fd68f315dd4d6e)
-rw-r--r--src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c12
-rw-r--r--src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h3
-rw-r--r--src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c4
-rw-r--r--src/gallium/drivers/r300/compiler/tests/unit_test.c7
-rw-r--r--src/gallium/drivers/r300/compiler/tests/unit_test.h2
5 files changed, 22 insertions, 6 deletions
diff --git a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
index 4b98e38105..cc4725ab06 100644
--- a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
+++ b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.c
@@ -27,7 +27,17 @@
#include "r300_compiler_tests.h"
+#include <stdlib.h>
+
int main(int argc, char ** argv)
{
- radeon_compiler_util_run_tests();
+ unsigned pass = 1;
+ pass &= radeon_compiler_optimize_run_tests();
+ pass &= radeon_compiler_util_run_tests();
+
+ if (pass) {
+ return EXIT_SUCCESS;
+ } else {
+ return EXIT_FAILURE;
+ }
}
diff --git a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
index b6719552d8..266addf66d 100644
--- a/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
+++ b/src/gallium/drivers/r300/compiler/tests/r300_compiler_tests.h
@@ -25,4 +25,5 @@
*
*/
-void radeon_compiler_util_run_tests(void);
+unsigned radeon_compiler_optimize_run_tests(void);
+unsigned radeon_compiler_util_run_tests(void);
diff --git a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
index 25220ec999..33b27fcdca 100644
--- a/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
+++ b/src/gallium/drivers/r300/compiler/tests/radeon_compiler_util_tests.c
@@ -94,11 +94,11 @@ static void test_runner_rc_inst_can_use_presub(struct test_result * result)
"MAD temp[0].xyz, temp[2].xyz_, -temp[3].xxx_, input[5].xyz_;");
}
-void radeon_compiler_util_run_tests()
+unsigned radeon_compiler_util_run_tests()
{
struct test tests[] = {
{"rc_inst_can_use_presub()", test_runner_rc_inst_can_use_presub},
{NULL, NULL}
};
- run_tests(tests);
+ return run_tests(tests);
}
diff --git a/src/gallium/drivers/r300/compiler/tests/unit_test.c b/src/gallium/drivers/r300/compiler/tests/unit_test.c
index ac6bdedc62..a014d78cd2 100644
--- a/src/gallium/drivers/r300/compiler/tests/unit_test.c
+++ b/src/gallium/drivers/r300/compiler/tests/unit_test.c
@@ -31,16 +31,21 @@
#include "unit_test.h"
-void run_tests(struct test tests[])
+unsigned run_tests(struct test tests[])
{
int i;
+ unsigned pass = 1;
for (i = 0; tests[i].name; i++) {
printf("Test %s\n", tests[i].name);
memset(&tests[i].result, 0, sizeof(tests[i].result));
tests[i].test_func(&tests[i].result);
printf("Test %s (%d/%d) pass\n", tests[i].name,
tests[i].result.pass, tests[i].result.test_count);
+ if (tests[i].result.pass != tests[i].result.test_count) {
+ pass = 0;
+ }
}
+ return pass;
}
void test_begin(struct test_result * result)
diff --git a/src/gallium/drivers/r300/compiler/tests/unit_test.h b/src/gallium/drivers/r300/compiler/tests/unit_test.h
index 9a69fd7f5f..4a9584385d 100644
--- a/src/gallium/drivers/r300/compiler/tests/unit_test.h
+++ b/src/gallium/drivers/r300/compiler/tests/unit_test.h
@@ -37,7 +37,7 @@ struct test {
struct test_result result;
};
-void run_tests(struct test tests[]);
+unsigned run_tests(struct test tests[]);
void test_begin(struct test_result * result);
void test_check(struct test_result * result, int cond);