Skip to content
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

Use mops to run tests #579

Merged
merged 9 commits into from
Aug 2, 2023
Merged

Use mops to run tests #579

merged 9 commits into from
Aug 2, 2023

Conversation

ZenVoich
Copy link
Contributor

  • Changed test runner to mops test.
  • Removed vessel dependency.
  • Now only files with // @testmode wasi comment line will be compiled and run with wasmtime.

Mops can run tests in parallel, results:
On my laptop: 15s vs 50s
In GitHub CI: 30s vs 1m 33s

@rvanasa
Copy link
Contributor

rvanasa commented Jul 28, 2023

LGTM; thanks! I tested locally, and this is fantastic.

README.md Outdated Show resolved Hide resolved
test/Makefile Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

@crusso, would you prefer to keep the original Makefile in addition to the updated testing system?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably yes, though I haven't got the bandwith to think about just now. Any reason it's being removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason it's being removed?

I noticed that it was marked as deprecated, and assumed that it was not being used(also didn't find usage in CI files)

Copy link
Contributor

@crusso crusso Jul 28, 2023

Choose a reason for hiding this comment

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

Yeah, I don't think its in use the motoko-base CI, but is used from the motoko CI. Perhaps we can fix that somehow in the future, but not at the moment. Is it a problem to just keep it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will return these files.

@rvanasa
Copy link
Contributor

rvanasa commented Jul 28, 2023

It's worth mentioning that the unit tests originally ran in both the interpreter and Wasmtime (except for tests with the explicit // @testmode wasi) as a way to verify that the base library works as expected in both of these environments. Would it be feasible to include a similar feature in the Mops test runner?

@crusso
Copy link
Contributor

crusso commented Jul 28, 2023

Looks cool, but haven't had a change to try it (and won't before leaving on holiday for 1.5 wks). Is there any reason to remove the makefile and vessel dependencies. Come to think of it, I actually think the former will break Motoko CI since we run the base tests as part of CI, and almost certainly use the Makefile for that.

@ggreif amirite?

Co-authored-by: Ryan Vandersmith <ryanvandersmith@gmail.com>
@ZenVoich
Copy link
Contributor Author

Would it be feasible to include a similar feature in the Mops test runner?

Option to run all tests in wasi mode? Yes, I can add this feature to mops.

@ZenVoich
Copy link
Contributor Author

It's worth mentioning that the unit tests originally ran in both the interpreter and Wasmtime (except for tests with the explicit // @testmode wasi) as a way to verify that the base library works as expected in both of these environments

Is there probability to get false positive results depending on if tests are run in interpreter mode or in wasi mode?

@rvanasa
Copy link
Contributor

rvanasa commented Jul 28, 2023

Is there probability to get false positive results depending on if tests are run in interpreter mode or in wasi mode?

The WASI and interpreter runtimes work slightly differently, so it's possible that a bug in the interpreter might cause a test to fail where it works fine in the WASI runtime, and vice versa. This has actually happened in the past, so it's helpful to run the base library tests using both WASI and the interpreter whenever possible (although this is perhaps a unique requirement for the base library compared to most other Motoko projects).

@ZenVoich
Copy link
Contributor Author

Returned vessel's files and makefile.
In CI run tests in interpreter and wasi mode.

Copy link
Contributor

@rvanasa rvanasa left a comment

Choose a reason for hiding this comment

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

Approving (will give the rest of the team a chance to weigh in before merging).

@rvanasa rvanasa requested a review from ggreif August 1, 2023 16:27
@rvanasa rvanasa merged commit f1f6099 into dfinity:master Aug 2, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants