mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-22 07:51:16 +00:00
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>
49 lines
1.1 KiB
Bash
49 lines
1.1 KiB
Bash
#!/bin/bash
|
|
hypervisor="kvm"
|
|
test_filter=""
|
|
test_binary_args=()
|
|
|
|
cmd_help() {
|
|
echo ""
|
|
echo "Cloud Hypervisor $(basename $0)"
|
|
echo "Usage: $(basename $0) [<args>]"
|
|
echo ""
|
|
echo "Available arguments:"
|
|
echo ""
|
|
echo " --hypervisor Underlying hypervisor. Options kvm, mshv"
|
|
echo " --test-filter Tests to run"
|
|
echo ""
|
|
echo " --help Display this help message."
|
|
echo ""
|
|
}
|
|
|
|
process_common_args() {
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
"-h"|"--help") { cmd_help; exit 1; } ;;
|
|
"--hypervisor")
|
|
shift
|
|
hypervisor="$1"
|
|
;;
|
|
"--test-filter")
|
|
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="$@"
|
|
}
|