howto: fix make check for win32, darwin (untested)
[debian/gnuradio] / gr-howto-write-a-block / python / run_tests.in
1 #!/bin/sh
2
3 # All this strange PYTHONPATH manipulation is required to run our
4 # tests using our just built shared library and swig-generated python
5 # code prior to installation.
6
7 # build tree == src tree unless you're doing a VPATH build.  
8 # If you don't know what a VPATH build is, you're not doing one.  Relax...
9
10 prefix=@prefix@
11 exec_prefix=@exec_prefix@
12
13 # Where to look in the build tree for our shared library
14 libbld=@abs_top_builddir@/lib
15 # Where to look in the build tree for swig generated python code
16 libswig=@abs_top_builddir@/swig
17 # Where to look in the src tree for hand written python code
18 py=@abs_top_srcdir@/python
19
20 # Where to look for installed GNU Radio python modules
21 # FIXME this is wrong on a distcheck.  We really need to ask gnuradio-core
22 # where it put its python files.
23 installed_pythondir=@pythondir@
24 installed_pyexecdir=@pyexecdir@
25
26 PYTHONPATH="$libbld:$libbld/.libs:$libswig:$libswig/.libs:$py:$installed_pythondir:$installed_pyexecdir:$PYTHONPATH"
27 echo $PYTHONPATH
28
29 export PYTHONPATH
30
31 case "@host_os@" in
32   darwin*)
33     # FIXME: Code for Darwin guessed but not tested
34     # Special Code for executing on Darwin / Mac OS X only
35     if [ "$DYLD_LIBRARY_PATH" = "" ]
36     then
37         DYLD_LIBRARY_PATH=$libbld/.libs
38     else
39         DYLD_LIBRARY_PATH=$libbld/.libs:$DYLD_LIBRARY_PATH
40     fi
41     export DYLD_LIBRARY_PATH
42     ;;
43   cygwin*|win*|mingw*)
44     # Special Code for executing on Win32 variants only
45     if [ "$PATH" = "" ]
46     then
47         PATH=$libbld/.libs
48     else
49         PATH=$libbld/.libs:$PATH
50     fi
51     export PATH
52     ;;
53 esac
54
55 #
56 # This is the simple part...
57 # Run everything that matches qa_*.py and return the final result.
58 #
59
60 ok=yes
61 for file in @srcdir@/qa_*.py
62 do
63   if ! $file
64   then
65     ok=no
66   fi  
67 done
68
69 if [ $ok = yes ]
70 then
71   exit 0
72 else
73   exit 1
74 fi