Resolve mounts host_path relatively to vmtest.toml #94
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.
When a non-default
rootfs
is used, and vmtest is run throughgo test -exec
, the binary executed within the VM can't be found, because that rootfs doesn't contain the test binary compiled on the fly. So a custom mount has to be specified.But, before that commit, if a relative
host_path
was used, it'd be passed as is to qemu, and thus would be resolved as relative to the cwd where qemu was running.In the case of Go, if a directory was passed to
go test
(eg../integration/...
), andGOTMPDIR=.
was set, Go would compile the test binary within its original cwd (eg. project root dir), and then launch vmtest in the 'directory under test' (eg../integration
), so the relative mount would resolve to the directory where vmtest was started (eg../integration
) -- a directory that doesn't contain the test binary.To fix this mismatch, resolve
host_path
relative to thevmtest.toml
file.FWIW this doesn't fully solve the original issue, unless the VM path put in the config file is hardcoded to the cwd of
go test -exec
. To overcome this, one can prepend the inline command with a call tomkdir
+ln
: