]> mj.ucw.cz Git - libucw.git/blob - debug/check-configs
Logging: Use log_set_default_stream().
[libucw.git] / debug / check-configs
1 #!/bin/bash
2 # A script for testing compilability of different configurations
3 # (c) 2004--2010 Martin Mares <mj@ucw.cz>
4
5 set -e
6
7 TEST=0
8 ERR=
9 CC=${CC:-gcc}
10 MAKEOPTS=${MAKEOPTS:--j8}
11
12 function die
13 {
14         echo >&3 "      $@"
15         exit 1
16 }
17
18 function try
19 {
20         TEST=$(($TEST+1))
21         TDIR=tests/$TEST
22         mkdir $TDIR
23         echo "### Test $TEST: $@ ###" | tee $TDIR/log
24         CONFIG="$1"
25         shift
26         ARGS="$@ CC=$CC"
27
28         (
29                 cd $TDIR
30                 exec 3>&2 >>log 2>&1
31                 case $CONFIG in
32                         *)                      ../../configure $CONFIG $ARGS || die "CANNOT CONFIGURE"
33                                                 ;;
34                 esac
35                 make $MAKEOPTS || die FAILED
36                 echo >&3 "      COMPILATION PASSED"
37                 if [ -z "$SKIP_TESTS" ] ; then
38                         make -k tests || die "TESTS FAILED"
39                         echo >&3 "      TESTS PASSED"
40                 fi
41         ) || ERR=1
42 }
43
44 rm -rf tests
45 mkdir tests
46 if [ "$1" == DARWIN ] ; then
47         # All tests on Darwin need CONFIG_SHARED, due to libcharset collision
48         # only visible with static linking.
49         FLAGS="CONFIG_SHARED"
50         try debug/default.cfg $FLAGS CONFIG_PCRE                                        # `make tests' does not work with non-local builds with shared libs
51 elif [ -n "$1" ] ; then
52         try "$@"
53 else
54         try default.cfg CONFIG_LOCAL
55         try debug/default.cfg                                                           # debugging configuration
56         try debug/default.cfg -CONFIG_THREADS                                           # non-threaded configuration
57         try debug/default.cfg -CONFIG_UCW_TLS                                           # threaded, but no TLS support in gcc
58         try debug/default.cfg -CONFIG_EPOLL                                             # without epoll
59 fi
60
61 [ -z "$ERR" ]