Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve mounts host_path relatively to vmtest.toml
When a non-default `rootfs` is used, and vmtest is run through `go 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/...`), and `GOTMPDIR=.` 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 the `vmtest.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 to `mkdir` + `ln`: ```sh GOTMPDIR=. go test -exec "vmtest -c $(pwd)/vmtest.toml -- mkdir $(realpath ..); ln -s /skbdump/ $(pwd); " ./integration/... ``` Signed-off-by: Albin Kerouanton <albinker@gmail.com>
- Loading branch information