Fixes units of pen in frequency plot.
[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 omnithread library files
60 gromnidir=@omnithread_LIBDIRPATH@
61
62 # Where to find gruel library files
63 grueldir=@gruel_LIBDIRPATH@
64
65 # Where to find gnuradio core's library files
66 grcoredir=@gnuradio_core_LIBDIRPATH@
67
68 # Construct search path for python modules
69 # Check each one to make sure it's not "" before adding
70 grlibdir=""
71 for dir in $gromnidir $grcoredir $grueldir
72 do
73     if [ "$dir" != "" ]
74     then
75         if [ "$grlibdir" = "" ]
76         then
77             grlibdir="$dir"
78         else
79             grlibdir="$dir:$grlibdir"
80         fi
81     fi
82 done
83
84 # Add 'mylibdir' to the start of the library load path, to get local
85 # (to this component) created libraries
86
87 # Where to find pre-installed libraries
88 withlibdirs=@with_LIBDIRPATH@
89
90 case "@host_os@" in
91   darwin*)
92     # Special Code for executing on Darwin / Mac OS X only
93     if [ "$DYLD_LIBRARY_PATH" = "" ]
94     then
95         DYLD_LIBRARY_PATH=$mylibdir
96     else
97         DYLD_LIBRARY_PATH=$mylibdir:$DYLD_LIBRARY_PATH
98     fi
99     # DYLD_LIBRARY_PATH will not be empty now
100     # Add the grlibdir paths to the front of any library load variable
101     if [ "$grlibdir" != "" ]
102     then
103         DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
104     fi
105     # Add the withdirs paths to the end of any library load variable
106     if [ "$withlibdirs" != "" ]
107     then
108         DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$withlibdirs
109     fi
110     export DYLD_LIBRARY_PATH
111     ;;
112   cygwin*|win*|mingw*)
113     # Special Code for executing on Win32 variants only
114     if [ "$PATH" = "" ]
115     then
116         PATH=$mylibdir
117     else
118         PATH=$mylibdir:$PATH
119     fi
120     # PATH will not be empty now
121     # Add the grlibdir paths to the front of any library load variable
122     if [ "$grlibdir" != "" ]
123     then
124         PATH=$grlibdir:$PATH
125     fi
126     # Add the withdirs paths to the end of any library load variable
127     if [ "$withlibdirs" != "" ]
128     then
129         PATH=$PATH:$withlibdirs
130     fi
131     export PATH
132     ;;
133 esac
134
135 # Don't load user or system prefs
136 GR_DONT_LOAD_PREFS=1
137 export GR_DONT_LOAD_PREFS
138
139 # Run everything that matches qa_*.py and return the final result.
140
141 ok=yes
142 for file in $3/qa_*.py
143 do
144   # echo $file
145   @PYTHON@ $file
146   r=$?
147   if [ $r -ne 0 ]
148   then
149     if [ $r -ge 128 ]           # killed by a signal
150     then
151       exit $r
152     fi
153     ok=no
154   fi  
155 done
156
157 if [ $ok = yes ]
158 then
159   exit 0
160 else
161   exit 1
162 fi