From 4a7df22cffd1a905154edfd27d050b66549e18aa Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 6 Aug 2019 00:45:43 +0800 Subject: [PATCH] script/run_tox.sh: add --help option Signed-off-by: Kefu Chai --- src/script/run_tox.sh | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/script/run_tox.sh b/src/script/run_tox.sh index 8c297fe70fc6a..f0060690b520b 100755 --- a/src/script/run_tox.sh +++ b/src/script/run_tox.sh @@ -8,6 +8,37 @@ else GETOPT=getopt fi +function usage() { + local prog_name=$(basename $1) + shift + cat < tox envlist. this option is required. + [--venv-path] the python virtualenv path. \$build_dir/\$test_name by default. + +example: + +following command will run tox with envlist of "py27,py3" using the "tox.ini" in current directory. + + $prog_name --tox-env py27,py3 + +following command will run tox with envlist of "py27" using "src/pybind/mgr/ansible/tox.ini" + + $prog_name --tox-env py27 ansible + +following command will run tox with envlist of "py27" using "/ceph/src/python-common/tox.ini" + + $prog_name --tox-env py27 --tox-path /ceph/src/python-common +EOF +} + function get_cmake_variable() { local cmake_cache=$1/CMakeCache.txt shift @@ -36,13 +67,16 @@ function main() { local tox_envs local options - options=$(${GETOPT} --name "$0" --options '' --longoptions "source-dir:,build-dir:,tox-path:,tox-envs:,venv-path:" -- "$@") + options=$(${GETOPT} --name "$0" --options 'h' --longoptions "help,source-dir:,build-dir:,tox-path:,tox-envs:,venv-path:" -- "$@") if [ $? -ne 0 ]; then exit 2 fi eval set -- "${options}" while true; do case "$1" in + -h|--help) + usage $0 + exit 0;; --source-dir) source_dir=$2 shift 2;; -- 2.39.5