Skip to content

Commit 3999369

Browse files
feli-citascommit-bot@chromium.org
authored andcommitted
[dart/vm] Display test return code on divergence
Rationale: A divergence can be caused by differences in test output, timeout or crash. This patch displays the return code of the test program, so that the latter two cases can be distinguished. Change-Id: Id5520a2da41aad191c0878148acfff2c98c110aa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109682 Reviewed-by: Aart Bik <[email protected]> Commit-Queue: Felicitas Hetzelt <[email protected]>
1 parent d16ad91 commit 3999369

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

runtime/tools/dartfuzz/dartfuzz_test.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class DartFuzzTest {
343343
if (result1.output == result2.output) {
344344
numSuccess++;
345345
} else {
346-
reportDivergence(result1, result2, true);
346+
reportDivergence(result1, result2);
347347
}
348348
break;
349349
case ResultCode.timeout:
@@ -366,16 +366,23 @@ class DartFuzzTest {
366366
return;
367367
}
368368
}
369-
reportDivergence(result1, result2, false);
369+
reportDivergence(result1, result2);
370370
}
371371
}
372372

373-
void reportDivergence(
374-
TestResult result1, TestResult result2, bool outputDivergence) {
373+
String generateReport(TestResult result1, TestResult result2) {
374+
if (result1.code == result2.code) {
375+
return "output";
376+
} else {
377+
return "${result1.code} vs ${result2.code}";
378+
}
379+
}
380+
381+
void reportDivergence(TestResult result1, TestResult result2) {
375382
numDivergences++;
376-
print(
377-
'\n${isolate}: !DIVERGENCE! $version:$seed (output=${outputDivergence})');
378-
if (outputDivergence) {
383+
String report = generateReport(result1, result2);
384+
print('\n${isolate}: !DIVERGENCE! $version:$seed (${report})');
385+
if (result1.code == result2.code) {
379386
// Only report the actual output divergence details when requested,
380387
// since this output may be lengthy and should be reproducable anyway.
381388
if (showStats) {

0 commit comments

Comments
 (0)