Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
test_runner: add TAP parser#43525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_runner: add TAP parser #43525
Uh oh!
There was an error while loading. Please reload this page.
Conversation
manekinekko commented Jun 21, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
5db6310 to 4f44c29CompareUh oh!
There was an error while loading. Please reload this page.
cjihrig commented Sep 12, 2022
@manekinekko is there any update on this? I think this is probably the highest priority item for the test runner at this point. |
MoLow commented Sep 12, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
+1. additionaly - will this solution support arbitrary |
manekinekko commented Sep 12, 2022
Sorry for the delay guys. Had to deliver some work lately. So, the biggest challenge I need to work on solving right now is redesigning the lexer so it can support async scanning and make the parser support partial parsing, and emit the results once they are available (as discussed with @cjihrig over Twitter). A draft of a public API I am thinking of would look something like this: constparser=newTapParser(/* probably a flag to enable stream support */);child.stdout.on('data',(chunk)=>{parser.parse(chunk);});child.stdout.on('end',()=>{conststatus=parser.end();assert.strictEqual(status.ok,true);});@MoLow@cjihrig do you have any ideas about a different design / or a concern? |
cjihrig commented Sep 12, 2022
Is the lexer right now reading individual characters? If so, I think we can leverage the fact that TAP is line based. That would make it significantly simpler than a parser for something like a programming language. I think that would also make it simpler to handle streaming. |
manekinekko commented Sep 12, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
The parser is already splitting tokens (scanned by the lexer) into subsets, separated by EOL. The resulting array basically contains all tokens scanned at each TAP line. So I was thinking of leveraging this logic for streams. is that was you were referring to? |
cjihrig commented Sep 12, 2022
I guess I'm just wondering if we need a full blown lexer. Would it be simpler (less code, faster for us to get something shipped) to read input, turn it into lines, and parse each line. There are only a handful of line types outside of yaml blocks, and we can generally distinguish them by looking at just the first few characters of the line (whitespace, 'ok', 'not ok', 'TAP version', etc.). |
MoLow commented Sep 12, 2022
@cjihrig how would you expect a |
MoLow commented Sep 12, 2022
There is something vere similar here https://github.com/nodejs/tap2junit just FYI |
cjihrig commented Sep 12, 2022
According to the spec: and I think if there are extra lines, that might come from |
manekinekko commented Sep 12, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I agree with @cjihrig on the specs. The parser in this PR will error if a line starts with an unrecognized token. Pragmas are parsed but not yet applied. Could we print those console.logs as comments? |
MoLow commented Sep 12, 2022
I think it is ok to print invalid tap as a comment or something else, but we should not just ignore it |
manekinekko commented Sep 16, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@cjihrig@MoLow wdyt about this API? constargs=['--test',testFixtures];constchild=spawn(process.execPath,args);constparser=newTapParser();//<-- create a parser instancechild.stdout.on('data',(chunk)=>{constline=chunk.toString('utf-8');consttest=parser.parseChunk(line);//<--- call parseChunk() console.log(test);});The
|
MoLow commented Sep 16, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@manekinekko I would expect something based on classTapParserextendsreadline.InterfaceConstructor{constructor(input,output){super(input,output);this.on('line',(line)=>{..parsethelineandthis.emit('test')/this.emit('diagnostic')etc})}}either that or classTapParserextendsTapStream{constructor(input){this.handle=readline.createInterface({ input });this.handle.on('line',(line)=>{..parsethelineandthis.ok(data)/this.fail(data)etc})}} |
MoLow commented Sep 16, 2022
that is obviously very simplistic since TAP parsing can include multilines, etc |
097797e to a94927eComparenodejs-github-bot commented Nov 21, 2022
Landed in f8ce911 |
manekinekko commented Nov 22, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
OMG!! That was one hell of a ride!! Thanks y'all for taking the time to review and comment on this work! Special Thank You to @cjihrig@MoLow@fhinkel@benjamingr for your help and for being such great mentors ❤️ Already looking forward to my next contributions 👍 |
ljharb commented Nov 22, 2022
cc @nodejs/testing |
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs#43525 Refs: nodejs#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: #43525 Refs: #43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
Work in progress PR-URL: nodejs/node#43525 Refs: nodejs/node#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> (cherry picked from commit f8ce9117b19702487eb600493d941f7876e00e01)
Work in progress PR-URL: nodejs/node#43525 Refs: nodejs/node#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> (cherry picked from commit f8ce9117b19702487eb600493d941f7876e00e01)
Work in progress PR-URL: nodejs/node#43525 Refs: nodejs/node#43344 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> (cherry picked from commit f8ce9117b19702487eb600493d941f7876e00e01)
This PR adds initial support for a TAP LL(2) parser. This implementation is based on the grammar for TAP14 from https://testanything.org/tap-version-14-specification.html
TODO:
make lint)Refs: #43344
Signed-off-by: Wassim Chegham [email protected]
@benjamincburns@fhinkel@cjihrig