- if (unit->test_failed > 0 || unit->test_expect) {
- /* some tests failed (or were supposed to), so do detailed reporting of test case */
- if (unit->test_failed > 0) {
- fprintf(stderr, ".. failed\n");
- } else if (unit->nb_tests) {
- fprintf(stderr, "...... ok\n"); /* successful, but show about expected */
- } else {
- fprintf(stderr, ".... skip\n"); /* shouldn't happen, but I'm a bit lost with this logic */
- }
- xbt_dynar_foreach(unit->tests,it_test, test) {
- file = (test->file != NULL ? test->file : unit->file);
- line = (test->line != 0 ? test->line : unit->line);
- fprintf(stderr, " %s: %s [%s:%d]\n",
- (test->ignored?" SKIP":(test->expected_failure?(test->failed?"EFAIL":"EPASS"):
- (test->failed?" FAIL":" PASS"))),
- test->title, file, line);
-
- xbt_dynar_foreach(test->logs,it_log,log) {
- file = (log->file != NULL ? log->file : file);
- line = (log->line != 0 ? log->line : line);
- fprintf(stderr, " %s:%d: %s\n",
- file, line,log->text);
-
- }
- }
- fprintf(stderr, " Summary: %d of %d tests failed",unit->test_failed, unit->nb_tests);
- if (unit->test_ignore) {
- fprintf(stderr," (%d tests ignored)\n",unit->test_ignore);
- } else {
- fprintf(stderr,"\n");
- }
-
+ 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");
+ } else if (unit->nb_tests) {
+ fprintf(stderr, "...... ok\n"); /* successful, but show about expected */
+ } else {
+ fprintf(stderr, ".... skip\n"); /* shouldn't happen, but I'm a bit lost with this logic */
+ }
+ xbt_dynar_foreach(unit->tests, it_test, test) {
+ file = (test->file != NULL ? test->file : unit->file);
+ line = (test->line != 0 ? test->line : unit->line);
+ fprintf(stderr, " %s: %s [%s:%d]\n",
+ (test->ignored ? " SKIP"
+ : (test->expected_failure
+ ? (test->
+ failed ? "EFAIL" : "EPASS") : (test->failed ?
+ " FAIL" :
+ " PASS"))),
+ test->title, file, line);
+
+ if ((test->expected_failure && !test->failed)
+ || (!test->expected_failure && test->failed)) {
+ xbt_dynar_foreach(test->logs, it_log, log) {
+ file = (log->file != NULL ? log->file : file);
+ line = (log->line != 0 ? log->line : line);
+ fprintf(stderr, " %s:%d: %s\n",
+ file, line, log->text);
+
+ }
+ }
+ }
+ fprintf(stderr, " Summary: %d of %d tests failed",
+ unit->test_failed, unit->nb_tests);
+ if (unit->test_ignore) {
+ fprintf(stderr, " (%d tests ignored)\n", unit->test_ignore);
+ } else {
+ fprintf(stderr, "\n");
+ }
+