node-v8 icon indicating copy to clipboard operation
node-v8 copied to clipboard

Lost JUnit support for V8 tests

Open targos opened this issue 3 years ago • 7 comments

We've been floating an old patch for some time (https://github.com/nodejs/node/commit/d8b4a7edaeff573df18d47277cb94553bf6faf39) but unfortunately it doesn't apply anymore since V8 did a big refactor of its test runner.

This breaks V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/4781/

targos avatar Jul 20 '22 12:07 targos

@nodejs/python @nodejs/build

targos avatar Jul 20 '22 12:07 targos

It's possible to fix up the patch but it's arguably a better idea to just use the built-in --json-test-results flag and transform the JSON file to JUnit, or teach Jenkins the JSON format (possibly harder, I don't know how much harder.)

bnoordhuis avatar Jul 20 '22 15:07 bnoordhuis

Here's a script which does the JSON -> JUnit conversion: https://gist.github.com/kvakil/8ed172559f5bc3c8391ec34065682599

It seems to work on all the cases I tried locally (on Linux: passed, timeout, and failed test cases). One weird thing is that the JSON output doesn't include all the successful test cases, only the failing ones and the slowest slow_tests_cutoff ones. Of course, you can set slow_tests_cutoff arbitrary high in order to get all the output, which is what that script assumes:

$ python3 tools/run-tests.py --gn --arch=x64 --json-test-results $(pwd)/v8-tap.json --slow-tests-cutoff=1000000 cctest
$ python3 json_to_xml_tap.py < v8-tap.json > v8-tap.xml

kvakil avatar Jul 25 '22 07:07 kvakil

Seems like a good forward. Can I suggest you PR it to nodejs/node? I don't know how to hook it up to the CI but someone else no doubt does.

One style nit: the project's python style is two space indent, not four.

bnoordhuis avatar Jul 28 '22 18:07 bnoordhuis

Would this make sense to add to https://github.com/nodejs/tap2junit ?

  • A question, not a suggestion unless others agree.

cclauss avatar Jul 29 '22 12:07 cclauss

Seems like a good forward. Can I suggest you PR it to nodejs/node? I don't know how to hook it up to the CI but someone else no doubt does.

One style nit: the project's python style is two space indent, not four.

PR is now at https://github.com/nodejs/node/pull/44049 (with your style nit addressed).

Would this make sense to add to https://github.com/nodejs/tap2junit ?

I'm not opposed to this. I can't find tap2unit anywhere in the nodejs repo with git grep tap2junit. Is it just hanging out in the Jenkins job config somewhere?

kvakil avatar Jul 30 '22 06:07 kvakil

https://github.com/nodejs/tap2junit is a URL that you can click on.

cclauss avatar Jul 30 '22 08:07 cclauss