mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 09:13:29 +00:00
tests: Reformat usage output in test_image.sh
Reformat the usage output displayed with `help` command or `-h` option. Trap exit codes only after options parsing, as that is used to generate a test report. Fixes: #169 Signed-off-by: Marco Vedovati <mvedovati@suse.com>
This commit is contained in:
parent
93ad0491ef
commit
2b187c30d0
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018 Intel Corporation
|
# Copyright (c) 2018 Intel Corporation
|
||||||
#
|
#
|
||||||
@ -36,27 +36,21 @@ test_initrds_only="false"
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
Usage: $script_name [help|<distro>]
|
Usage: $script_name [options] [command | <distro>]
|
||||||
$script_name [options]
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
-h | --help # Show usage.
|
-h | --help # Show usage.
|
||||||
--distro <distro> # Only run tests for specified distro.
|
--distro <distro> # Only run tests for specified distro.
|
||||||
--list # List all distros that can be tested.
|
--list # List all distros that can be tested.
|
||||||
--test-images-only # Only run images tests for the list of distros under test.
|
--test-images-only # Only run images tests for the list of distros under test.
|
||||||
--test-initrds-only # Only run initrds tests for the list of distros under test.
|
--test-initrds-only # Only run initrds tests for the list of distros under test.
|
||||||
|
|
||||||
Parameters:
|
Commands:
|
||||||
|
|
||||||
|
|
||||||
help : Show usage.
|
help : Show usage.
|
||||||
<distro> : Only run tests for specified distro.
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
- If no options or parameters are specified, all tests will be run.
|
|
||||||
|
|
||||||
|
When <distro> is specified, tests are run only for the specified <distro> distribution.
|
||||||
|
Otherwise, tests are be run on all distros.
|
||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +93,6 @@ exit_handler()
|
|||||||
sudo -E ps -efwww | egrep "docker|kata" >&2
|
sudo -E ps -efwww | egrep "docker|kata" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
trap exit_handler EXIT ERR
|
|
||||||
|
|
||||||
die()
|
die()
|
||||||
{
|
{
|
||||||
msg="$*"
|
msg="$*"
|
||||||
@ -504,10 +496,12 @@ main()
|
|||||||
[ "$1" = "--" ] && shift
|
[ "$1" = "--" ] && shift
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
help) usage && exit 0;;
|
help) usage; exit 0;;
|
||||||
|
|
||||||
*) distro="$1";;
|
*) distro="$1";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
trap exit_handler EXIT ERR
|
||||||
setup
|
setup
|
||||||
|
|
||||||
if [ -n "$distro" ]
|
if [ -n "$distro" ]
|
||||||
|
Loading…
Reference in New Issue
Block a user