build: a more portable way of finding waf in makefiles
[sfrench/samba-autobuild/.git] / buildtools / testwaf.sh
1 #!/bin/bash
2
3 set -e
4 set -x
5
6 d=$(dirname $0)
7
8 cd $d/..
9 PREFIX=$HOME/testprefix
10
11 if [ $# -gt 0 ]; then
12     tests="$*"
13 else
14     tests="lib/replace lib/talloc lib/tevent lib/tdb source4/lib/ldb"
15 fi
16
17 echo "testing in dirs $tests"
18
19 for d in $tests; do
20     echo "`date`: testing $d"
21     pushd $d
22     rm -rf bin
23     type waf
24     ./autogen-waf.sh
25     waf dist
26     ./configure -C --enable-developer --prefix=$PREFIX
27     time make
28     make install
29     make distcheck
30     case $d in
31         "source4/lib/ldb")
32             ldd bin/ldbadd
33             ;;
34         "lib/replace")
35             ldd bin/replace_testsuite
36             ;;
37         "lib/talloc")
38             ldd bin/talloc_testsuite
39             ;;
40         "lib/tdb")
41             ldd bin/tdbtool
42             ;;
43     esac
44     popd
45 done
46
47 echo "testing python portability"
48 pushd lib/talloc
49 versions="python2.4 python2.5 python2.6 python3.0 python3.1"
50 for p in $versions; do
51     ret=$(which $p || echo "failed")
52     if [ $ret == "failed" ]; then
53         echo "$p not found, skipping"
54         continue
55     fi
56     echo "Testing $p"
57     $p ../../buildtools/bin/waf configure -C --enable-developer --prefix=$PREFIX
58     $p ../../buildtools/bin/waf build install
59 done
60 popd
61
62 echo "testing cross compiling"
63 pushd lib/talloc
64 ret=$(which arm-linux-gnueabi-gcc || echo "failed")
65 if [ $ret != "failed" ]; then
66     CC=arm-linux-gnueabi-gcc ./configure -C --prefix=$PREFIX  --cross-compile --cross-execute='runarm'
67     make && make install
68 else
69     echo "Cross-compiler not installed, skipping test"
70 fi
71 popd