Merged r7478:7608 from michaelld/t186 into trunk. Adds ability to compile GNU Radio...
[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 # Where to find my swig generated shared library
14 mylibdir=$2/src:$2/src/.libs:$2/src/lib:$2/src/lib/.libs
15
16 # Where to find my swig generated python module
17 mysrcdir=$1/src:$1/src/lib
18
19 # Where to find my hand written python modules
20 mypydir=$1/src:$1/src/python
21
22 # Where to find core's swig generated shared libraries,
23 # and hand generated swig glue
24 grswigdir=@gnuradio_core_SWIGDIRPATH@
25
26 # Where to find core's python modules
27 grpydir=@gnuradio_core_PYDIRPATH@
28
29 # Construct search path for python modules, if each exists
30 for dir in $grswigdir $grpydir
31 do
32     if [ "$dir" != "" ]
33     then
34         if [ "$PYTHONPATH" = "" ]
35         then
36             PYTHONPATH="$dir"
37         else
38             PYTHONPATH="$dir:$PYTHONPATH"
39         fi
40     fi
41 done
42
43 # Where to find pre-installed python modules
44 withpydirs=@with_PYDIRPATH@
45
46 # Add the 'with' dirs to the end of the python search path, if it exists
47 if [ "$withpydirs" != "" ]
48 then
49     PYTHONPATH="$PYTHONPATH:$withpydirs"
50 fi
51
52 # Add the "my" dirs to the absolute front of the python search path
53 PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$PYTHONPATH"
54 export PYTHONPATH
55
56 # Where to find omnithread library files
57 gromnidir=@omnithread_LIBDIRPATH@
58
59 # Where to find gnuradio core's library files
60 grcoredir=@gnuradio_core_LIBDIRPATH@
61
62 # Construct search path for python modules
63 # Check each one to make sure it's not "" before adding
64 grlibdir=""
65 for dir in $gromnidir $grcoredir
66 do
67     if [ "$dir" != "" ]
68     then
69         if [ "$grlibdir" = "" ]
70         then
71             grlibdir="$dir"
72         else
73             grlibdir="$dir:$grlibdir"
74         fi
75     fi
76 done
77
78 # Add the grlibdir paths to the front of any PATH variable
79 if [ "$grlibdir" != "" ]
80 then
81     # For OS/X
82     if [ "$DYLD_LIBRARY_PATH" = "" ]
83     then
84         DYLD_LIBRARY_PATH=$grlibdir
85     else
86         DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
87     fi
88
89     # For Win32
90     if [ "$PATH" = "" ]
91     then
92         PATH=$grlibdir
93     else
94         PATH=$grlibdir:$PATH
95     fi
96 fi
97
98 # Where to find pre-installed libraries
99 withlibdirs=@with_LIBDIRPATH@
100
101 # Add the withdirs paths to the end of any PATH variable
102 if [ "$withlibdirs" != "" ]
103 then
104     # For OS/X
105     if [ "$DYLD_LIBRARY_PATH" = "" ]
106     then
107         DYLD_LIBRARY_PATH=$withlibdirs
108     else
109         DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$withlibdirs
110     fi
111
112     # For Win32
113     if [ "$PATH" = "" ]
114     then
115         PATH=$withlibdirs
116     else
117         PATH=$PATH:$withlibdirs
118     fi
119 fi
120
121 export DYLD_LIBRARY_PATH
122
123 # Don't load user or system prefs
124 GR_DONT_LOAD_PREFS=1
125 export GR_DONT_LOAD_PREFS
126
127 # Run everything that matches qa_*.py and return the final result.
128
129 ok=yes
130 for file in $3/qa_*.py
131 do
132   if ! @PYTHON@ $file
133   then
134     ok=no
135   fi  
136 done
137
138 if [ $ok = yes ]
139 then
140   exit 0
141 else
142   exit 1
143 fi