Repository navigation
selftest: migrate from expect to rust - #288
Merged
Merged
Conversation
Cut scripts currently set PATH="target/release:${PATH}" prior to calling
the rapido-cut binary. This makes override difficult if we e.g. want to
trigger "target/debug" invocation.
This change drops cut/*.sh PATH setting and instead exports PATH from
the rapido wrapper script. RAPIDO_BIN_PATH can be used to e.g. specify
a "target/debug" path.
The intention is to use this from rust integration tests, where
"cargo test" only ensures that debug bins are compiled.
Signed-off-by: David Disseldorp <[email protected]>
TempDir is already used in a few places. This changes the src/lib.rs and rapido-cut callers over to use the new crate. dracut-cpio isn't switched, as it needs extra mutex behaviour for per-test chdir. Signed-off-by: David Disseldorp <[email protected]>
expect isn't available by default on some distros, e.g. default Github runners. This reimplementation uses cargo's integration test functionality, which means that the selftests are run (in parallel) as part of regular "cargo test". ./rapido invocation is currently done via (coreutils) "timeout". Signed-off-by: David Disseldorp <[email protected]>
simple-example runner with separate cut + boot invocations. Signed-off-by: David Disseldorp <[email protected]>
Boot two simple-example VMs in parallel. Check vm_num and pid files. Signed-off-by: David Disseldorp <[email protected]>
Exercise -f and -x post-autorun cut parameters. Signed-off-by: David Disseldorp <[email protected]>
Check net-conf hostnames are propagated through to VMs Signed-off-by: David Disseldorp <[email protected]>
Cut+boot the simple-systemd runner and check for greeting and flag file. Signed-off-by: David Disseldorp <[email protected]>
"cargo test" runs unit and integration tests, so split them into separate --lib / --bin, and --test calls. Signed-off-by: David Disseldorp <[email protected]>
"cargo test" now handles all selftests, complete with filter support. Signed-off-by: David Disseldorp <[email protected]>
Under cargo test, "stty size" spits out: stty: 'standard input': Inappropriate ioctl for device The function already has fallback to ignore errors, so silence the stderr output. Signed-off-by: David Disseldorp <[email protected]>
We shouldn't rely on external websites for contributor requirements. Signed-off-by: David Disseldorp <[email protected]>
Signed-off-by: David Disseldorp <[email protected]>
Collaborator
Author
|
v2:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The main reason for this patchset is that "expect" isn't installed on many systems by default, and it's unfamiliar for most people (including myself, despite writing the tests). std rust provides some nice abstractions for interacting with a spawned Command via stdin and stdout, so use them instead.
The selftests now run in parallel as part of regular
cargo test, so they generally run much faster. However there may be problems on resource-constrained systems.