James E. Blair 53ede00741 Save and report nodepool image names
When building an image, save the hostname of the image to a file in
/etc.  Before running tox in jobs, cat that file.

This will help confirm which image was used to build a given node for
a particular job, and potentially help debug some issues we are
currently seeing.

Change-Id: I9d55b7223ea85c1137b460f049a0184d7e9ce53d
2014-08-22 10:28:57 -07:00

59 lines
1.3 KiB
Bash
Executable File

#!/bin/bash -x
# If a bundle file is present, call tox with the jenkins version of
# the test environment so it is used. Otherwise, use the normal
# (non-bundle) test environment. Also, run pip freeze on the
# resulting environment at the end so that we have a record of exactly
# what packages we ended up testing.
#
# Usage: run-tox.sh VENV
#
# Where VENV is the name of the tox environment to run (specified in the
# project's tox.ini file).
venv=$1
if [[ -z "$venv" ]]
then
echo "Usage: $?"
echo
echo "VENV: The tox environment to run (eg 'python27')"
exit 1
fi
cat /etc/image-hostname.txt
/usr/local/jenkins/slave_scripts/jenkins-oom-grep.sh pre
sudo /usr/local/jenkins/slave_scripts/jenkins-sudo-grep.sh pre
tox -v -e$venv
result=$?
sudo /usr/local/jenkins/slave_scripts/jenkins-sudo-grep.sh post
sudoresult=$?
if [ $sudoresult -ne "0" ]
then
echo
echo "This test has failed because it attempted to execute commands"
echo "with sudo. See above for the exact commands used."
echo
exit 1
fi
/usr/local/jenkins/slave_scripts/jenkins-oom-grep.sh post
oomresult=$?
if [ $oomresult -ne "0" ]
then
echo
echo "This test has failed because it attempted to exceed configured"
echo "memory limits and was killed prior to completion. See above"
echo "for related kernel messages."
echo
exit 1
fi
exit $result