[Rivet-svn] r2551 - trunk/test

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 29 08:29:53 BST 2010


Author: buckley
Date: Tue Jun 29 08:30:10 2010
New Revision: 2551

Log:
Test cleanup

Modified:
   trunk/test/testCmdLine.sh

Modified: trunk/test/testCmdLine.sh
==============================================================================
--- trunk/test/testCmdLine.sh	Mon Jun 28 17:24:16 2010	(r2550)
+++ trunk/test/testCmdLine.sh	Tue Jun 29 08:30:10 2010	(r2551)
@@ -1,11 +1,38 @@
 #! /usr/bin/env bash
 
-export PYTHONPATH=$(ls -d $PYTHON_BUILD_DIR/lib.*)
+export PYTHONPATH=$(ls -d $PYTHON_BUILD_DIR/lib.*):$PYTHONPATH
 
-cp testApi.hepmc file2.hepmc
-(rivet -a D0_2008_S7554427 testApi.hepmc file2.hepmc | grep -q "20 events") || exit 1
-(cat testApi.hepmc | rivet -a D0_2008_S7554427 | grep -q "10 events") || exit 1
-mkfifo fifo.hepmc
-(cat testApi.hepmc > fifo.hepmc & rivet -a D0_2008_S7554427 fifo.hepmc | grep -q "10 events") || exit 1
-rm -f fifo.hepmc
-rm -f file2.hepmc
+function _clean() {
+    rm -f fifo.hepmc
+    rm -f file2.hepmc
+}
+
+function _setup() {
+    _clean
+    cp testApi.hepmc file2.hepmc
+    mkfifo fifo.hepmc
+}
+
+function _check() {
+    CODE=$?
+    if [[ $CODE -ne 0 ]]; then
+        _clean
+        _exit $CODE
+    fi
+}
+
+_setup
+
+rivet -a D0_2008_S7554427 testApi.hepmc file2.hepmc > log
+grep -q "20 events" log
+_check
+
+cat testApi.hepmc | rivet -a D0_2008_S7554427 > log
+grep -q "10 events" log
+_check
+
+cat testApi.hepmc > fifo.hepmc &
+rivet -a D0_2008_S7554427 fifo.hepmc > log
+grep -q "10 events" log
+_check
+_clean


More information about the Rivet-svn mailing list