]>
git.proxmox.com Git - ceph.git/blob - ceph/src/script/run_tox.sh
5 if [ `uname` = FreeBSD
]; then
6 GETOPT
=/ usr
/ local
/ bin
/ getopt
12 local prog_name
= $
( basename $1 )
15 $prog_name [options] ... [test_name]
19 [-h|--help] display this help message
20 [--source-dir dir] root source directory of Ceph. deduced by the path of this script by default.
21 [--build-dir dir] build directory of Ceph. "\ $source_dir /build" by default.
22 [--tox-path dir] directory in which "tox.ini" is located. if "test_name" is not specified, it is the current directory by default, otherwise the script will try to find a directory with the name of specified \ $test_name with a "tox.ini" under it.
23 <--tox-envs envs> tox envlist. this option is required.
24 [--venv-path] the python virtualenv path. \ $build_dir /\ $test_name by default.
28 following command will run tox with envlist of "py3,mypy" using the "tox.ini" in current directory.
30 $prog_name --tox-envs py3,mypy
32 following command will run tox with envlist of "py3" using "/ceph/src/python-common/tox.ini"
34 $prog_name --tox-envs py3 --tox-path /ceph/src/python-common
38 function get_cmake_variable
() {
39 local cmake_cache
= $1 / CMakeCache.txt
43 if [ -e $cmake_cache ]; then
44 grep " $variable " $cmake_cache | cut
-d "=" -f 2
48 function get_tox_path
() {
50 if [ -n " $test_name " ]; then
51 local found
= $
( find $source_dir -path "*/ $test_name /tox.ini" )
52 echo $
( dirname $found )
53 elif [ -e tox.ini
]; then
60 local script_dir
= "$( cd " $
( dirname " ${BASH_SOURCE[0]} " ) " >/dev/null 2>&1 && pwd )"
61 local build_dir
= $script_dir / ..
/ ..
/ build
62 local source_dir
= $
( get_cmake_variable
$build_dir ceph_SOURCE_DIR
)
66 options
= $
( ${GETOPT} --name " $0 " --options 'h' --longoptions "help,source-dir:,build-dir:,tox-path:,tox-envs:,venv-path:" -- "$@" )
70 eval set -- " ${options} "
95 echo "bad option $1 " >& 2
101 if [ -z " $tox_path " ]; then
103 if [ $# -gt 0 ]; then
107 tox_path
= $
( get_tox_path
$test_name )
108 venv_path
= " $build_dir / $test_name "
110 test_name
= $
( basename $tox_path )
113 if [ ! -f ${venv_path} / bin
/ activate
]; then
114 if [ -d " $venv_path " ]; then
116 echo " $PWD already exists, but it's not a virtualenv. test_name empty?"
119 $source_dir / src
/ tools
/ setup-virtualenv.sh
${venv_path}
121 source ${venv_path} / bin
/ activate
124 # tox.ini will take care of this.
125 export CEPH_BUILD_DIR
= $build_dir
126 # use the wheelhouse prepared by install-deps.sh
127 export PIP_FIND_LINKS
= " $tox_path /wheelhouse"
128 tox
-c $tox_path / tox.ini
-e " $tox_envs " "$@"