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

@@ -1,6 +1,7 @@
#!/bin/bash
hypervisor="kvm"
test_filter=""
test_binary_args=()
cmd_help() {
echo ""
@@ -28,12 +29,20 @@ process_common_args() {
shift
test_filter="$1"
;;
"--") {
shift
break
} ;;
*)
;;
echo "Unknown test scripts argument: $1. Please use '-- --help' for help."
exit
;;
esac
shift
done
if [[ ! ("$hypervisor" = "kvm" || "$hypervisor" = "mshv") ]]; then
die "Hypervisor value must be kvm or mshv"
fi
test_binary_args="$@"
}