option-tester.sh 2.54 KB
Newer Older
1 2 3
#!/bin/sh
# keep this POSIX sh compatible. No bash-isms!
# replace |& with 2>&1 |
4 5

# This is a hack to build with various configuration options.
6
# The intent is to check building combinations that normal testing doesn't use.
7 8 9 10

# Stuff goes into various test-* directories.
# Running again starts by deleting everything in the directory.

11
# set pipefail to catch pipeline failures
12
# Unfortunately, it doesn't work on some older sh-es
13
if /bin/sh -c "set -o pipefail" 2> /dev/null
14 15 16
then
  set -o pipefail
fi
17

18 19 20 21 22 23
LINUX=""
if [ `uname -s` = "Linux" -a -f /usr/include/seccomp.h ]
then
  # Not supported on CentOS 6
  LINUX="--enable-seccomp"
fi
24 25 26 27

doit ()
{
  DIR=test-$1
28
  [ ! -d $DIR ] && mkdir $DIR
29
  rm -rf $DIR/*
30 31
  ./waf configure --out=$DIR $2 2>&1 | tee    $DIR/test.log
  WAF1=$?
32 33 34 35
  WAF2=0
  WAF3=0
  if [ "$WAF1" = 0 ]
  then
36 37 38
  echo                           2>&1    | tee -a $DIR/test.log
  ./waf build                    2>&1    | tee -a $DIR/test.log
  WAF2=$?
39 40
  if [ "$WAF2" = 0 ]
  then
41 42 43
  echo                           2>&1    | tee -a $DIR/test.log
  ./waf check                    2>&1    | tee -a $DIR/test.log
  WAF3=$?
44 45 46 47
  fi
  fi
  if [ "$WAF1" != 0 -o "$WAF2" != 0 -o "$WAF3" != 0 ] 
  then
48 49
    echo                                  2>&1   | tee -a $DIR/test.log
    echo "Trouble with $DIR"              2>&1   | tee -a $DIR/test.log
50 51 52 53 54
  fi
  echo
  echo
}

55
# no --disable-manpage on default and all
56
doit default ""
Hal Murray's avatar
Hal Murray committed
57
doit minimal "--disable-droproot --disable-mdns-registration --disable-manpage"
58

Hal Murray's avatar
Hal Murray committed
59
# This also tests refclocks without DEBUG
60
doit classic "--enable-classic-mode --refclock=all --disable-manpage"
Hal Murray's avatar
Hal Murray committed
61

62
doit all     "--enable-debug --enable-debug-gdb --enable-debug-timing --refclock=all --enable-leap-smear --enable-mssntp --enable-early-droproot $LINUX"
63

64 65
if [ "`which asciidoc 2>/dev/null`" != "" -a \
     "`which xsltproc 2>/dev/null`" != "" ]
66
then
67
doit doc     "--enable-doc --disable-manpage"
68 69
fi

70 71 72
# should try cross compile

echo
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

grep warning:                    test*/test.log
grep error:                      test*/test.log
grep "The configuration failed"  test*/test.log
grep ^Trouble                    test*/test.log
echo

echo -n "## ";  python --version
if test -n "$PYTHONPATH"
then
  echo "## PYTHONPATH is" \"$PYTHONPATH\"
fi

if ! /bin/sh -c "set -o pipefail" 2> /dev/null
then
  echo "### Old sh - no pipefail"
  echo "### We can't test for errors during build"
  echo "### You will have to scan the log files."
fi

93 94 95 96 97 98
if [ `uname -s` = "Linux" -a ! -f /usr/include/seccomp.h ]
then
    echo
    echo "### Warning: Missing seccomp.h (on a Linux system)"
    echo
fi
99 100