]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Make test scripts callable from any path
authorReto Buerki <reet@codelabs.ch>
Tue, 18 Dec 2012 15:44:21 +0000 (16:44 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 17 Jan 2013 15:54:58 +0000 (16:54 +0100)
12 files changed:
testing/do-tests
testing/make-testing
testing/scripts/build-baseimage
testing/scripts/build-guestimages
testing/scripts/build-guestkernel
testing/scripts/build-rootimage
testing/scripts/function.sh
testing/scripts/load-testconfig
testing/scripts/restore-defaults
testing/start-testing
testing/stop-testing
testing/testing.conf

index d7512bf7fd0f649bce647b6b04abae8e6cf3b2d1..14d723dbd04864031ae7b1bb24d2b927580f1648 100755 (executable)
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 # for more details.
 
-DIR=`dirname $0`
-
-. $PWD/scripts/function.sh
-
-[ -d $PWD/hosts ] || die "Directory 'hosts' not found"
-[ -d $PWD/tests ] || die "Directory 'tests' not found"
-[ -d $BUILDDIR ] || die "Directory '$BUILDDIR' does not exist, please run make-testing first"
-
+DIR=$(dirname `readlink -f $0`)
+. $DIR/testing.conf
+. $DIR/scripts/function.sh
+
+[ -d $DIR/hosts ] || die "Directory 'hosts' not found"
+[ -d $DIR/tests ] || die "Directory 'tests' not found"
+[ -d $BUILDDIR ] ||
+       die "Directory '$BUILDDIR' does not exist, please run make-testing first"
 
 ##############################################################################
 # take care of new path and file variables
index 2daf131447188024e2bcf9e59876f8e0ab218f6a..cac4eddf86f33b3e150ad6f57523df5a4fc2a176 100755 (executable)
@@ -1,25 +1,26 @@
 #!/bin/bash
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/testing.conf
 
 rm -f $LOGFILE
 
 if [ $ENABLE_BUILD_BASEIMAGE = "yes" ]
 then
-       $PWD/scripts/build-baseimage || exit 1
+       $DIR/scripts/build-baseimage || exit 1
 fi
 
 if [ $ENABLE_BUILD_ROOTIMAGE = "yes" ]
 then
-       $PWD/scripts/build-rootimage || exit 1
+       $DIR/scripts/build-rootimage || exit 1
 fi
 
 if [ $ENABLE_BUILD_GUESTKERNEL = "yes" ]
 then
-       $PWD/scripts/build-guestkernel || exit 1
+       $DIR/scripts/build-guestkernel || exit 1
 fi
 
 if [ $ENABLE_BUILD_GUESTIMAGES = "yes" ]
 then
-       $PWD/scripts/build-guestimages $HOSTS || exit 1
+       $DIR/scripts/build-guestimages $HOSTS || exit 1
 fi
index 81460d91cd7b8e486199718acff7e0e24b98c685..6e420d772ecf78cc6c928b56c01e5122da5d26f0 100755 (executable)
@@ -2,7 +2,9 @@
 
 echo "Building base image"
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
 [ `id -u` -eq 0 ] || die "You must be root to run $0"
 
index d07981a174b8942b984eaffce22e755ff6d44179..f5669040eb475604b30c0ea0cdc1a4d87f732e46 100755 (executable)
 
 echo "Creating guest images"
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
-HOSTSDIR=$PWD/hosts
+HOSTSDIR=$DIR/../hosts
 
 [ `id -u` -eq 0 ] || die "You must be root to run $0"
 [ -f $ROOTIMG ] || die "Root image $ROOTIMG not found"
@@ -47,7 +49,7 @@ do
        if [ "$host" = "winnetou" ]
        then
                execute "mkdir $LOOPDIR/var/log/apache2/ocsp" 0
-               execute "cp -rf $PWD/images $LOOPDIR/var/www/" 0
+               execute "cp -rf $DIR/../images $LOOPDIR/var/www/" 0
                execute_chroot "ln -s /etc/openssl/certs /var/www/certs" 0
                execute_chroot "/etc/openssl/generate-crl" 0
                execute_chroot "update-rc.d apache2 defaults" 0
index 84633bcd7c3e2e851f9331c11d64f47093f3dc09..fdd19ac74f1b3289fdcb3069d1c7aaff36b6d093 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
 echo "Building guest kernel version $KERNELVERSION"
 
index ac9ee8bbc0729ee0932f53f0cf0bfa98fee9593b..8f2b3aa1c09b82fa7a6febfb1fbfeb9a8edd5b66 100755 (executable)
@@ -16,7 +16,9 @@
 
 echo "Building root image"
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
 [ `id -u` -eq 0 ] || die "You must be root to run $0"
 [ -f "$BASEIMG" ] || die "Base image $BASEIMG not found"
@@ -52,7 +54,7 @@ do_on_exit rm -r $LOOPDIR/root/compile
 do_on_exit umount $LOOPDIR/root/compile
 
 echo "Installing software from source"
-RECPDIR=$PWD/scripts/recipes
+RECPDIR=$DIR/recipes
 RECIPES=`ls $RECPDIR/*.mk | xargs -n1 basename`
 execute "cp -r $RECPDIR/patches $LOOPDIR/root/compile" 0
 for r in $RECIPES
index a0afee83e1e9ed5c2842c065cfcea4820bd8793d..c4769678c016017b69cdd2f4dce7962d3c4a8595 100755 (executable)
@@ -26,9 +26,6 @@ die() {
        exit 1
 }
 
-[ -f testing.conf ] || die "Configuration file 'testing.conf' not found"
-. testing.conf
-
 # execute command
 # $1 - command to execute
 # $2 - whether or not to log command exit status
index 1abe5985c470ca3f048aac82abd482528b6a18a3..0ea4fbf0025d410a7a12ac73c91c812687631f50 100755 (executable)
@@ -14,7 +14,9 @@
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 # for more details.
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
 ##########################################################################
 # load-testconfig requires a testname as an argument
index 88d4f87a0036616dfe479e08ef396181e992641e..953548a1b599cde3d5129954d7878717a853112b 100755 (executable)
 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 # for more details.
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/../testing.conf
+. $DIR/function.sh
 
 testname=$1
 
-HOSTCONFIGDIR=$PWD/hosts
+HOSTCONFIGDIR=$DIR/../hosts
 TESTSDIR=$BUILDDIR/tests
 
 [ -d $TESTSDIR ] || die "Directory '$TESTSDIR' not found"
index e2944bc77a8b44a48561440f3478888c052df799..e4e00bb1b61d64d13a07dc5c0e3357775e692a04 100755 (executable)
@@ -1,9 +1,11 @@
 #!/bin/bash
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/testing.conf
+. $DIR/scripts/function.sh
 
 NETWORKS="vnet1 vnet2 vnet3"
-CONFDIR=$PWD/config/kvm
+CONFDIR=$DIR/config/kvm
 KNLSRC=$BUILDDIR/$KERNEL/arch/x86/boot/bzImage
 KNLTARGET=/var/run/kvm-swan-kernel
 HOSTFSTARGET=/var/run/kvm-swan-hostfs
index 5695d620ad93e4fb3bab7ae5aee511719b13c1c8..013637acaf12ea10c90fc05d60586c2710a931bd 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 
-. $PWD/scripts/function.sh
+DIR=$(dirname `readlink -f $0`)
+. $DIR/testing.conf
+. $DIR/scripts/function.sh
 
 echo "Stopping test environment"
 
index 0d8eff3d29e097eed9a6027e0dafc2ac8891758e..b8bd3cf1bc42ebe51d5f277492f4685d73969deb 100644 (file)
@@ -21,7 +21,7 @@ TESTDIR=/srv/strongswan-testing
 KERNELVERSION=3.5.3
 KERNEL=linux-$KERNELVERSION
 KERNELTARBALL=$KERNEL.tar.bz2
-KERNELCONFIG=$PWD/config/kernel/config-3.5
+KERNELCONFIG=$DIR/../config/kernel/config-3.5
 KERNELPATCH=ha-3.0.patch.bz2
 
 # strongSwan version used in tests