* * testname: if given, the test on which the directive acts. If not, acts on any tests.
*/
-XBT_PUBLIC(int) xbt_test_run(char *selection);
+XBT_PUBLIC(int) xbt_test_run(char *selection, int verbosity);
/* Show information about the selection of tests */
XBT_PUBLIC(void) xbt_test_dump(char *selection);
/* Cleanup the mess */
}
/* run test one suite */
-static int xbt_test_suite_run(xbt_test_suite_t suite)
+static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
{
xbt_test_unit_t unit;
xbt_test_test_t test;
/* Display whether this unit went well */
- if (unit->test_failed > 0 || unit->test_expect) {
+ if (unit->test_failed > 0 || unit->test_expect ||
+ (verbosity && unit->nb_tests > 0)) {
/* some tests failed (or were supposed to), so do detailed reporting of test case */
if (unit->test_failed > 0) {
fprintf(stderr, ".. failed\n");
}
}
-int xbt_test_run(char *selection)
+int xbt_test_run(char *selection, int verbosity)
{
apply_selection(selection);
/* Run all the suites */
xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
- xbt_test_suite_run(suite);
+ xbt_test_suite_run(suite, verbosity);
/* Display some more statistics */
fprintf(stderr, "\n\n TOTAL: Suites: %.0f%% ok (%d suites: ",
int main(int argc, char *argv[]) {
xbt_test_suite_t suite;
char selection[1024];
- int i;\n
- int res;\n
+ int verbosity = 0;
+ int i;
+ int res;
+
/* SGU: BEGIN SUITES DECLARATION */
/* SGU: END SUITES DECLARATION */
strcat(selection, \",\");
strcat(selection, p);
}
+ } else if (!strcmp(argv[i], \"--verbose\")) {
+ verbosity++;
} else if (!strcmp(argv[i], \"--dump-only\")||
!strcmp(argv[i], \"--dump\")) {
xbt_test_dump(selection);
printf(
"Usage: testall [--help] [--tests=selection] [--dump-only]\\n\\n"
"--help: display this help\\n"
+ "--verbose: print the name for each running test\\n"
"--dump-only: don't run the tests, but display some debuging info about the tests\\n"
"--tests=selection: Use argument to select which suites/units/tests to run\\n"
" --tests can be used more than once, and selection may be a comma\\n"
}
/* Got all my tests to do */
- res = xbt_test_run(selection);
+ res = xbt_test_run(selection, verbosity);
xbt_test_exit();
return res;
}