[PATCH 1/4] move common test setup code to setup-hald.sh

Guillem Jover guillem.jover at nokia.com
Mon Nov 3 14:15:51 PST 2008


---
 hald/debug-hald.sh    |   32 +-------------------------------
 hald/massif-hald.sh   |   13 +------------
 hald/run-hald.sh      |   32 +-------------------------------
 hald/setup-hald.sh    |   34 ++++++++++++++++++++++++++++++++++
 hald/valgrind-hald.sh |   32 +-------------------------------
 5 files changed, 38 insertions(+), 105 deletions(-)
 create mode 100644 hald/setup-hald.sh

diff --git a/hald/debug-hald.sh b/hald/debug-hald.sh
index d7c3206..59a570e 100755
--- a/hald/debug-hald.sh
+++ b/hald/debug-hald.sh
@@ -1,36 +1,6 @@
 #!/bin/sh
 
-information_fdidir="../../hal-info/fdi"
-
-case `uname -s` in
-    FreeBSD)	backend=freebsd ;;
-    SunOS)	backend=solaris ;;
-    *)		backend=linux ;;
-esac
-export HALD_RUNNER_PATH=`pwd`/$backend:`pwd`/$backend/probing:`pwd`/$backend/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/$backend
-export PATH=`pwd`/../hald-runner:$PATH
-
-HALD_TMPDIR=/tmp/run-hald-$USER
-
-if [ "$1" = "--skip-fdi-install" ] ; then
-    shift
-else
-    rm -rf $HALD_TMPDIR
-    mkdir -p $HALD_TMPDIR
-    make -C ../policy install DESTDIR=$HALD_TMPDIR prefix=/
-    make -C ../fdi install DESTDIR=$HALD_TMPDIR prefix=/ && \
-    if [ ! -d $information_fdidir ] ; then
-    	echo "ERROR: You need to checkout hal-info in the same level"
-    	echo "directory as hal to get the information fdi files."
-    	exit
-    fi
-    make -C $information_fdidir install DESTDIR=$HALD_TMPDIR prefix=/
-fi
-export HAL_FDI_SOURCE_PREPROBE=$HALD_TMPDIR/share/hal/fdi/preprobe
-export HAL_FDI_SOURCE_INFORMATION=$HALD_TMPDIR/share/hal/fdi/information
-export HAL_FDI_SOURCE_POLICY=$HALD_TMPDIR/share/hal/fdi/policy
-export HAL_FDI_CACHE_NAME=$HALD_TMPDIR/hald-local-fdi-cache
-export POLKIT_POLICY_DIR=$HALD_TMPDIR/share/PolicyKit/policy
+. ./setup-hald.sh
 
 echo ========================================
 echo Just type \'run\' to start debugging hald
diff --git a/hald/massif-hald.sh b/hald/massif-hald.sh
index 8f43259..1f7b91f 100755
--- a/hald/massif-hald.sh
+++ b/hald/massif-hald.sh
@@ -1,17 +1,6 @@
 #!/bin/sh
 
-export HALD_RUNNER_PATH=`pwd`/linux:`pwd`/linux/probing:`pwd`/linux/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/linux
-export PATH=`pwd`/../hald-runner:$PATH
-
-if [ "$1" = "--skip-fdi-install" ] ; then
-    shift
-else
-    rm -rf .local-fdi
-    make -C ../fdi install DESTDIR=`pwd`/.local-fdi prefix=/
-fi
-export HAL_FDI_SOURCE_PREPROBE=.local-fdi/share/hal/fdi/preprobe
-export HAL_FDI_SOURCE_INFORMATION=.local-fdi/share/hal/fdi/information
-export HAL_FDI_SOURCE_POLICY=.local-fdi/share/hal/fdi/policy
+. ./setup-hald.sh
 
 #delete all old memory outputs, else we get hundreds
 rm massif.*
diff --git a/hald/run-hald.sh b/hald/run-hald.sh
index 44c5173..2751b4c 100755
--- a/hald/run-hald.sh
+++ b/hald/run-hald.sh
@@ -1,36 +1,6 @@
 #!/bin/sh
 
-information_fdidir="../../hal-info/fdi"
-
-case `uname -s` in
-    FreeBSD)	backend=freebsd ;;
-    SunOS)	backend=solaris ;;
-    *)		backend=linux ;;
-esac
-export HALD_RUNNER_PATH=`pwd`/$backend:`pwd`/$backend/probing:`pwd`/$backend/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/$backend
-export PATH=`pwd`/../hald-runner:$PATH
-
-HALD_TMPDIR=/tmp/run-hald-$USER
-
-if [ "$1" = "--skip-fdi-install" ] ; then
-    shift
-else
-    rm -rf $HALD_TMPDIR
-    mkdir -p $HALD_TMPDIR
-    make -C ../policy install DESTDIR=$HALD_TMPDIR prefix=/
-    make -C ../fdi install DESTDIR=$HALD_TMPDIR prefix=/ && \
-    if [ ! -d $information_fdidir ] ; then
-    	echo "ERROR: You need to checkout hal-info in the same level"
-    	echo "directory as hal to get the information fdi files."
-    	exit
-    fi
-    make -C $information_fdidir install DESTDIR=$HALD_TMPDIR prefix=/
-fi
-export HAL_FDI_SOURCE_PREPROBE=$HALD_TMPDIR/share/hal/fdi/preprobe
-export HAL_FDI_SOURCE_INFORMATION=$HALD_TMPDIR/share/hal/fdi/information
-export HAL_FDI_SOURCE_POLICY=$HALD_TMPDIR/share/hal/fdi/policy
-export HAL_FDI_CACHE_NAME=$HALD_TMPDIR/hald-local-fdi-cache
-export POLKIT_POLICY_DIR=$HALD_TMPDIR/share/PolicyKit/policy
+. ./setup-hald.sh
 
 ./hald --daemon=no --verbose=yes $@
 #./hald --daemon=no
