run_test.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 # A little helper to run an individual test without requiring a full
4 # install. It runs the test from the build directory.
5 #
6 # You problably want to do:
7 # cd wire-cell && alias run_test=`pwd`/run_test.sh
8 
9 usage () {
10  echo "run_test.sh testname [package]"
11  echo "if run from a package directory last arg isn't needed"
12  exit 1;
13 }
14 
15 
16 tst="$1" ; shift
17 pkg="$1" ; shift
18 if [ -z "$pkg" ] ; then
19  pkg=$(basename $(pwd))
20 fi
21 
22 top=$(dirname $(readlink -f $BASH_SOURCE))
23 
24 dir="$top/build/$pkg"
25 if [ ! -d $dir ] ; then
26  echo "No build directory: $dir"
27  usage
28 fi
29 
30 exe="$dir/test_$tst"
31 if [ ! -x $exe ] ; then
32  echo "Test $tst not built"
33  usage
34 fi
35 
36 LD_LIBRARY_PATH=$dir:$LD_LIBRARY_PATH $exe
37 
38