Once and for all, here is the properly updated Makefile.am for the apps
[debian/gnuradio] / run_tests.sh.in
index d32d3653ab6e0c6003f709ef3b02545c4e5e8c8d..ce0d909788184aecb66006be356db3b63a664737 100644 (file)
 # Second argument is absolute path to top of component build directory
 # Third argument is component source directory for qa tests
 
-# Where to find my swig generated shared library
-mylibdir=$2/src:$2/src/.libs:$2/src/lib:$2/src/lib/.libs
+# Absolute path to the top of the source directory
+abs_top_srcdir=@abs_top_srcdir@
+
+# Absolute path to the top of the build directory
+abs_top_builddir=@abs_top_builddir@
+
+# current QA srcdir
+export srcdir=$3
+
+# Where to find my C++ and swig generated shared libraries
+mylibdir=$2/src:$2/src/.libs:$2/src/lib:$2/src/lib/.libs:$2/lib:$2/lib/.libs:$2/swig:$2/swig/.libs
 
 # Where to find my swig generated python module
 mysrcdir=$1/src:$1/src/lib
 
 # Where to find my hand written python modules
-mypydir=$1/src:$1/src/python
+mypydir=$1/src:$1/src/python:$1/python
 
-# Where to find core's swig generated shared libraries
-grswigdir=@abs_top_builddir@/gnuradio-core/src/lib/swig
-grswigdir=$grswigdir:$grswigdir/.libs
-
-# Where to find core's hand generated swig glue
-grswigsrcdir=@abs_top_srcdir@/gnuradio-core/src/lib/swig
+# Where to find core's swig generated shared libraries,
+# and hand generated swig glue
+grswigdir=@gnuradio_core_SWIGDIRPATH@
 
 # Where to find core's python modules
-grpydir=@abs_top_srcdir@/gnuradio-core/src/python
+grpydir=@gnuradio_core_PYDIRPATH@
 
-# Construct search path for python modules
-PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$grswigdir:$grswigsrcdir:$grpydir:$PYTHONPATH"
+# Construct search path for python modules, if each exists
+for dir in $grswigdir $grpydir
+do
+    if [ "$dir" != "" ]
+    then
+       if [ "$PYTHONPATH" = "" ]
+       then
+           PYTHONPATH="$dir"
+       else
+           PYTHONPATH="$dir:$PYTHONPATH"
+       fi
+    fi
+done
+
+# Where to find pre-installed python modules
+withpydirs=@with_PYDIRPATH@
+
+# Add the 'with' dirs to the end of the python search path, if it exists
+if [ "$withpydirs" != "" ]
+then
+    PYTHONPATH="$PYTHONPATH:$withpydirs"
+fi
+
+# Add the "my" dirs to the absolute front of the python search path
+PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$PYTHONPATH"
 export PYTHONPATH
 
-# Where to find core's master library files and dependencies
-gromnidir=@abs_top_builddir@/omnithread
-gromnidir=$gromnidir:$gromnidir/.libs
-grcoredir=@abs_top_builddir@/gnuradio-core/src/lib
-grcoredir=$grcoredir:$grcoredir/.libs
-grlibdir=$gromnidir:$grcoredir
+# Where to find omnithread library files
+gromnidir=@omnithread_LIBDIRPATH@
+
+# Where to find gruel library files
+grueldir=@gruel_LIBDIRPATH@
+
+# Where to find gnuradio core's library files
+grcoredir=@gnuradio_core_LIBDIRPATH@
+
+# Construct search path for python modules
+# Check each one to make sure it's not "" before adding
+grlibdir=""
+for dir in $gromnidir $grcoredir $grueldir
+do
+    if [ "$dir" != "" ]
+    then
+       if [ "$grlibdir" = "" ]
+       then
+           grlibdir="$dir"
+       else
+           grlibdir="$dir:$grlibdir"
+       fi
+    fi
+done
+
+# Add 'mylibdir' to the start of the library load path, to get local
+# (to this component) created libraries
 
-# For OS/X
-DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
-export DYLD_LIBRARY_PATH
+# Where to find pre-installed libraries
+withlibdirs=@with_LIBDIRPATH@
 
-# For Win32
-PATH=$grlibdir:$PATH
+case "@host_os@" in
+  darwin*)
+    # Special Code for executing on Darwin / Mac OS X only
+    if [ "$DYLD_LIBRARY_PATH" = "" ]
+    then
+       DYLD_LIBRARY_PATH=$mylibdir
+    else
+       DYLD_LIBRARY_PATH=$mylibdir:$DYLD_LIBRARY_PATH
+    fi
+    # DYLD_LIBRARY_PATH will not be empty now
+    # Add the grlibdir paths to the front of any library load variable
+    if [ "$grlibdir" != "" ]
+    then
+       DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
+    fi
+    # Add the withdirs paths to the end of any library load variable
+    if [ "$withlibdirs" != "" ]
+    then
+       DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$withlibdirs
+    fi
+    export DYLD_LIBRARY_PATH
+    ;;
+  cygwin*|win*|mingw*)
+    # Special Code for executing on Win32 variants only
+    if [ "$PATH" = "" ]
+    then
+       PATH=$mylibdir
+    else
+       PATH=$mylibdir:$PATH
+    fi
+    # PATH will not be empty now
+    # Add the grlibdir paths to the front of any library load variable
+    if [ "$grlibdir" != "" ]
+    then
+       PATH=$grlibdir:$PATH
+    fi
+    # Add the withdirs paths to the end of any library load variable
+    if [ "$withlibdirs" != "" ]
+    then
+       PATH=$PATH:$withlibdirs
+    fi
+    export PATH
+    ;;
+esac
 
 # Don't load user or system prefs
 GR_DONT_LOAD_PREFS=1
@@ -50,8 +141,15 @@ export GR_DONT_LOAD_PREFS
 ok=yes
 for file in $3/qa_*.py
 do
-  if ! @PYTHON@ $file
+  # echo $file
+  @PYTHON@ $file
+  r=$?
+  if [ $r -ne 0 ]
   then
+    if [ $r -ge 128 ]          # killed by a signal
+    then
+      exit $r
+    fi
     ok=no
   fi  
 done