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

wasi-nn: adapt to new test infrastructure #7679

Merged
merged 6 commits into from
Dec 15, 2023

Conversation

abrown
Copy link
Collaborator

@abrown abrown commented Dec 13, 2023

This is a modern refactoring of #6895 to make wasi-nn use the test infrastructure that other WASI proposals are using (i.e., crates/test-programs). This is only the beginning: in follow up PRs, wasi-nn could gain unit tests, the existing examples could be removed, more kinds of tests could be added, etc. This will be easier in the future, though, once this infrastructure is in place for the wasmtime-wasi-nn crate.

@abrown abrown requested review from a team as code owners December 13, 2023 01:47
@abrown abrown requested review from pchickey and removed request for a team December 13, 2023 01:47
@abrown abrown marked this pull request as draft December 13, 2023 01:47
@abrown abrown force-pushed the nn-test-infrastructure branch 6 times, most recently from 8146ac4 to 7cc3488 Compare December 15, 2023 01:06
This change adds new test programs for wasi-nn in a way fits in with the
existing WASI test infrastructure. The code is not new, though: this
reuses the wasi-nn `examples`, which are currently used by the
`run-wasi-nn-example.sh` CI script. Eventually the examples will be
removed in favor of these tests.

Because wasi-nn's component model support is still in flight, this
change also skips the generation of components for `nn_`-prefixed tests.
This testing-only module has code (i.e., `check_test!`) to check whether
OpenVINO and some test artifacts are available. The test artifacts are
downloaded and cached if not present, expecting `curl` to be present on
the command line (as discussed in the previous version of this, bytecodealliance#6895).
Following the pattern of other WASI crates, this change adds the
necessary infrastructure to run the `nn_*` files in
`crates/test-programs` (built by `test-program-artifacts`). These tests
are only run when two sets of conditions are true:
- statically: we only run these tests where we expect OpenVINO to be
  easy to install and run (e.g., the `cfg_attr` parts)
- dynamically: we also only run these tests when the OpenVINO libraries
  can be located and the model artifacts can be downloaded
@abrown abrown marked this pull request as ready for review December 15, 2023 05:35
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Thanks! This is replacing the preexisting wasi-nn test, right? Would it make sense to delete that from CI while here?

@abrown abrown added this pull request to the merge queue Dec 15, 2023
Merged via the queue into bytecodealliance:main with commit 54d3727 Dec 15, 2023
40 checks passed
@abrown abrown deleted the nn-test-infrastructure branch December 15, 2023 23:47
dhil pushed a commit to dhil/wasmtime that referenced this pull request Dec 29, 2023
* wasi-nn: add test programs

This change adds new test programs for wasi-nn in a way fits in with the
existing WASI test infrastructure. The code is not new, though: this
reuses the wasi-nn `examples`, which are currently used by the
`run-wasi-nn-example.sh` CI script. Eventually the examples will be
removed in favor of these tests.

Because wasi-nn's component model support is still in flight, this
change also skips the generation of components for `nn_`-prefixed tests.

* wasi-nn: add `testing` module

This testing-only module has code (i.e., `check_test!`) to check whether
OpenVINO and some test artifacts are available. The test artifacts are
downloaded and cached if not present, expecting `curl` to be present on
the command line (as discussed in the previous version of this, bytecodealliance#6895).

* wasi-nn: run `nn_*` test programs as integration tests

Following the pattern of other WASI crates, this change adds the
necessary infrastructure to run the `nn_*` files in
`crates/test-programs` (built by `test-program-artifacts`). These tests
are only run when two sets of conditions are true:
- statically: we only run these tests where we expect OpenVINO to be
  easy to install and run (e.g., the `cfg_attr` parts)
- dynamically: we also only run these tests when the OpenVINO libraries
  can be located and the model artifacts can be downloaded

* ci: install OpenVINO for running wasi-nn tests

prtest:full

* vet: certify the `wasi-nn` crate

* ci: remove wasi-nn test 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.

None yet

2 participants