diff options
-rwxr-xr-x | testing/do-tests.in | 19 | ||||
-rwxr-xr-x | testing/make-testing | 32 | ||||
-rwxr-xr-x | testing/scripts/build-baseimage | 66 | ||||
-rwxr-xr-x | testing/scripts/build-hostconfig | 14 | ||||
-rwxr-xr-x | testing/scripts/build-sshkeys | 86 | ||||
-rwxr-xr-x | testing/scripts/build-umlhostfs | 33 | ||||
-rwxr-xr-x | testing/scripts/build-umlkernel | 13 | ||||
-rwxr-xr-x | testing/scripts/build-umlrootfs | 100 | ||||
-rwxr-xr-x | testing/scripts/function.sh | 17 | ||||
-rwxr-xr-x | testing/scripts/gstart-umls | 126 | ||||
-rwxr-xr-x | testing/scripts/kstart-umls | 126 | ||||
-rwxr-xr-x | testing/scripts/load-testconfig | 7 | ||||
-rwxr-xr-x | testing/scripts/start-umls | 18 | ||||
-rwxr-xr-x | testing/scripts/xstart-umls | 126 | ||||
-rwxr-xr-x | testing/start-testing | 23 | ||||
-rwxr-xr-x | testing/testing.conf | 38 |
16 files changed, 189 insertions, 655 deletions
diff --git a/testing/do-tests.in b/testing/do-tests.in index 82e027078..137bb31fb 100755 --- a/testing/do-tests.in +++ b/testing/do-tests.in @@ -558,14 +558,14 @@ do for file in clients.conf eap.conf radiusd.conf proxy.conf users do - scp $SSHCONF $HOSTLOGIN:/etc/raddb/$file \ + scp $SSHCONF $HOSTLOGIN:/etc/freeradius/$file \ $TESTRESULTDIR/${host}.$file > /dev/null 2>&1 done scp $SSHCONF $HOSTLOGIN:/etc/strongswan.conf \ $TESTRESULTDIR/${host}.strongswan.conf > /dev/null 2>&1 - scp $SSHCONF $HOSTLOGIN:/var/log/radius/radius.log \ + scp $SSHCONF $HOSTLOGIN:/var/log/freeradius/radius.log \ $TESTRESULTDIR/${host}.radius.log > /dev/null 2>&1 chmod a+r $TESTRESULTDIR/* @@ -584,7 +584,6 @@ do <ul> <li><a href="$host.eap.conf">eap.conf</a></li> <li><a href="$host.radius.log">radius.log</a></li> - <li><a href="$host.daemon.log">daemon.log</a></li> </ul> </td> <td valign="top"> @@ -649,18 +648,6 @@ do ########################################################################## - # get a copy of /var/log/daemon.log - # - - for host in $RADIUSHOSTS - do - eval HOSTLOGIN=root@\$ipv4_${host} - ssh $SSHCONF $HOSTLOGIN grep imcv /var/log/daemon.log \ - >> $TESTRESULTDIR/${host}.daemon.log - done - - - ########################################################################## # stop tcpdump if necessary # @@ -777,7 +764,7 @@ cecho "" # copy the test results to the apache server # -HTDOCS="/var/www/localhost/htdocs" +HTDOCS="/var/www" cecho-n "Copying test results to winnetou.." ssh $SSHCONF root@${ipv4_winnetou} mkdir -p $HTDOCS/testresults > /dev/null 2>&1 diff --git a/testing/make-testing b/testing/make-testing index 7cd3324e0..42f089e88 100755 --- a/testing/make-testing +++ b/testing/make-testing @@ -21,6 +21,7 @@ source $DIR/scripts/function.sh [ -f $DIR/testing.conf ] || die "!! Configuration file 'testing.conf' not found." source $DIR/testing.conf +rm -f $LOGFILE if [ "$#" -eq 0 ] then @@ -30,6 +31,16 @@ else fi ########################################################################## +# build base image +# +if [ $ENABLE_BUILD_BASEIMAGE = "yes" ] +then + cecho "Building base image" + $DIR/scripts/build-baseimage +fi + + +########################################################################## # build the UML kernel based on a vanilla kernel form kernel.org # and a matching UML patch from user-mode-linux.sourceforge.net # @@ -40,12 +51,13 @@ then fi ########################################################################## -# Adding the ssh RSA public keys to ~/.ssh/known_hosts +# build a generic UML root file system based on a Gentoo root file system. +# compile and install a specified strongSwan release into the file system. # -if [ $ENABLE_BUILD_SSHKEYS = "yes" ] +if [ $ENABLE_BUILD_UMLROOTFS = "yes" ] then - cecho "Adding ssh public keys of the uml instances (scripts/build-sshkeys)" - $DIR/scripts/build-sshkeys + cecho "Building uml base image (scripts/build-umlrootfs)" + $DIR/scripts/build-umlrootfs fi ########################################################################## @@ -59,21 +71,11 @@ then fi ########################################################################## -# build a generic UML root file system based on a Gentoo root file system. -# compile and install a specified strongSwan release into the file system. -# -if [ $ENABLE_BUILD_UMLROOTFS = "yes" ] -then - cecho "Building uml root file system with strongSwan (scripts/build-umlrootfs)" - $DIR/scripts/build-umlrootfs -fi - -########################################################################## # Creating the root filesystems for the specified UML instances # if [ $ENABLE_BUILD_UMLHOSTFS = "yes" ] then - cecho "Building uml host root file systems (scripts/build-umlhostfs)" + cecho "Building uml host images (scripts/build-umlhostfs)" $DIR/scripts/build-umlhostfs $HOSTS fi diff --git a/testing/scripts/build-baseimage b/testing/scripts/build-baseimage new file mode 100755 index 000000000..bf6780f6c --- /dev/null +++ b/testing/scripts/build-baseimage @@ -0,0 +1,66 @@ +#!/bin/bash + +if [ `id -u` != 0 ]; +then + echo "! you must be root to run $0" + exit +fi + +DIR=`dirname $0` + +. $DIR/function.sh + +[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" +. $DIR/../testing.conf + +execute() +{ + cmd=${1} + echo $cmd >>$LOGFILE + $cmd >>$LOGFILE 2>&1 + status=$? + if [ $status != 0 ]; then + echo "! command $cmd failed, exiting (status $status)" + echo "! check why here $LOGFILE" + exit 1 + fi +} + +# additional packages +EXTRAS=build-essential,gperf,libgmp-dev,libldap2-dev,libcurl4-openssl-dev,libxml2-dev,libtspi-dev,libsqlite3-dev,openssh-server,tcpdump,psmisc,openssl,vim,sqlite3,conntrack,gdb +SERVICES="isc-dhcp-server apache2 slapd" +PACKAGES=$EXTRAS,${SERVICES// /,} +CACHEDIR=$BUILDDIR/cache +APTCACHE=$LOOPDIR/var/cache/apt/archives + +mkdir -p $LOOPDIR +mkdir -p $BUILDDIR +mkdir -p $CACHEDIR +rm -f $ROOTFS + +echo "`date`, building $ROOTFS" >>$LOGFILE +echo " * Creating sparse image $ROOTFS ..." +execute "dd if=/dev/null of=$ROOTFS bs=1M seek=$ROOTFSSIZE count=1" +echo " * Creating ext3 filesystem ..." +execute "mkfs.ext3 -F $ROOTFS" +execute "mount -o loop $ROOTFS $LOOPDIR" +mkdir -p $APTCACHE +execute "mount -o bind $CACHEDIR $APTCACHE" + +echo " * Running debootstrap ..." +execute "debootstrap --arch=$ROOTFSARCH --include=$PACKAGES $ROOTFSSUITE $LOOPDIR $ROOTFSMIRROR" + +echo " * Setting root password to '$ROOTFSPW' ..." +echo root:$ROOTFSPW | chroot $LOOPDIR chpasswd + +echo " * Disabling services ..." +for service in $SERVICES +do + echo -n " - $service ... " + execute "chroot $LOOPDIR /etc/init.d/$service stop" + execute "chroot $LOOPDIR update-rc.d -f $service remove" + echo "done" +done + +execute "umount -l $APTCACHE" +execute "umount -l $LOOPDIR" diff --git a/testing/scripts/build-hostconfig b/testing/scripts/build-hostconfig index 0ebbc5264..cbe43dbb8 100755 --- a/testing/scripts/build-hostconfig +++ b/testing/scripts/build-hostconfig @@ -41,9 +41,19 @@ then fi mkdir $HOSTCONFIGDIR -cp -rfp ${UMLTESTDIR}/testing/hosts $BUILDDIR -cecho " * Copied default host config directory to '$HOSTCONFIGDIR'" +cecho-n " * Copying default host config for.." + +for host in $STRONGSWANHOSTS +do + cecho-n "$host.." + HOSTDIR=${HOSTCONFIGDIR}/$host + mkdir $HOSTDIR + cp -rfp $UMLTESTDIR/testing/hosts/default/* $HOSTDIR + cp -rfp $UMLTESTDIR/testing/hosts/$host/* $HOSTDIR +done + +cgecho "done" ######################################## # assign IP for each host to hostname diff --git a/testing/scripts/build-sshkeys b/testing/scripts/build-sshkeys deleted file mode 100755 index 799078557..000000000 --- a/testing/scripts/build-sshkeys +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash -# build the hosts configuration directory with the actual IP addresses -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "!! Configuration file 'testing.conf' not found" -[ -d $DIR/../hosts ] || die "!! Directory 'hosts' not found" - -source $DIR/../testing.conf - -if [ ! -d $BUILDDIR ] -then - cecho " * Creating directory '$BUILDDIR'" - mkdir $BUILDDIR -fi - -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - -if [ ! -d ~/.ssh ] -then - cecho-n " * Creating directory '~/.ssh'.." - mkdir ~/.ssh - cgecho "done" -fi - -if [ -f ~/.ssh/known_hosts ] -then - cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.." - cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml - cgecho "done" -else - cecho-n " * Creating '~/.ssh/known_hosts'" - touch ~/.ssh/known_hosts - cgecho "done" -fi - -for host in $HOSTNAMEIPV4 -do - HOSTNAME=`echo $host | awk -F, '{ print $1 }'` - IP=`echo $host | awk -F, '{ print $2 }'` - if [ `grep "$IP " ~/.ssh/known_hosts | wc -l` != "0" ] - then - cecho "!! Warning: An entry exists for the following IP address: $IP" - else - cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.." - echo "$HOSTNAME,$IP `cat $DIR/../hosts/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts - cgecho "done" - fi -done - -##################################### -# preparing ssh for PK authentication -# - -cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.." -if [ -f ~/.ssh/id_rsa.pub ] -then - cecho "already exists" -else - cecho "not found" - cecho-n " * Generating ssh rsa key pair.." - echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1 - cgecho "done" -fi diff --git a/testing/scripts/build-umlhostfs b/testing/scripts/build-umlhostfs index 75feaa4ed..9c309f545 100755 --- a/testing/scripts/build-umlhostfs +++ b/testing/scripts/build-umlhostfs @@ -23,8 +23,9 @@ source $DIR/function.sh source $DIR/../testing.conf cd $BUILDDIR/root-fs +BASE=$BUILDDIR/base.img -[ -f gentoo-fs ] || die "!! Root file system 'gentoo-fs' not found." +[ -f $BASE ] || die "!! Base image $BASE not found." if [ ! -d $BUILDDIR ] then @@ -33,17 +34,6 @@ then cgecho "done" fi -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - -LOOPDIR=loop - if [ ! -d $LOOPDIR ] then mkdir $LOOPDIR @@ -61,17 +51,22 @@ fi for host in $HOSTS do cecho-n "$host.." - cp gentoo-fs gentoo-fs-$host - mount -o loop gentoo-fs-$host $LOOPDIR + cp $BASE $host.img + mount -o loop $host.img $LOOPDIR cp -rf $BUILDDIR/hosts/${host}/etc $LOOPDIR if [ "$host" = "winnetou" ] then - mkdir $LOOPDIR/var/log/apache2/ocsp - cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/localhost/htdocs - chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/localhost/htdocs/certs - chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1 + mkdir $LOOPDIR/var/log/apache2/ocsp + cp -rf $UMLTESTDIR/testing/images $LOOPDIR/var/www/ + chroot $LOOPDIR ln -s /etc/openssl/certs /var/www/certs + chroot $LOOPDIR /etc/openssl/generate-crl >> $LOGFILE 2>&1 + chroot $LOOPDIR update-rc.d apache2 defaults >> $LOGFILE 2>&1 + chroot $LOOPDIR update-rc.d slapd defaults >> $LOGFILE 2>&1 + chroot $LOOPDIR rm -rf /var/lib/ldap/* + chroot $LOOPDIR slapadd -l /etc/ldap/ldif.txt -f /etc/ldap/slapd.conf >> $LOGFILE 2>&1 + chroot $LOOPDIR chown -R openldap:openldap /var/lib/ldap >> $LOGFILE 2>&1 fi - chroot $LOOPDIR /etc/init.d/depscan.sh --update >> $LOGFILE 2>&1 + sync umount $LOOPDIR done diff --git a/testing/scripts/build-umlkernel b/testing/scripts/build-umlkernel index b9f0d710d..44e27c2b2 100755 --- a/testing/scripts/build-umlkernel +++ b/testing/scripts/build-umlkernel @@ -67,15 +67,6 @@ fi cecho " * Changing to directory '$BUILDDIR'" cd $BUILDDIR -LOGFILE=${BUILDDIR}/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - cecho-n " * Unpacking kernel.." tar xjf $KERNEL >> $LOGFILE 2>&1 cgecho "done" @@ -119,10 +110,10 @@ cp $KERNELCONFIG .config cecho "!!" cecho "!! Making .config for kernel. You might be prompted for new parameters!" cecho "!!" -make oldconfig ARCH=um SUBARCH=i386 2>&1 | tee -a $LOGFILE +make oldconfig ARCH=um 2>&1 | tee -a $LOGFILE cecho-n " * Now compiling uml kernel.." -make linux ARCH=um SUBARCH=i386 >> $LOGFILE 2>&1 +make -j5 linux ARCH=um >> $LOGFILE 2>&1 cgecho "done" cecho-n " * Copying uml kernel to '${BUILDDIR}/linux-uml-${KERNELVERSION}'.." diff --git a/testing/scripts/build-umlrootfs b/testing/scripts/build-umlrootfs index 523a3b536..647c929ea 100755 --- a/testing/scripts/build-umlrootfs +++ b/testing/scripts/build-umlrootfs @@ -34,7 +34,7 @@ else exit fi -cecho-n " * Looking for gentoo root filesystem at '$ROOTFS'.." +cecho-n " * Looking for root image at '$ROOTFS'.." if [ -f "$ROOTFS" ] then cecho "found it" @@ -45,19 +45,6 @@ fi [ -d $BUILDDIR ] || die "!! Directory '$BUILDDIR' does not exist" -HOSTCONFIGDIR=$BUILDDIR/hosts - -[ -d $HOSTCONFIGDIR ] || die "!! Directory '$HOSTCONFIGDIR' does not exist" - -LOGFILE=$BUILDDIR/testing.log - -if [ ! -f $LOGFILE ] -then - cecho-n " * Logfile '$LOGFILE' does not exist..creating.." - touch $LOGFILE - cgecho "done" -fi - ROOTFSDIR=$BUILDDIR/root-fs if [ ! -d $ROOTFSDIR ] @@ -69,22 +56,18 @@ fi cd $ROOTFSDIR -LOOPDIR=$ROOTFSDIR/loop - if [ ! -d $LOOPDIR ] then mkdir $LOOPDIR fi ###################################################### -# creating reiser-based uml root filesystem +# mount root image # - -cecho-n " * Building basic root filesystem (gentoo).." -dd if=/dev/zero of=gentoo-fs count=$ROOTFSSIZE bs=1M >> $LOGFILE 2>&1 -mkreiserfs -q -f gentoo-fs >> $LOGFILE 2>&1 -mount -o loop gentoo-fs $LOOPDIR >> $LOGFILE 2>&1 -tar xjpf $ROOTFS -C $LOOPDIR >> $LOGFILE 2>&1 +BASE=$BUILDDIR/base.img +cecho-n " * Mounting base image $BASE.." +cp $ROOTFS $BASE +mount -o loop $BASE $LOOPDIR >> $LOGFILE 2>&1 cgecho "done" ###################################################### @@ -93,12 +76,6 @@ cgecho "done" cecho " * Removing /etc/resolv.conf" rm -f $LOOPDIR/etc/resolv.conf -###################################################### -# copying default /etc/hosts to the root filesystem -# -cecho " * Copying '$HOSTCONFIGDIR/default/etc/hosts' to the root filesystem" -cp -fp $HOSTCONFIGDIR/default/etc/hosts $LOOPDIR/etc/hosts - ##################################################### # extracting strongSwan into the root filesystem # @@ -291,7 +268,7 @@ if [ "$USE_KERNEL_PFKEY" = "yes" ] then echo -n " --enable-kernel-pfkey" >> $INSTALLSHELL fi - + if [ "$USE_INTEGRITY_TEST" = "yes" ] then echo -n " --enable-integrity-test" >> $INSTALLSHELL @@ -408,7 +385,7 @@ then fi echo "" >> $INSTALLSHELL -echo "make -j" >> $INSTALLSHELL +echo "make -j5" >> $INSTALLSHELL echo "make install" >> $INSTALLSHELL echo "ldconfig" >> $INSTALLSHELL @@ -417,16 +394,50 @@ chroot $LOOPDIR /bin/bash /install.sh >> $LOGFILE 2>&1 rm -f $INSTALLSHELL cgecho "done" -###################################################### -# copying default /etc/ipsec.d/tables.sql to the root filesystem +##################################### +# preparing ssh for PK authentication # -cecho " * Copying '$HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql' to the root filesystem" -cp -fp $HOSTCONFIGDIR/default/etc/ipsec.d/tables.sql $LOOPDIR/etc/ipsec.d/tables.sql +if [ ! -d ~/.ssh ] +then + cecho-n " * Creating directory '~/.ssh'.." + mkdir ~/.ssh + cgecho "done" +fi + +cecho-n " * Checking for ssh rsa key '~/.ssh/id_rsa.pub'.." +if [ -f ~/.ssh/id_rsa.pub ] +then + cecho "already exists" +else + cecho "not found" + cecho-n " * Generating ssh rsa key pair.." + echo "" | ssh-keygen -N "" -t rsa -f ~/.ssh/id_rsa >> $LOGFILE 2>&1 + cgecho "done" +fi + +if [ -f ~/.ssh/known_hosts ] +then + cecho-n " * Backing up ~/.ssh/known_hosts to '~/.ssh/known_hosts.before_uml'.." + cp -fp ~/.ssh/known_hosts ~/.ssh/known_hosts.before_uml + cgecho "done" +fi +rm ~/.ssh/known_hosts +cecho-n " * Creating new '~/.ssh/known_hosts'.." +touch ~/.ssh/known_hosts +cgecho "done" + +for host in $HOSTNAMEIPV4 +do + HOSTNAME=`echo $host | awk -F, '{ print $1 }'` + IP=`echo $host | awk -F, '{ print $2 }'` + cecho-n " * Adding uml host $HOSTNAME ($IP) to '~/.ssh/known_hosts'.." + echo "$HOSTNAME,$IP `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> ~/.ssh/known_hosts + cgecho "done" +done ###################################################### # copying the host's ssh public key # - if [ ! -d $LOOPDIR/root/.ssh ] then mkdir $LOOPDIR/root/.ssh @@ -441,21 +452,8 @@ cp $LOOPDIR/etc/ssh/ssh_host_rsa_key $LOOPDIR/root/.ssh/id_rsa for host in $STRONGSWANHOSTS do eval ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F- '{ print $1 }' | awk '{ print $1 }'`" - echo "$host,$ip `cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts - echo "`cat $HOSTCONFIGDIR/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys + echo "$host,$ip `cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub`" >> $LOOPDIR/root/.ssh/known_hosts + echo "`cat $LOOPDIR/etc/ssh/ssh_host_rsa_key.pub` root@$host" >> $LOOPDIR/root/.ssh/authorized_keys done -###################################################### -# defining an empty modules.dep -# - -if [ $UMLPATCH ] -then - mkdir $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um - touch $LOOPDIR/lib/modules/`basename $UMLPATCH .bz2 | sed s/uml-patch-//`um/modules.dep -else - mkdir $LOOPDIR/lib/modules/$KERNELVERSION - touch $LOOPDIR/lib/modules/$KERNELVERSION/modules.dep -fi - umount $LOOPDIR diff --git a/testing/scripts/function.sh b/testing/scripts/function.sh index e7ecbcf83..04723f105 100755 --- a/testing/scripts/function.sh +++ b/testing/scripts/function.sh @@ -55,13 +55,6 @@ function searchandreplace { [ -d "$DESTDIR" ] || die "$DESTDIR is not a directory!" - ######################### - # create a temporary file - # - - TMPFILE="/tmp/sr.$$" - - ########################################### # search and replace in each found file the # given string @@ -69,17 +62,9 @@ function searchandreplace { for eachfoundfile in `find $DESTDIR -type f` do - sed -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" > "$TMPFILE" - cp -f "$TMPFILE" "$eachfoundfile" + sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile" done - - ########################### - # delete the temporary file - # - - rm -f "$TMPFILE" - } ############################################# diff --git a/testing/scripts/gstart-umls b/testing/scripts/gstart-umls deleted file mode 100755 index c6fcd26dc..000000000 --- a/testing/scripts/gstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in an gnome-terminal (requires X11R6) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of xterm window on the desktop -x0=8 -y0=52 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval gnome-terminal --title=${host} --geometry="+${x0}+${y0}" --show-menubar --execute "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/scripts/kstart-umls b/testing/scripts/kstart-umls deleted file mode 100755 index 18dc64a9d..000000000 --- a/testing/scripts/kstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in a konsole (requires KDE) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of konsole window on the desktop -x0=8 -y0=8 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval konsole -title ${host} --geometry "+${x0}+${y0}" -e "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/scripts/load-testconfig b/testing/scripts/load-testconfig index 43100dbe0..d73b31275 100755 --- a/testing/scripts/load-testconfig +++ b/testing/scripts/load-testconfig @@ -58,17 +58,16 @@ for host in $IPSECHOSTS do eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/auth.log /var/log/daemon.log; \ - kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1 + kill -SIGHUP `cat /var/run/rsyslogd.pid`' > /dev/null 2>&1 done ########################################################################## -# clear radius.log and daemon.log on FreeRadius servers +# clear radius.log on FreeRadius servers # for host in $RADIUSHOSTS do eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/radius/radius.log /var/log/daemon.log; \ - kill -SIGHUP `cat /var/run/syslogd.pid`' > /dev/null 2>&1 + ssh $SSHCONF $HOSTLOGIN 'rm -f /var/log/freeradius/radius.log' > /dev/null 2>&1 done diff --git a/testing/scripts/start-umls b/testing/scripts/start-umls index 878494370..470bdc61b 100755 --- a/testing/scripts/start-umls +++ b/testing/scripts/start-umls @@ -42,7 +42,7 @@ do pid=`cat ~/.uml/${host}/pid` up=`ps up $pid | wc -l` fi - + if [ $up -eq 2 ] then cecho " * Great, ${host} is already running!" @@ -51,16 +51,12 @@ do BOOTING_HOSTS="$BOOTING_HOSTS ${host}" let "count_max += 12" - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} + UMLHOSTFS=$BUILDDIR/root-fs/${host}.img [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" cecho-n " * Starting ${host}.." - eval screen -dmS ${host} "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" - cgecho "done" + eval setsid $UMLKERNEL umid=${host} ubda=$UMLHOSTFS \$SWITCH_${host} mem=${MEM}M con=null con1=xterm >>$LOGFILE 2>&1 & + cgecho "done" fi done @@ -106,12 +102,6 @@ do cgecho "up" fi - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi done cecho " * All uml instances are up now" diff --git a/testing/scripts/xstart-umls b/testing/scripts/xstart-umls deleted file mode 100755 index ed2662b6c..000000000 --- a/testing/scripts/xstart-umls +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash -# starts the UML instances in an xterm (requires X11R6) -# -# Copyright (C) 2004 Eric Marchionni, Patrik Rayo -# Zuercher Hochschule Winterthur -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. - -DIR=`dirname $0` - -source $DIR/function.sh - -[ -f $DIR/../testing.conf ] || die "Configuration file 'testing.conf' not found" - -source $DIR/../testing.conf - -if [ "$#" -eq 0 ] -then - HOSTS=$STRONGSWANHOSTS -else - HOSTS=$* -fi - -BOOTING_HOSTS="" -count_max=12 -count=0 - -#position of xterm window on the desktop -x0=8 -y0=8 -dx=12 -dy=24 - -for host in $HOSTS -do - up=0 - - if [ -d ~/.uml/${host} ] - then - pid=`cat ~/.uml/${host}/pid` - up=`ps up $pid | wc -l` - fi - - if [ $up -eq 2 ] - then - cecho " * Great, ${host} is already running!" - else - rm -rf ~/.uml/${host} - BOOTING_HOSTS="$BOOTING_HOSTS ${host}" - let "count_max += 12" - - UMLHOSTFS=$BUILDDIR/root-fs/gentoo-fs-${host} - [ -f $UMLHOSTFS ] || die "!! uml root file system '$UMLHOSTFS' not found" - - cecho-n " * Starting ${host}.." - eval xterm -title ${host} -geometry "+${x0}+${y0}" -rightbar -sb -sl 500 -e "$UMLKERNEL \ - umid=${host} \ - ubda=$UMLHOSTFS \ - \$SWITCH_${host} \ - mem=${MEM}M con=pty con0=fd:0,fd:1" & - cgecho "done" - sleep 15 - fi - let "x0+=dx" - let "y0+=dy" -done - -if [ -z "$BOOTING_HOSTS" ] -then - exit 0 -fi - -cecho " * Waiting for the uml instances to finish booting" - -for host in $BOOTING_HOSTS -do - cecho-n " * Checking on $host.." - - while [ $count -lt $count_max ] && [ ! -d ~/.uml/$host ] - do - cecho-n "." - sleep 5 - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - fi - - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - - while [ $count -lt $count_max ] && [ $up -eq 0 ] - do - cecho-n "." - sleep 5 - up=`uml_mconsole $host proc net/route 2> /dev/null | grep eth0 | wc -l` - let "count+=1" - done - - if [ $count -ge $count_max ] - then - cecho "exit" - exit 1 - else - cgecho "up" - fi - - if [ "$host" = "alice" ] - then - sleep 5 - eval ipv4_${host}="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - ssh root@$ipv4_alice /etc/init.d/net.eth1 stop - fi -done - -cecho " * All uml instances are up now" diff --git a/testing/start-testing b/testing/start-testing index 278500e6f..ab8b96006 100755 --- a/testing/start-testing +++ b/testing/start-testing @@ -40,27 +40,8 @@ $DIR/scripts/start-bridges ##################################################### # start the uml instances # -case $UMLSTARTMODE in - konsole) - cecho "Start the uml instances (scripts/kstart-umls)" - $DIR/scripts/kstart-umls $HOSTS - ;; - gnome-terminal) - cecho "Start the uml instances (scripts/gstart-umls)" - $DIR/scripts/gstart-umls $HOSTS - ;; - xterm) - cecho "Start the uml instances (scripts/xstart-umls)" - $DIR/scripts/xstart-umls $HOSTS - ;; - screen) - cecho "Start the uml instances (scripts/start-umls)" - $DIR/scripts/start-umls $HOSTS - ;; - *) - die "The start mode is unknown! Please set $UMLSTARTMODE properly." - ;; -esac +cecho "Start the uml instances (scripts/start-umls)" +$DIR/scripts/start-umls $HOSTS ##################################################### diff --git a/testing/testing.conf b/testing/testing.conf index 5f6b0d65e..5cdf7b06e 100755 --- a/testing/testing.conf +++ b/testing/testing.conf @@ -27,7 +27,6 @@ KERNELVERSION=`basename $KERNEL .tar.bz2 | sed -e 's/linux-//'` # Kernel configuration file KERNELCONFIG=$UMLTESTDIR/.config-3.5 - # Bzipped uml patch for kernel UMLPATCH=$UMLTESTDIR/ha-3.0.patch.bz2 @@ -91,12 +90,6 @@ USE_IFMAP="no" USE_CISCO_QUIRKS="no" USE_UNITY="yes" -# Gentoo linux root filesystem -ROOTFS=$UMLTESTDIR/gentoo-fs-20111212.tar.bz2 - -# Size of the finished root filesystem in MB -ROOTFSSIZE=850 - # Amount of Memory to use per UML [MB]. # If "auto" is stated 1/12 of total host ram will be used. # Examples: MEM=64, MEM="128", MEM="auto" @@ -105,6 +98,20 @@ MEM=96 # Directory where the UML kernels and file system will be built BUILDDIR=$UMLTESTDIR/umlbuild +# Logfile +LOGFILE=$BUILDDIR/testing.log + +# Directory used for loop-mounts +LOOPDIR=$BUILDDIR/loop + +# Base image settings +ROOTFSSIZE=950 +ROOTFSSUITE=wheezy +ROOTFSARCH=amd64 +ROOTFS=$BUILDDIR/debian-$ROOTFSSUITE-$ROOTFSARCH.img +ROOTFSMIRROR=http://cdn.debian.net/debian +ROOTFSPW=root + # Filename of the built UML Kernel UMLKERNEL=$BUILDDIR/linux-uml-$KERNELVERSION @@ -126,29 +133,16 @@ TZUML="Europe/Zurich" # Enable particular steps in the make-testing and # start-testing scripts # +ENABLE_BUILD_BASEIMAGE="yes" ENABLE_BUILD_UMLKERNEL="yes" -ENABLE_BUILD_SSHKEYS="yes" -ENABLE_BUILD_HOSTCONFIG="yes" ENABLE_BUILD_UMLROOTFS="yes" +ENABLE_BUILD_HOSTCONFIG="yes" ENABLE_BUILD_UMLHOSTFS="yes" ENABLE_START_TESTING="yes" ENABLE_DO_TESTS="no" ENABLE_STOP_TESTING="no" ############################################################## -# How to start the UMLs? -# -# Start the UML instance in KDE konsole (requires KDE) -# UMLSTARTMODE="konsole" -# Start the UML instance in a gnome-terminal (requires gnome) -UMLSTARTMODE="gnome-terminal" -# Start the UML instance in an xterm (requires X11R6) -# UMLSTARTMODE="xterm" -# Start the UML instance without a terminal window -# but screen -r <host> can open a window anytime -# UMLSTARTMODE="screen" - -############################################################## # If set to "yes" only the tests stated at $SELECTEDTESTS # will be executed. (use "yes" or "no") # |