From: Kefu Chai Date: Mon, 5 Aug 2019 16:45:43 +0000 (+0800) Subject: script/run_tox.sh: add --help option X-Git-Tag: v15.1.0~1959^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29457%2Fhead;p=ceph.git script/run_tox.sh: add --help option Signed-off-by: Kefu Chai --- diff --git a/src/script/run_tox.sh b/src/script/run_tox.sh index 8c297fe70fc6..f0060690b520 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;;