summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDoug Hellmann <doug@doughellmann.com>2015-01-30 12:15:19 -0500
committerDoug Hellmann <doug@doughellmann.com>2015-01-30 12:15:19 -0500
commite50b8b390ec09b05a8b7f58c5863deee6725d49d (patch)
tree7b39cc22f860744a410dc2b7f097e046841005ec /tools
parentbaf76c59866daab6829046bea22f1e38b7602b79 (diff)
downloadoslotest-e50b8b390ec09b05a8b7f58c5863deee6725d49d.tar.gz
Publish cross-test runner as part of oslotest
Move the latest version of run_cross_test.sh from the incubator here to oslotest and rename it so we can publish it as a tool that comes with oslotest instead of syncing it into the other projects. Change-Id: I1aec3bda9e46b1667cfd7b68aa2d654327d1c8fb
Diffstat (limited to 'tools')
-rwxr-xr-xtools/oslo_run_cross_tests (renamed from tools/run_cross_tests.sh)36
1 files changed, 33 insertions, 3 deletions
diff --git a/tools/run_cross_tests.sh b/tools/oslo_run_cross_tests
index fb21e65..f5e400e 100755
--- a/tools/run_cross_tests.sh
+++ b/tools/oslo_run_cross_tests
@@ -1,12 +1,37 @@
#!/bin/bash
#
# Run cross-project tests
+#
+# Usage:
+#
+# oslo_run_cross_tests project_dir venv
# Fail the build if any command fails
set -e
project_dir="$1"
-venv="$2"
+shift
+venv="$1"
+shift
+posargs="$*"
+
+if [ -z "$project_dir" -o -z "$venv" ]
+then
+ cat - <<EOF
+ERROR: Missing argument(s)
+
+Usage:
+
+ $0 PROJECT_DIR VIRTUAL_ENV [POSARGS]
+
+Example, run the python 2.7 tests for python-neutronclient:
+
+ $0 /opt/stack/python-neutronclient py27
+ $0 /opt/stack/nova py27 xenapi
+
+EOF
+ exit 1
+fi
# Set up the virtualenv without running the tests
(cd $project_dir && tox --notest -e $venv)
@@ -15,18 +40,23 @@ 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.
+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
+ $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)
+(cd $project_dir && tox -e $venv -- $posargs)
result=$?