mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
test.c: Fix counting of tests and add 2 new tests
The unit test XML output was counting all registered tests as "run"
even when only a subset were actually requested to be run and
the "failures" attribute was missing.
* The "tests" attribute of the "testsuite" element in the
output XML now reflects only the tests actually requested
to be executed instead of all the tests registered.
* The "failures" attribute was added to the "testsuite"
element.
Also added 2 new unit tests that just pass and fail to be
used for CI testing.
Change-Id: Ia137814b5aeb0e1a44c75034bd3615c26021da69
(cherry picked from commit a0fd95ef52
)
This commit is contained in:
committed by
Asterisk Development Team
parent
3a158c07a1
commit
d0ce6d4ee5
@@ -715,8 +715,8 @@ static int test_execute_multiple(const char *name, const char *category, struct
|
||||
/* update total counts as well during this iteration
|
||||
* even if the current test did not execute this time */
|
||||
last_results.total_time += test->time;
|
||||
last_results.total_tests++;
|
||||
if (test->state != AST_TEST_NOT_RUN) {
|
||||
last_results.total_tests++;
|
||||
if (test->state == AST_TEST_PASS) {
|
||||
last_results.total_passed++;
|
||||
} else {
|
||||
@@ -793,10 +793,10 @@ static int test_generate_results(const char *name, const char *category, const c
|
||||
*/
|
||||
fprintf(f_xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
fprintf(f_xml, "<testsuites>\n");
|
||||
fprintf(f_xml, "\t<testsuite errors=\"0\" time=\"%u.%u\" tests=\"%u\" "
|
||||
fprintf(f_xml, "\t<testsuite errors=\"0\" time=\"%u.%u\" tests=\"%u\" failures=\"%u\" "
|
||||
"name=\"AsteriskUnitTests\">\n",
|
||||
last_results.total_time / 1000, last_results.total_time % 1000,
|
||||
last_results.total_tests);
|
||||
last_results.total_tests, last_results.total_failed);
|
||||
fprintf(f_xml, "\t\t<properties>\n");
|
||||
fprintf(f_xml, "\t\t\t<property name=\"version\" value=\"%s\"/>\n", ast_get_version());
|
||||
fprintf(f_xml, "\t\t</properties>\n");
|
||||
|
Reference in New Issue
Block a user