()
| 63 | |
| 64 | |
| 65 | def Main(): |
| 66 | test_results = json.load(sys.stdin) |
| 67 | |
| 68 | # V8's JSON test runner only logs failing and flaky tests under "results". We |
| 69 | # assume the caller has put a large number for --slow-tests-cutoff, to ensure |
| 70 | # that all the tests appear under "slowest_tests". |
| 71 | |
| 72 | failing_tests = {result["name"]: result for result in test_results["results"]} |
| 73 | all_tests = {result["name"]: result for result in test_results["slowest_tests"]} |
| 74 | passing_tests = { |
| 75 | name: result for name, result in all_tests.items() if name not in failing_tests |
| 76 | } |
| 77 | |
| 78 | # These check that --slow-tests-cutoff was passed correctly. |
| 79 | assert len(failing_tests) + len(passing_tests) == len(all_tests) |
| 80 | assert len(all_tests) == len(test_results["slowest_tests"]) |
| 81 | |
| 82 | output = JUnitTestOutput("v8tests") |
| 83 | |
| 84 | for name, failing_test in failing_tests.items(): |
| 85 | failing_output = [] |
| 86 | |
| 87 | stdout = failing_test["stdout"].strip() |
| 88 | if len(stdout): |
| 89 | failing_output.append("stdout:") |
| 90 | failing_output.append(stdout) |
| 91 | |
| 92 | stderr = failing_test["stderr"].strip() |
| 93 | if len(stderr): |
| 94 | failing_output.append("stderr:") |
| 95 | failing_output.append(stderr) |
| 96 | |
| 97 | failing_output.append("Command: " + failing_test["command"]) |
| 98 | |
| 99 | exit_code = failing_test["exit_code"] |
| 100 | if failing_test["result"] == "TIMEOUT": |
| 101 | failing_output.append("--- TIMEOUT ---") |
| 102 | elif IsExitCodeCrashing(exit_code): |
| 103 | failing_output.append("exit code: " + str(exit_code)) |
| 104 | failing_output.append("--- CRASHED ---") |
| 105 | |
| 106 | output.HasRunTest( |
| 107 | test_name=name, |
| 108 | test_cmd=failing_test["command"], |
| 109 | test_duration=failing_test["duration"], |
| 110 | test_failure="\n".join(failing_output), |
| 111 | ) |
| 112 | |
| 113 | for name, passing_test in passing_tests.items(): |
| 114 | output.HasRunTest( |
| 115 | test_name=name, |
| 116 | test_cmd=passing_test["command"], |
| 117 | test_duration=passing_test["duration"], |
| 118 | test_failure=None, |
| 119 | ) |
| 120 | |
| 121 | output.FinishAndWrite(sys.stdout.buffer) |
| 122 |
no test coverage detected
searching dependent graphs…