This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add tests for the Asm type checker
ClosedPublic

Authored by asb on Mar 18 2022, 10:04 AM.

Details

Summary

While looking at bugs like PR54022, I noted that there is no real test coverage for the asm type checker. This patch starts to address that, adding a series of tests for the errors messages produced, as well as some FIXMEs as an XFAIL test for some current issues.

It's not intended to be an exhaustive test, but does have test cases for each of the instructions that the type checker has specific handling for.

Diff Detail

Event Timeline

asb created this revision.Mar 18 2022, 10:04 AM
asb requested review of this revision.Mar 18 2022, 10:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2022, 10:04 AM

Thanks for working on this!

asb updated this revision to Diff 416869.Mar 21 2022, 2:43 AM

Expanded coverage for type mismatches.

sbc100 added inline comments.Mar 21 2022, 8:45 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

What is this line? (is semi-colon a comment marker in .s files?)

asb added inline comments.Mar 21 2022, 9:04 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

It is, but you're right it's confusing to have alongside # comments. The XFAIL is picked up by lit and indicates the test is expected to fail (in this case, the RUN line will return a non-zero value).

asb updated this revision to Diff 416977.Mar 21 2022, 9:05 AM
asb retitled this revision from [WebAssembly][WIP] Add tests for the Asm type checker to [WebAssembly] Add tests for the Asm type checker.
asb edited the summary of this revision. (Show Details)

Address review feedback.

I don't have active patches for all FIXMEs, but I think it might be useful to land this and my other queued fixes rather than creating a large queue. So please take a look and let me know if you're happy for me to do that, or if there are any changes you'd like to see before that happens. Thanks!

sbc100 added inline comments.Mar 21 2022, 9:12 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

Oh, I normally use the # RUN: not ... for that.

asb added inline comments.Mar 22 2022, 2:18 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

That's a good way of checking for a non-zero exit value (as is done in type-checker-errors.s), but XFAIL has the advantage of marking a test as something that _should_ work, and having it show up in the test stats as such.

Happy to drop this file and just try to land type-checker-errors.s if that's preferred?

sbc100 added inline comments.Mar 22 2022, 8:39 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

Great! That makes sense now. Thanks for clarifying.

sbc100 accepted this revision.Mar 22 2022, 8:40 AM
This revision is now accepted and ready to land.Mar 22 2022, 8:40 AM
asb added inline comments.Mar 22 2022, 8:59 AM
llvm/test/MC/WebAssembly/type-checker-return.s
4

Thanks for the quick review, I really appreciate it.

This revision was landed with ongoing or failed builds.Mar 22 2022, 9:22 AM
This revision was automatically updated to reflect the committed changes.