Merged build_config branch into trunk:
[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 'mylibdir' to the start of the library load path, to get local
79 # (to this component) created libraries
80
81 # Where to find pre-installed libraries
82 withlibdirs=@with_LIBDIRPATH@
83
84 case "@host_os@" in
85   darwin*)
86     # Special Code for executing on Darwin / Mac OS X only
87     if [ "$DYLD_LIBRARY_PATH" = "" ]
88     then
89         DYLD_LIBRARY_PATH=$mylibdir
90     else
91         DYLD_LIBRARY_PATH=$mylibdir:$DYLD_LIBRARY_PATH
92     fi
93     # DYLD_LIBRARY_PATH will not be empty now
94     # Add the grlibdir paths to the front of any library load variable
95     if [ "$grlibdir" != "" ]
96     then
97         DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
98     fi
99     # Add the withdirs paths to the end of any library load variable
100     if [ "$withlibdirs" != "" ]
101     then
102         DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$withlibdirs
103     fi
104     export DYLD_LIBRARY_PATH
105     ;;
106   cygwin*|win*|mingw*)
107     # Special Code for executing on Win32 variants only
108     if [ "$PATH" = "" ]
109     then
110         PATH=$mylibdir
111     else
112         PATH=$mylibdir:$PATH
113     fi
114     # PATH will not be empty now
115     # Add the grlibdir paths to the front of any library load variable
116     if [ "$grlibdir" != "" ]
117     then
118         PATH=$grlibdir:$PATH
119     fi
120     # Add the withdirs paths to the end of any library load variable
121     if [ "$withlibdirs" != "" ]
122     then
123         PATH=$PATH:$withlibdirs
124     fi
125     export PATH
126     ;;
127 esac
128
129 # Don't load user or system prefs
130 GR_DONT_LOAD_PREFS=1
131 export GR_DONT_LOAD_PREFS
132
133 # Run everything that matches qa_*.py and return the final result.
134
135 ok=yes
136 for file in $3/qa_*.py
137 do
138   if ! @PYTHON@ $file
139   then
140     ok=no
141   fi  
142 done
143
144 if [ $ok = yes ]
145 then
146   exit 0
147 else
148   exit 1
149 fi