diff options
Diffstat (limited to 'test/libtest/bin/make-test-scaffolding')
| -rwxr-xr-x | test/libtest/bin/make-test-scaffolding | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/test/libtest/bin/make-test-scaffolding b/test/libtest/bin/make-test-scaffolding index c0966d34527b3..6ec78e8224e1f 100755 --- a/test/libtest/bin/make-test-scaffolding +++ b/test/libtest/bin/make-test-scaffolding @@ -79,7 +79,7 @@ cat <<EOF /* GENERATED FROM: ${@} */ #include <stddef.h> #include "test.h" -#include "test_runner.h" +#include "test_case.h" EOF if ! nm ${*} | sort -k 3 | \ @@ -108,9 +108,13 @@ if ! nm ${*} | sort -k 3 | \ function print_test_case_record(tc_name) { printf("\t{\n") printf("\t\t.tc_name = \"%s\",\n", tc_name) - printf("\t\t.tc_description = %s,\n", test_case_descriptions[tc_name]) + printf("\t\t.tc_description = %s,\n", + test_case_descriptions[tc_name]) printf("\t\t.tc_tags = %s,\n", test_case_tags[tc_name]) - printf("\t\t.tc_tests = test_functions_%s\n", tc_name) + tf_name = "test_functions_" tc_name + printf("\t\t.tc_tests = %s,\n", tf_name) + printf("\t\t.tc_count = sizeof (%s) / sizeof (%s[0]),\n", + tf_name, tf_name) printf("\t},\n") } function delete_test_functions(tc_name) { @@ -120,16 +124,19 @@ if ! nm ${*} | sort -k 3 | \ } } function print_test_functions_record(tc_name) { - printf("struct test_descriptor test_functions_%s[] = {\n", tc_name) + printf("struct test_function_descriptor test_functions_%s[]", + tc_name) + printf(" = {\n") for (tf_name in test_functions) { if (tc_name != matched_test_case(tf_name)) continue printf("\t{\n") - printf("\t\t.t_name = \"%s\",\n", tf_name) - printf("\t\t.t_description = %s,\n", + printf("\t\t.tf_name = \"%s\",\n", tf_name) + printf("\t\t.tf_description = %s,\n", test_function_descriptions[tf_name]) - printf("\t\t.t_func = %s,\n", prefix_tf tf_name) - printf("\t\t.t_tags = %s\n", test_function_tags[tf_name]) + printf("\t\t.tf_func = %s,\n", prefix_tf tf_name) + printf("\t\t.tf_tags = %s\n", + test_function_tags[tf_name]) printf("\t},\n") } printf("};\n") @@ -144,7 +151,7 @@ if ! nm ${*} | sort -k 3 | \ test_case_tags[DEFAULT] = "NULL" } ($2 == "R" || $2 == "D") && $3 ~ "^" prefix_tc_descr { - printf("extern testcase_description %s;\n", $3) + printf("extern test_case_description %s;\n", $3) tc_name = suffix($3, prefix_tc_descr) test_cases[tc_name] = 1 test_case_descriptions[tc_name] = $3 @@ -155,7 +162,7 @@ if ! nm ${*} | sort -k 3 | \ test_case_setup[tc_name] = $3 } ($2 == "R" || $2 == "D") && $3 ~ "^" prefix_tc_tags { - printf("extern testcase_tags %s;\n", $3) + printf("extern test_case_tags %s;\n", $3) tc_name = suffix($3, prefix_tc_tags) test_cases[tc_name] = 1 test_case_tags[tc_name] = $3 @@ -206,6 +213,8 @@ if ! nm ${*} | sort -k 3 | \ if (needs_default) print_test_case_record(DEFAULT) printf("};\n") + printf("const int test_case_count = sizeof(test_cases) / ") + printf("sizeof(test_cases[0]);\n") }'; then # Cleanup in case of an error. rm ${output_file} |
