update shell runner
This commit is contained in:
parent
0ca50db2fe
commit
2eb8541977
@ -9,6 +9,8 @@
|
||||
# $7 is the path to the dataset to test against
|
||||
# $8 is the pip cache dir
|
||||
|
||||
set -x
|
||||
|
||||
pip_requires() {
|
||||
requires="tools/pip-requires"
|
||||
if [ ! -e $requires ]
|
||||
@ -55,7 +57,6 @@ EOF
|
||||
echo "To execute this script manually, run this:"
|
||||
echo "$0 $1 $2 $3 $4 $5 $6 $7 $8"
|
||||
|
||||
set -x
|
||||
|
||||
# Setup the environment
|
||||
export PATH=/usr/lib/ccache:$PATH
|
||||
@ -64,7 +65,7 @@ export PIP_DOWNLOAD_CACHE=$8
|
||||
# Restore database to known good state
|
||||
echo "Restoring test database $6"
|
||||
mysql -u root -e "drop database $6"
|
||||
mysql -u root -e "create database $7"
|
||||
mysql -u root -e "create database $6"
|
||||
mysql -u root -e "create user '$4'@'localhost' identified by '$5';"
|
||||
mysql -u root -e "grant all privileges on $6.* TO '$4'@'localhost';"
|
||||
mysql -u $4 --password=$5 $6 < /$7/$6.sql
|
||||
@ -72,14 +73,14 @@ mysql -u $4 --password=$5 $6 < /$7/$6.sql
|
||||
echo "Build test environment"
|
||||
cd $3
|
||||
|
||||
set +x
|
||||
#set +x
|
||||
echo "Setting up virtual env"
|
||||
source ~/.bashrc
|
||||
source /etc/bash_completion.d/virtualenvwrapper
|
||||
rm -rf ~/.virtualenvs/$1
|
||||
mkvirtualenv $1
|
||||
toggleglobalsitepackages
|
||||
set -x
|
||||
#set -x
|
||||
export PYTHONPATH=$PYTHONPATH:$3
|
||||
|
||||
# Some databases are from Folsom
|
||||
@ -115,11 +116,11 @@ git checkout master
|
||||
git branch -D working
|
||||
|
||||
# Cleanup virtual env
|
||||
set +x
|
||||
|
||||
echo "Cleaning up virtual env"
|
||||
deactivate
|
||||
rmvirtualenv $1
|
||||
set -x
|
||||
set +x
|
||||
|
||||
echo "done"
|
||||
|
||||
|
@ -92,6 +92,7 @@ class Runner(threading.Thread):
|
||||
|
||||
# Step 3:
|
||||
self._do_next_step(job)
|
||||
self._check_log_for_errors(job)
|
||||
|
||||
# Final step, send completed packet
|
||||
self._send_work_data(job)
|
||||
@ -101,6 +102,20 @@ class Runner(threading.Thread):
|
||||
if not self.cancelled:
|
||||
job.sendWorkException(str(e).encode('utf-8'))
|
||||
|
||||
def _get_logging_file(self, job):
|
||||
return os.path.join(
|
||||
self.config['job_working_dir'],
|
||||
job.unique,
|
||||
'testing.log'
|
||||
)
|
||||
|
||||
def _check_log_for_errors(self, job):
|
||||
logging_file = self._get_logging_file(job)
|
||||
|
||||
self.work_data['result'] = "Failed: errors found in log"
|
||||
job.sendWorkStatus(self.current_step, self.total_steps)
|
||||
job.sendWorkFail()
|
||||
|
||||
def _get_datasets(self):
|
||||
datasets_path = os.path.join(os.path.dirname(__file__),
|
||||
'datasets')
|
||||
@ -150,15 +165,10 @@ class Runner(threading.Thread):
|
||||
}
|
||||
)
|
||||
|
||||
print cmd
|
||||
"""utils.execute_to_log(
|
||||
cmd,
|
||||
os.path.join(
|
||||
self.config['job_working_dir'],
|
||||
job.unique,
|
||||
'testing.log'
|
||||
)
|
||||
)"""
|
||||
utils.execute_to_log(
|
||||
cmd,
|
||||
self._get_logging_file(job)
|
||||
)
|
||||
|
||||
def _grab_patchset(self, project_name, zuul_ref):
|
||||
""" Checkout the reference into config['git_working_dir'] """
|
||||
|
Loading…
x
Reference in New Issue
Block a user