diff --git a/hald/setup-hald.sh b/hald/setup-hald.sh
new file mode 100644
index 0000000..f5761bb
--- /dev/null
+++ b/hald/setup-hald.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+information_fdidir="../../hal-info/fdi"
+
+case `uname -s` in
+    FreeBSD)	backend=freebsd ;;
+    SunOS)	backend=solaris ;;
+    *)		backend=linux ;;
+esac
+export HALD_RUNNER_PATH=`pwd`/$backend:`pwd`/$backend/probing:`pwd`/$backend/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/$backend
+export PATH=`pwd`/../hald-runner:$PATH
+
+HALD_TMPDIR=/tmp/run-hald-$USER
+
+if [ "$1" = "--skip-fdi-install" ] ; then
+    shift
+else
+    rm -rf $HALD_TMPDIR
+    mkdir -p $HALD_TMPDIR
+    make -C ../policy install DESTDIR=$HALD_TMPDIR prefix=/
+    make -C ../fdi install DESTDIR=$HALD_TMPDIR prefix=/ && \
+    if [ ! -d $information_fdidir ] ; then
+    	echo "ERROR: You need to checkout hal-info in the same level"
+    	echo "directory as hal to get the information fdi files."
+    	exit
+    fi
+    make -C $information_fdidir install DESTDIR=$HALD_TMPDIR prefix=/
+fi
+export HAL_FDI_SOURCE_PREPROBE=$HALD_TMPDIR/share/hal/fdi/preprobe
+export HAL_FDI_SOURCE_INFORMATION=$HALD_TMPDIR/share/hal/fdi/information
+export HAL_FDI_SOURCE_POLICY=$HALD_TMPDIR/share/hal/fdi/policy
+export HAL_FDI_CACHE_NAME=$HALD_TMPDIR/hald-local-fdi-cache
+export POLKIT_POLICY_DIR=$HALD_TMPDIR/share/PolicyKit/policy
+
diff --git a/hald/valgrind-hald.sh b/hald/valgrind-hald.sh
index ab56633..f7759f6 100755
--- a/hald/valgrind-hald.sh
+++ b/hald/valgrind-hald.sh
@@ -1,36 +1,6 @@
 #!/bin/sh
 
-information_fdidir="../../hal-info/fdi"
-
-case `uname -s` in
-    FreeBSD)	backend=freebsd ;;
-    SunOS)	backend=solaris ;;
-    *)		backend=linux ;;
-esac
-export HALD_RUNNER_PATH=`pwd`/$backend:`pwd`/$backend/probing:`pwd`/$backend/addons:`pwd`/.:`pwd`/../tools:`pwd`/../tools/$backend
-export PATH=`pwd`/../hald-runner:$PATH
-
-HALD_TMPDIR=/tmp/run-hald-$USER
-
-if [ "$1" = "--skip-fdi-install" ] ; then
-    shift
-else
-    rm -rf $HALD_TMPDIR
-    mkdir -p $HALD_TMPDIR
-    make -C ../fdi install DESTDIR=$HALD_TMPDIR prefix=/ && \
-    make -C ../policy install DESTDIR=$HALD_TMPDIR prefix=/
-    if [ ! -d $information_fdidir ] ; then
-    	echo "ERROR: You need to checkout hal-info in the same level"
-    	echo "directory as hal to get the information fdi files."
-    	exit
-    fi
-    make -C $information_fdidir install DESTDIR=$HALD_TMPDIR prefix=/
-fi
-export HAL_FDI_SOURCE_PREPROBE=$HALD_TMPDIR/share/hal/fdi/preprobe
-export HAL_FDI_SOURCE_INFORMATION=$HALD_TMPDIR/share/hal/fdi/information
-export HAL_FDI_SOURCE_POLICY=$HALD_TMPDIR/share/hal/fdi/policy
-export HAL_FDI_CACHE_NAME=$HALD_TMPDIR/hald-local-fdi-cache
-export POLKIT_POLICY_DIR=$HALD_TMPDIR/share/PolicyKit/policy
+. ./setup-hald.sh
 
 #valgrind --num-callers=20 --show-reachable=yes --leak-check=yes --tool=memcheck ./hald --daemon=no --verbose=yes $@
 valgrind --show-reachable=yes --tool=memcheck --leak-check=full ./hald --daemon=no --verbose=yes $@
-- 
1.6.0.2



More information about the hal mailing list