Author: jfrederic.clere(a)jboss.com
Date: 2008-01-16 05:47:37 -0500 (Wed, 16 Jan 2008)
New Revision: 1278
Modified:
trunk/build/unix/build.sh
trunk/build/unix/buildtest.rhel-httpd.linux2.sh
trunk/build/unix/buildtest.rhel-httpd.solaris.sh
trunk/build/unix/util/buildroot.solaris.sh
Log:
Arrange the logic to run buildroot once for several tests.
Add machine depend hostname and basedir for chrootable directory.
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2008-01-14 12:44:38 UTC (rev 1277)
+++ trunk/build/unix/build.sh 2008-01-16 10:47:37 UTC (rev 1278)
@@ -64,6 +64,16 @@
has_static=false
run_test=false
+#
+# Read local machine parameters.
+TMPROOTBASE=/tmp
+IPLOCAL=localhost
+if [ -f $HOME/jbossnative.`uname -n` ]; then
+ . $HOME/jbossnative.`uname -n`
+fi
+export TMPROOTBASE
+export IPLOCAL
+
while [ "x" != "x$1" ]
do
case $1 in
@@ -984,9 +994,11 @@
override ${build_top}/util/builddep $build_output_dir
${PACKAGE}.${build_version}.${BUILD_SYS}.${BUILD_CPU}.depends ${package_output_dir}
# create a chrootable environment for testing:
-override ${build_top}/util/buildroot ${package_output_dir}
+if [ ! -d ${TMPROOTBASE}/${package_output_dir} ]; then
+ override ${build_top}/util/buildroot ${TMPROOTBASE}/${package_output_dir}
+fi
# run a test
if $run_test; then
- override ${build_top}/buildtest.${PACKAGE}.sh ${package_output_dir}
+ override ${build_top}/buildtest.${PACKAGE}.sh ${TMPROOTBASE} ${package_output_dir}
fi
Modified: trunk/build/unix/buildtest.rhel-httpd.linux2.sh
===================================================================
--- trunk/build/unix/buildtest.rhel-httpd.linux2.sh 2008-01-14 12:44:38 UTC (rev 1277)
+++ trunk/build/unix/buildtest.rhel-httpd.linux2.sh 2008-01-16 10:47:37 UTC (rev 1278)
@@ -23,20 +23,25 @@
#
# Run a test of the httpd.
#
-root=$1
+# $1 : Base directory for the test.
+# $2 : Directory where the package was built.
+base=$1
+root=$2
-sudo /usr/sbin/chroot $root /opt/jboss/httpd/sbin/apachectl start
+# Copy the package to test.
+cp -rp $root/opt/ $base/$root
+
+# Test it.
+sudo /usr/sbin/chroot $base/$root /opt/jboss/httpd/sbin/apachectl start
sleep 5
-curl -v
http://localhost | grep "It works\!"
+curl -v http://${IPLOCAL} | grep "It works\!"
if [ $? -ne 0 ]; then
echo "Test FAILED cant start?"
- sudo /bin/umount $root/proc
exit 1
fi
-sudo /usr/sbin/chroot $root /opt/jboss/httpd/sbin/apachectl stop
+sudo /usr/sbin/chroot $base/$root /opt/jboss/httpd/sbin/apachectl stop
sleep 5
-sudo /bin/umount $root/proc
-curl -v
http://localhost
+curl -v http://${IPLOCAL}
if [ $? -eq 0 ]; then
echo "Test FAILED can't stop"
exit 1
Modified: trunk/build/unix/buildtest.rhel-httpd.solaris.sh
===================================================================
--- trunk/build/unix/buildtest.rhel-httpd.solaris.sh 2008-01-14 12:44:38 UTC (rev 1277)
+++ trunk/build/unix/buildtest.rhel-httpd.solaris.sh 2008-01-16 10:47:37 UTC (rev 1278)
@@ -23,30 +23,24 @@
#
# Run a test of the httpd.
#
-root=/tmp/$1
+base=$1
+root=$2
# copy the installation in /tmp (mknod doesn't work on all file system)
-cp -rp $1/opt $root
+cp -rp $root/opt $base/$root
-# mount proc
-mkdir -p $root/proc
-sudo /usr/sbin/mount -F proc proc $root/proc
-
# start the test.
-sudo /usr/sbin/chroot $root /opt/jboss/httpd/sbin/apachectl start
+sudo /usr/sbin/chroot $base/$root /opt/jboss/httpd/sbin/apachectl start
sleep 5
-curl -v
http://localhost | grep "It works\!"
+curl -v http://${IPLOCAL} | grep "It works\!"
if [ $? -ne 0 ]; then
- sudo /usr/sbin/umount $root/proc
echo "Test FAILED cant start?"
exit 1
fi
-sudo /usr/sbin/chroot $root /opt/jboss/httpd/sbin/apachectl stop
+sudo /usr/sbin/chroot $base/$root /opt/jboss/httpd/sbin/apachectl stop
sleep 5
-curl -v
http://localhost
+curl -v http://${IPLOCAL}
if [ $? -eq 0 ]; then
- sudo /usr/sbin/umount $root/proc
echo "Test FAILED can't stop"
exit 1
fi
-sudo /usr/sbin/umount $root/proc
Modified: trunk/build/unix/util/buildroot.solaris.sh
===================================================================
--- trunk/build/unix/util/buildroot.solaris.sh 2008-01-14 12:44:38 UTC (rev 1277)
+++ trunk/build/unix/util/buildroot.solaris.sh 2008-01-16 10:47:37 UTC (rev 1278)
@@ -110,3 +110,7 @@
# create /tmp
mkdir $root/tmp
chmod a+rwx $root/tmp
+
+# mount proc
+mkdir -p $root/proc
+sudo /usr/sbin/mount -F proc proc $root/proc