gnuradio-core: allow swig to handle exceptions in UDP source/sink
[debian/gnuradio] / run_tests.sh.in
1 #!/bin/sh
2
3 # First argument is absolute path to top of component source directory
4 # Second argument is absolute path to top of component build directory
5 # Third argument is component source directory for qa tests
6
7 # Absolute path to the top of the source directory
8 abs_top_srcdir=@abs_top_srcdir@
9
10 # Absolute path to the top of the build directory
11 abs_top_builddir=@abs_top_builddir@
12
13 # current QA srcdir
14 export srcdir=$3
15
16 # Where to find my C++ and swig generated shared libraries
17 mylibdir=$2/src:$2/src/.libs:$2/src/lib:$2/src/lib/.libs:$2/lib:$2/lib/.libs:$2/swig:$2/swig/.libs
18
19 # Where to find my swig generated python module
20 mysrcdir=$1/src:$1/src/lib
21
22 # Where to find my hand written python modules
23 mypydir=$1/src:$1/src/python:$1/python
24
25 # Where to find core's swig generated shared libraries,
26 # and hand generated swig glue
27 grswigdir=@gnuradio_core_SWIGDIRPATH@
28
29 # Where to find core's python modules
30 grpydir=@gnuradio_core_PYDIRPATH@
31
32 # Construct search path for python modules, if each exists
33 for dir in $grswigdir $grpydir
34 do
35     if [ "$dir" != "" ]
36     then
37         if [ "$PYTHONPATH" = "" ]
38         then
39             PYTHONPATH="$dir"
40         else
41             PYTHONPATH="$dir:$PYTHONPATH"
42         fi
43     fi
44 done
45
46 # Where to find pre-installed python modules
47 withpydirs=@with_PYDIRPATH@
48
49 # Add the 'with' dirs to the end of the python search path, if it exists
50 if [ "$withpydirs" != "" ]
51 then
52     PYTHONPATH="$PYTHONPATH:$withpydirs"
53 fi
54
55 # Add the "my" dirs to the absolute front of the python search path
56 PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$PYTHONPATH"
57 export PYTHONPATH
58
59 # Where to find gruel library files
60 grueldir=@gruel_LIBDIRPATH@
61
62 # Where to find gnuradio core's library files
63 grcoredir=@gnuradio_core_LIBDIRPATH@
64
65 # Construct search path for python modules
66 # Check each one to make sure it's not "" before adding
67 grlibdir=""
68 for dir in $grcoredir $grueldir
69 do
70     if [ "$dir" != "" ]
71     then
72         if [ "$grlibdir" = "" ]
73         then
74             grlibdir="$dir"
75         else
76             grlibdir="$dir:$grlibdir"
77         fi
78     fi
79 done
80
81 # Add 'mylibdir' to the start of the library load path, to get local
82 # (to this component) created libraries
83
84 # Where to find pre-installed libraries
85 withlibdirs=@with_LIBDIRPATH@
86
87 case "@host_os@" in
88   darwin*)
89     # Special Code for executing on Darwin / Mac OS X only
90     if [ "$DYLD_LIBRARY_PATH" = "" ]
91     then
92         DYLD_LIBRARY_PATH=$mylibdir
93     else
94         DYLD_LIBRARY_PATH=$mylibdir:$DYLD_LIBRARY_PATH
95     fi
96     # DYLD_LIBRARY_PATH will not be empty now
97     # Add the grlibdir paths to the front of any library load variable
98     if [ "$grlibdir" != "" ]
99     then
100         DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
101     fi
102     # Add the withdirs paths to the end of any library load variable
103     if [ "$withlibdirs" != "" ]
104     then
105         DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$withlibdirs
106     fi
107     export DYLD_LIBRARY_PATH
108     ;;
109   cygwin*|win*|mingw*)
110     # Special Code for executing on Win32 variants only
111     if [ "$PATH" = "" ]
112     then
113         PATH=$mylibdir
114     else
115         PATH=$mylibdir:$PATH
116     fi
117     # PATH will not be empty now
118     # Add the grlibdir paths to the front of any library load variable
119     if [ "$grlibdir" != "" ]
120     then
121         PATH=$grlibdir:$PATH
122     fi
123     # Add the withdirs paths to the end of any library load variable
124     if [ "$withlibdirs" != "" ]
125     then
126         PATH=$PATH:$withlibdirs
127     fi
128     export PATH
129     ;;
130 esac
131
132 # Don't load user or system prefs
133 GR_DONT_LOAD_PREFS=1
134 export GR_DONT_LOAD_PREFS
135
136 # Run everything that matches qa_*.py and return the final result.
137
138 ok=yes
139 for file in $3/qa_*.py
140 do
141   # echo $file
142   @PYTHON@ $file
143   r=$?
144   if [ $r -ne 0 ]
145   then
146     if [ $r -ge 128 ]           # killed by a signal
147     then
148       exit $r
149     fi
150     ok=no
151   fi  
152 done
153
154 if [ $ok = yes ]
155 then
156   exit 0
157 else
158   exit 1
159 fi