diff options
author | Akihiro Motoki <motoki@da.jp.nec.com> | 2014-09-09 02:32:15 +0900 |
---|---|---|
committer | Akihiro Motoki <motoki@da.jp.nec.com> | 2014-10-24 02:08:17 +0900 |
commit | 0da0ea1438e81d392fd7d223e2140f87850f051d (patch) | |
tree | fcc435b3c0ff774c639608f9fe1b966f4422eb43 /run_tests.sh | |
parent | 2aa0315e8b0d0ccac885fd5bd66452f25d34ac1c (diff) | |
download | horizon-0da0ea1438e81d392fd7d223e2140f87850f051d.tar.gz |
Determine environment version based requirement files
It is painful to increment the venv version manually because
requirements.txt and test-requirements.txt are now updated by cron job.
This commit changes run_tests.sh to just store two requirements
files to .venv/environments file and check if it is up-to-date.
(Note that the environment cache file is moved to .venv directory
as there is no reason to store it in the top directory.)
Closes-Bug: #1376485
Change-Id: Ie44ccf6e2e65890baca3f316468254b600c518b1
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-x | run_tests.sh | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/run_tests.sh b/run_tests.sh index dfe95ed82..ba3e2dd80 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -2,13 +2,6 @@ set -o errexit -# ---------------UPDATE ME-------------------------------# -# Increment me any time the environment should be rebuilt. -# This includes dependency changes, directory renames, etc. -# Simple integer sequence: 1, 2, 3... -environment_version=47 -#--------------------------------------------------------# - function usage { echo "Usage: $0 [OPTION]..." echo "Run Horizon's test suite(s)" @@ -60,6 +53,7 @@ function usage { # root=`pwd -P` venv=$root/.venv +venv_env_version=$venv/environments with_venv=tools/with_venv.sh included_dirs="openstack_dashboard horizon" @@ -221,21 +215,20 @@ function destroy_venv { echo "Removing virtualenv..." rm -rf $venv echo "Virtualenv removed." - rm -f .environment_version - echo "Environment cleaned." } function environment_check { echo "Checking environment." - if [ -f .environment_version ]; then - ENV_VERS=`cat .environment_version` - if [ $ENV_VERS -eq $environment_version ]; then - if [ -e ${venv} ]; then - # If the environment exists and is up-to-date then set our variables - command_wrapper="${root}/${with_venv}" - echo "Environment is up to date." - return 0 - fi + if [ -f $venv_env_version ]; then + set +o errexit + cat requirements.txt test-requirements.txt | cmp $venv_env_version - > /dev/null + local env_check_result=$? + set -o errexit + if [ $env_check_result -eq 0 ]; then + # If the environment exists and is up-to-date then set our variables + command_wrapper="${root}/${with_venv}" + echo "Environment is up to date." + return 0 fi fi @@ -284,7 +277,6 @@ function backup_environment { fi mkdir -p /tmp/.horizon_environment/$JOB_NAME cp -r $venv /tmp/.horizon_environment/$JOB_NAME/ - cp .environment_version /tmp/.horizon_environment/$JOB_NAME/ # Remove the backup now that we've completed successfully rm -rf /tmp/.horizon_environment/$JOB_NAME.old echo "Backup completed" @@ -300,7 +292,6 @@ function restore_environment { fi cp -r /tmp/.horizon_environment/$JOB_NAME/.venv ./ || true - cp -r /tmp/.horizon_environment/$JOB_NAME/.environment_version ./ || true echo "Environment restored successfully." fi @@ -320,7 +311,7 @@ function install_venv { # Make sure it worked and record the environment version sanity_check chmod -R 754 $venv - echo $environment_version > .environment_version + cat requirements.txt test-requirements.txt > $venv_env_version } function run_tests { |