Skip to content

Add a script for porting passes tests to lit - #3963

Merged
tlively merged 5 commits into
WebAssembly:mainfrom
tlively:port-tests
Jul 3, 2021
Merged

Add a script for porting passes tests to lit#3963
tlively merged 5 commits into
WebAssembly:mainfrom
tlively:port-tests

Conversation

@tlively

@tlively tlively commented Jul 2, 2021

Copy link
Copy Markdown
Member

And use it to port the very simple untee test.

And use it to port the very simple untee test.
@tlively
tlively requested review from aheejin and kripken July 2, 2021 18:50

@aheejin aheejin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread scripts/port_test.py
parser.add_argument('--git-add', action='store_true',
help='Stage changes')
parser.add_argument('tests', nargs='+', help='The test files to port')
args = parser.parse_args()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to add simple --help with a usage string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is automatically generated by the arg parser module!

Comment thread scripts/port_test.py
opts = [('--' + p if not p.startswith('O') and p != 'g' else '-' + p)
for p in passes]

run_line = (f';; RUN: foreach %s %t wasm-opt {" ".join(opts)} -S -o -'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw we had foreach script: 8de4349

Was this added in part of a PR? Can't see any link to it..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was hidden in #3939

Comment thread scripts/port_test.py
Comment on lines +80 to +81
if args.git_add:
subprocess.run(['git', 'add', f])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why git add the source file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stages the removal of the file.

@tlively

tlively commented Jul 2, 2021

Copy link
Copy Markdown
Member Author

I fixed the flake8 error and added a new note to be emitted into the ported test identifying it as automatically ported. I realized this actually depends on #3962, so I will wait for that to land before re-generating the test here and landing this.

Comment thread scripts/port_test.py
@@ -0,0 +1,110 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe port_pass_test_to_lit.py?

Comment thread scripts/port_test.py
subprocess.run(['git', 'add', f])

if args.git_add:
subprocess.run(['git', 'add', dest])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised to see the git operations here... I'd expect the user to run them manually. But I don't feel strongly, if this is easier sgtm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's a little weird to do this in the script, so I put it behind a flag. It's a great quality of life feature, though.

@tlively
tlively enabled auto-merge (squash) July 3, 2021 00:10
@tlively
tlively merged commit cdf9ee0 into WebAssembly:main Jul 3, 2021
@tlively
tlively deleted the port-tests branch July 3, 2021 00:28
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
tlively added a commit to tlively/binaryen that referenced this pull request Jul 3, 2021
Using the script from WebAssembly#3963. Be careful to exclude metrics and fuzz-exec tests,
which have output that is not captured by the check generator script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants