/usr/bin/python2-oslo_run_cross_tests is in python-oslotest 1:3.2.0-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #!/bin/bash
#
# Run cross-project tests
#
# Usage:
#
# oslo_run_cross_tests project_dir venv
# Fail the build if any command fails
set -e
function usage {
cat - <<EOF
ERROR: Missing argument(s)
Usage:
oslo_run_cross_tests PROJECT_DIR VIRTUAL_ENV [POSARGS]
Example, run the python 2.7 tests for python-neutronclient:
oslo_run_cross_tests /opt/stack/python-neutronclient py27
oslo_run_cross_tests /opt/stack/nova py27 xenapi
EOF
exit $1
}
if [[ $# -lt 2 ]]; then
usage 1
fi
project_dir="$1"
shift
venv="$1"
shift
posargs="$*"
if [ -z "$project_dir" -o -z "$venv" ]
then
usage 2
fi
# Set up the virtualenv without running the tests
(cd $project_dir && tox --notest -r -e $venv)
tox_envbin=$project_dir/.tox/$venv/bin
our_name=$(python setup.py --name)
# Build the egg-info, including the source file list,
# so we install all of the files, even if the package
# list or name has changed.
rm -rf $(python setup.py --name).egg-info
python setup.py egg_info
# Replace the pip-installed package with the version in our source
# tree. Look to see if we are already installed before trying to
# uninstall ourselves, to avoid failures from packages that do not use us
# yet.
if $tox_envbin/pip freeze | grep -q $our_name
then
$tox_envbin/pip uninstall -y $our_name || echo "Ignoring error"
fi
$tox_envbin/pip install -U .
# Run the tests
(cd $project_dir && tox -e $venv -- $posargs)
result=$?
# The below checks are modified from
# openstack-infra/config/modules/jenkins/files/slave_scripts/run-unittests.sh.
# They expect to be run in the project being tested.
cd $project_dir
echo "Begin pip freeze output from test virtualenv:"
echo "======================================================================"
.tox/$venv/bin/pip freeze
echo "======================================================================"
# We only want to run the next check if the tool is installed, so look
# for it before continuing.
if [ -f /usr/local/jenkins/slave_scripts/subunit2html.py -a -d ".testrepository" ] ; then
if [ -f ".testrepository/0.2" ] ; then
cp .testrepository/0.2 ./subunit_log.txt
elif [ -f ".testrepository/0" ] ; then
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./subunit_log.txt
fi
.tox/$venv/bin/python /usr/local/jenkins/slave_scripts/subunit2html.py ./subunit_log.txt testr_results.html
gzip -9 ./subunit_log.txt
gzip -9 ./testr_results.html
export PYTHON=.tox/$venv/bin/python
set -e
rancount=$(.tox/$venv/bin/testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p')
if [ "$rancount" -eq "0" ] ; then
echo
echo "Zero tests were run. At least one test should have been run."
echo "Failing this test as a result"
echo
exit 1
fi
fi
# If we make it this far, report status based on the tests that were
# run.
exit $result
|