[asterisk-commits] pabelanger: branch pabelanger/chroot-1.8 r373187 - in /team/pabelanger/chroot...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 19 17:19:18 CDT 2012
Author: pabelanger
Date: Wed Sep 19 17:19:14 2012
New Revision: 373187
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373187
Log:
Create run_tests.sh script
Added:
team/pabelanger/chroot-1.8/run_tests.sh (with props)
Modified:
team/pabelanger/chroot-1.8/tools/pbuilder.sh
Added: team/pabelanger/chroot-1.8/run_tests.sh
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/chroot-1.8/run_tests.sh?view=auto&rev=373187
==============================================================================
--- team/pabelanger/chroot-1.8/run_tests.sh (added)
+++ team/pabelanger/chroot-1.8/run_tests.sh Wed Sep 19 17:19:14 2012
@@ -1,0 +1,108 @@
+#!/bin/bash
+# Based on OpenStack Horizon's run_tests.sh script
+# https://github.com/openstack/horizon/blob/master/run_tests.sh
+
+set -o errexit
+
+# ---------------UPDATE ME-------------------------------#
+# Increment me any time the environment should be rebuilt.
+# This includes dependncy changes, directory renames, etc.
+# Simple integer secuence: 1, 2, 3...
+environment_version=1
+#--------------------------------------------------------#
+
+function usage {
+ echo "Usage: $0 [OPTION]..."
+ echo ""
+ exit
+}
+
+root=$HOME
+venv=$root/.cache/pbuilder
+
+always_venv=0
+destroy=0
+force=0
+never_venv=0
+
+function process_option {
+ case "$1" in
+ -N|--no-virtual-env) always_venv=0; never_venv=1;;
+ -f|--force) force=1;;
+ -h|--help) usage;;
+ --destroy-environment) destroy=1;;
+ *) testargs="$testargs $1"
+ esac
+}
+
+function destroy_venv {
+ echo "Removing environment..."
+ rm -rf $venv
+ rm -f .environment_version
+ echo "Environment removed."
+}
+
+function sanity_check {
+ if [ $never_venv -eq 0 ]; then
+ if [ ! -e ${venv} ]; then
+ echo "Virtualenv not found at $venv. Did you install it?"
+ exit 1
+ fi
+ fi
+}
+
+function install_venv {
+ ./tools/pbuilder.sh
+ sanity_check
+ echo $environment_version > .environment_version
+}
+
+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
+ echo "Environment is up to date."
+ return 0
+ fi
+ fi
+ fi
+
+ if [ $always_venv -eq 0 ]; then
+ if [ ! -e ${venv} ]; then
+ echo -e "Environment not found. Install? (Y/n) \c"
+ else
+ echo -e "Your environment appears to be out of date. Update? (Y/n) \c"
+ fi
+ read update_env
+ if [ "x$update_env" = "xY" -o "x$update_env" = "x" -o "x$update_env" = "xy" ]; then
+ install_venv
+ fi
+ else
+ install_venv
+ fi
+
+}
+
+function run_tests {
+ sanity_check
+}
+
+for arg in "$@"; do
+ process_option $arg
+done
+
+if [ $destroy -eq 1 ]; then
+ destroy_venv
+ exit 0
+fi
+
+if [ $never_venv -eq 0 ]; then
+ if [ $force -eq 1 ]; then
+ destroy_venv
+ fi
+ environment_check
+fi
+
+run_tests || exit
Propchange: team/pabelanger/chroot-1.8/run_tests.sh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/pabelanger/chroot-1.8/run_tests.sh
------------------------------------------------------------------------------
svn:executable = *
Propchange: team/pabelanger/chroot-1.8/run_tests.sh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/pabelanger/chroot-1.8/run_tests.sh
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/pabelanger/chroot-1.8/tools/pbuilder.sh
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/chroot-1.8/tools/pbuilder.sh?view=diff&rev=373187&r1=373186&r2=373187
==============================================================================
--- team/pabelanger/chroot-1.8/tools/pbuilder.sh (original)
+++ team/pabelanger/chroot-1.8/tools/pbuilder.sh Wed Sep 19 17:19:14 2012
@@ -3,6 +3,9 @@
#sudo apt-get update
#sudo apt-get install build-essential pbuilder debian-archive-keyring ccache
+
+DISTS=precise
+ARCHS="i386 amd64"
PBUILDER_DIR="${HOME}/.cache/pbuilder"
@@ -15,11 +18,10 @@
cp tools/pbuilderrc ${HOME}/.pbuilderrc
-for x in precise; do
- for y in i386 amd64; do
+for x in ${DISTS}; do
+ for y in ${ARCHS}; do
if ! [ -f ${PBUILDER_DIR}/${x}-${y}-base.tgz ]; then
sudo DIST=${x} ARCH=${y} pbuilder create
fi
- sudo DIST=${x} ARCH=${y} pbuilder execute tools/depends.sh $PWD
done;
done
More information about the asterisk-commits
mailing list