3 if [[ "$1" = "-h" ||
"$1" = "--help" ]]; then
4 echo "Usage (run from ./):"
5 echo -e "\t./run-backend-api-tests.sh"
6 echo -e "\t./run-backend-api-tests.sh [tests]..."
9 echo -e "\t./run-backend-api-tests.sh tasks.mgr.dashboard.test_pool.DashboardTest"
11 echo "Or source this script. This allows to re-run tests faster:"
12 echo -e "\tsource run-backend-api-tests.sh"
13 echo -e "\trun_teuthology_tests [tests]..."
14 echo -e "\tcleanup_teuthology"
20 # creating temp directory to store virtualenv and teuthology
22 get_cmake_variable
() {
24 grep "$variable" CMakeCache.txt | cut
-d "=" -f 2
31 BUILD_DIR
="$CURR_DIR/../../../../build"
33 read -r -d '' TEUTHOLOGY_PY_REQS
<<EOF
34 apache-libcloud==2.2.1 \
36 backports.ssl-match-hostname==3.5.0.1 \
61 python-dateutil==2.6.1 \
72 virtualenv
--python=/usr
/bin
/python venv
73 source venv
/bin
/activate
74 eval pip
install $TEUTHOLOGY_PY_REQS
75 pip
install -r $CURR_DIR/requirements.txt
78 git clone
--depth 1 https
://github.com
/ceph
/teuthology.git
82 CEPH_MGR_PY_VERSION_MAJOR
=$
(get_cmake_variable MGR_PYTHON_VERSION | cut
-d '.' -f1)
83 if [ -n "$CEPH_MGR_PY_VERSION_MAJOR" ]; then
84 CEPH_PY_VERSION_MAJOR
=${CEPH_MGR_PY_VERSION_MAJOR}
86 if [ $
(get_cmake_variable WITH_PYTHON2
) = ON
]; then
87 CEPH_PY_VERSION_MAJOR
=2
89 CEPH_PY_VERSION_MAJOR
=3
95 COVERAGE_VERSION
=$
(cat requirements.txt |
grep coverage
)
96 if [[ "$CEPH_MGR_PY_VERSION_MAJOR" == '3' ]]; then
97 pip3
install "$COVERAGE_VERSION"
99 pip
install "$COVERAGE_VERSION"
103 run_teuthology_tests
() {
105 find ..
/src
/pybind
/mgr
/dashboard
/ -name '*.pyc' -exec rm -f {} \
;
106 source $TEMP_DIR/venv
/bin
/activate
110 if [[ "$@" == '' ||
"$@" == '--create-cluster-only' ]]; then
111 TEST_CASES
=`for i in \`ls $BUILD_DIR/..
/qa
/tasks
/mgr
/dashboard
/test_
*\
`; do F=$(basename $i); M="${F%.*}"; echo -n " tasks.mgr.dashboard.$M"; done`
112 TEST_CASES
="tasks.mgr.test_module_selftest tasks.mgr.test_dashboard $TEST_CASES"
113 if [[ "$@" == '--create-cluster-only' ]]; then
118 TEST_CASES
="$TEST_CASES $t"
122 export PATH
=$BUILD_DIR/bin
:$PATH
123 export LD_LIBRARY_PATH
=$BUILD_DIR/lib
/cython_modules
/lib.
${CEPH_PY_VERSION_MAJOR}/:$BUILD_DIR/lib
124 export PYTHONPATH
=$TEMP_DIR/teuthology
:$BUILD_DIR/..
/qa
:$BUILD_DIR/lib
/cython_modules
/lib.
${CEPH_PY_VERSION_MAJOR}/:$BUILD_DIR/..
/src
/pybind
125 if [[ -z "$RGW" ]]; then
129 export COVERAGE_ENABLED
=true
130 export COVERAGE_FILE
=.coverage.mgr.dashboard
131 find .
-iname "*${COVERAGE_FILE}*" -type f
-delete
133 eval python ..
/qa
/tasks
/vstart_runner.py
$OPTIONS $TEST_CASES
139 cleanup_teuthology
() {
143 if [[ "$COVERAGE_ENABLED" == 'true' ]]; then
144 source $TEMP_DIR/venv
/bin
/activate
145 (coverage combine
&& coverage report
) || true
157 unset setup_teuthology
158 unset run_teuthology_tests
159 unset cleanup_teuthology
163 run_teuthology_tests
--create-cluster-only
165 # End sourced section
168 run_teuthology_tests
"$@"