Skip to content

tools: fix type mismatch in test runner

Rodrigo Muino Tomonari requested to merge github/fork/richardlau/testrunner into master

output.diagnostic is a list that is appended to on SmartOS when retrying a test due to ECONNREFUSED. https://github.com/nodejs/node/blob/2853b76e202e2549a8c02ed9f46621abcb76f392/tools/test.py#L612 https://github.com/nodejs/node/blob/2853b76e202e2549a8c02ed9f46621abcb76f392/tools/test.py#L197-L204

The test runner checks if output.diagnostic is truthy and, if so, assigns its value to self.traceback. https://github.com/nodejs/node/blob/2853b76e202e2549a8c02ed9f46621abcb76f392/tools/test.py#L376-L378

However self.traceback is supposed to be a string, and _printDiagnostic() in the TapProgressIndicator attempts to call splitlines() on it, which fails if it is a list with:

AttributeError: 'list' object has no attribute 'splitlines'

https://github.com/nodejs/node/blob/2853b76e202e2549a8c02ed9f46621abcb76f392/tools/test.py#L318-L324

Seen in https://ci.nodejs.org/job/node-test-commit-smartos/nodes=smartos18-64/38562/console

23:20:25 ok 2976 pummel/test-net-connect-econnrefused
23:20:33   ---
23:20:33   duration_ms: 8.617
23:20:33   severity: ok
23:20:33   stack: |-
23:20:33 Traceback (most recent call last):
23:20:33   File "tools/test.py", line 1753, in <module>
23:20:33     sys.exit(Main())
23:20:33   File "tools/test.py", line 1729, in Main
23:20:33     if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests):
23:20:33   File "tools/test.py", line 951, in RunTestCases
23:20:33     return progress.Run(tasks)
23:20:33   File "tools/test.py", line 160, in Run
23:20:33     self.RunSingle(False, 0)
23:20:33   File "tools/test.py", line 221, in RunSingle
23:20:33     self.HasRun(output)
23:20:33   File "tools/test.py", line 395, in HasRun
23:20:33     self._printDiagnostic()
23:20:33   File "tools/test.py", line 323, in _printDiagnostic
23:20:33     for l in self.traceback.splitlines():
23:20:33 AttributeError: 'list' object has no attribute 'splitlines'
23:20:33 make[1]: *** [Makefile:516: test-ci] Error 1

cc @nodejs/python

Merge request reports

Loading