Add test_suite function.
[amitay/build-farm.git] / generic.fns
1 per_run_hook
2
3 global_lock
4
5 system=`uname`
6
7 ENVCFLAGS=$CFLAGS
8 cur_compiler_sum=""
9 last_compiler_sum=""
10
11 if [ "x$compilers" = "x" ]; then
12         compilers="gcc cc icc"
13 fi
14
15 for compiler in gcc cc icc; do
16
17   # arrgh, "which" gives no err code on solaris
18   path=`which $compiler`
19   if [ -x "$path" ]; then
20
21     # We do not want to build with the same compiler twice
22     # cc is a symlink to gcc on some systems
23     cur_compiler_sum="`sum $path | sed 's/ .*//'`"
24     test x"$cur_compiler_sum" = x"" && {
25        cur_compiler_sum="$path"
26     }
27     test x"$last_compiler_sum" = x"$cur_compiler_sum" && {
28        continue;
29     }
30     last_compiler_sum="$cur_compiler_sum"
31
32     if $compiler -v 2>&1 | grep gcc.version > /dev/null; then
33        isgcc=1
34        CFLAGS="$ENVCFLAGS -Wall -g"
35     else
36        isgcc=0
37        CFLAGS="$ENVCFLAGS -g"
38     fi
39
40     CFLAGS_THIS_COMPILER=`eval CFLAGS_$compiler 2>/dev/null`
41     if [ $? = 0 ] ; then
42         CFLAGS="$CFLAGS_THIS_COMPILER $CFLAGS"
43     fi
44     export CFLAGS
45
46     TDB_NO_FSYNC=1
47     export TDB_NO_FSYNC
48     test_tree samba_4_0_test source4 $compiler
49     TDB_NO_FSYNC=0
50     export TDB_NO_FSYNC
51
52     if [ $compiler = gcc -o $isgcc = 0 ]; then
53       . common.fns
54       test_tree lorikeet-heimdal . $compiler
55
56       # only attempt samba-gtk if we have perl and gtk+-2.0
57       if which perl > /dev/null && which pkg-config > /dev/null && pkg-config --exists gtk+-2.0; then
58         test_tree samba-gtk . $compiler
59       fi
60
61       TDB_NO_FSYNC=1
62       export TDB_NO_FSYNC
63       test_tree samba_3_current source $compiler
64       test_tree samba_3_next source $compiler
65       test_tree samba_3_master source $compiler
66       TDB_NO_FSYNC=0
67       export TDB_NO_FSYNC
68
69       # by default build ppp only on SunOS or Linux systems
70       if [ "$system" = Linux -o "$system" = SunOS ]; then
71          test_tree ppp . $compiler
72       fi
73     fi
74   fi
75 done
76
77 # only attempt pidl if we have perl
78 if which perl > /dev/null; then
79   test_tree pidl . cc
80 fi
81
82 global_unlock