scripts: Support custom arguments to the test binary with dev_cli.sh

The dev container interface script (e.g. 'dev_cli.sh') now supports the
following arguments syntax for running tests:

`tests [--unit|--cargo|--all] [--libc musl|gnu] [-- [<test scripts args>] [-- [<test binary args>]]] `

In this way, we can pass custom arguments to the test binary (either
"cargo test" or "performance-metrics") with our dev container script.
For example:

`$ ./dev_cli.sh tests --metrics -- -- --report-file /tmp/metrics.json --test-filter latency`
`$ ./dev_cli.sh tests --integration -- --test-filter "test_serial"  -- --nocapture --test-threads=1`

Fixes: #3739

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2022-02-22 09:05:32 -08:00 committed by Sebastien Boeuf
parent ec7d4e727a
commit 4552d07a80
9 changed files with 23 additions and 14 deletions

View file

@ -183,7 +183,7 @@ cmd_help() {
echo " --volumes Hash separated volumes to be exported. Example --volumes /mnt:/mnt#/myvol:/myvol"
echo " --hypervisor Underlying hypervisor. Options kvm, mshv"
echo ""
echo " tests [--unit|--cargo|--all] [--libc musl|gnu] [-- [<cargo test args>]]"
echo " tests [--unit|--cargo|--all] [--libc musl|gnu] [-- [<test scripts args>] [-- [<test binary args>]]] "
echo " Run the Cloud Hypervisor tests."
echo " --unit Run the unit tests."
echo " --cargo Run the cargo tests."
@ -369,7 +369,7 @@ cmd_tests() {
exported_device="/dev/mshv"
fi
set -- "$@" '--hypervisor' "$hypervisor"
set -- '--hypervisor' "$hypervisor" "$@"
ensure_build_dir
ensure_latest_ctr