-
Notifications
You must be signed in to change notification settings - Fork 158
Support running integration tests on macOS #524
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ccb09b1
tests/run.sh: Add macOS cross-compilation support for guest-agent
mtjhrc 05635f9
Makefile, test/run.sh: add macOS support to test target
mtjhrc ae4ec13
tests/README.md: document running tests on macOS
mtjhrc c4f5519
tests: Add support for skipping tests
mtjhrc a1591ab
tests: Fix TcpTester::run_server closing TCP stream too early
mtjhrc 47de716
tests: Explicitly specify a /tmp directory
mtjhrc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,46 @@ | ||
| # End-to-end tests | ||
| The testing framework here allows you to write code to configure libkrun (using the public API) and run some specific code in the guest. | ||
| The testing framework here allows you to write code to configure libkrun (using the public API) and run some specific code in the guest. | ||
|
|
||
| ## Running the tests: | ||
| The tests can be ran using `make test` (from the main libkrun directory). | ||
| You can also run `./run.sh` inside the `test` directory. When using the `./run.sh` script you probably want specify the `PKG_CONFIG_PATH` enviroment variable, otherwise you will be testing the system wide installation of libkrun. | ||
| You can also run `./run.sh` inside the `test` directory. When using the `./run.sh` script you probably want specify the `PKG_CONFIG_PATH` enviroment variable, otherwise you will be testing the system wide installation of libkrun. | ||
|
|
||
| ## Running on macOS | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. Install required build tools: | ||
| ```bash | ||
| brew install lld xz | ||
| rustup target add aarch64-unknown-linux-musl | ||
| ``` | ||
|
|
||
| 2. Install libkrunfw (required for non-EFI builds). Either via homebrew: | ||
| ```bash | ||
| brew install libkrunfw | ||
| ``` | ||
|
|
||
| Or build from source: | ||
| ```bash | ||
| curl -LO https://github.com/containers/libkrunfw/releases/download/v5.2.0/libkrunfw-prebuilt-aarch64.tgz | ||
| tar -xzf libkrunfw-prebuilt-aarch64.tgz | ||
| cd libkrunfw | ||
| make | ||
| sudo make install | ||
| ``` | ||
|
|
||
| If installed from source, add `/usr/local/lib` to your library path: | ||
| ```bash | ||
| export DYLD_LIBRARY_PATH="/usr/local/lib:${DYLD_LIBRARY_PATH}" | ||
| ``` | ||
|
|
||
| The test harness automatically handles the library path for homebrew installations. | ||
|
|
||
| ### Running tests | ||
|
|
||
| ```bash | ||
| make test | ||
| ``` | ||
|
|
||
| ## Adding tests | ||
| To add a test you need to add a new rust module in the `test_cases` directory, implement the required host and guest side methods (see existing tests) and register the test in the `test_cases/src/lib.rs` to be ran. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.