2a163dbb8ef7ed934a6dd366aedd62ee71e63fa1
[cascardo/ovs.git] / tests / atlocal.in
1 # -*- shell-script -*-
2 HAVE_OPENSSL='@HAVE_OPENSSL@'
3 HAVE_PYTHON='@HAVE_PYTHON@'
4 EGREP='@EGREP@'
5 PERL='@PERL@'
6
7 if test x"$PYTHON" = x; then
8     PYTHON='@PYTHON@'
9 fi
10
11 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
12 export PYTHONPATH
13
14 PYTHONIOENCODING=utf_8
15 export PYTHONIOENCODING
16
17 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
18 # files.  Creating .py[co] works OK for any given version of Open
19 # vSwitch, but it causes trouble if you switch from a version with
20 # foo/__init__.py into an (older) version with plain foo.py, since
21 # foo/__init__.pyc will cause Python to ignore foo.py.
22 PYTHONDONTWRITEBYTECODE=yes
23 export PYTHONDONTWRITEBYTECODE
24
25 # Test whether the current working directory name is all ASCII
26 # characters.  Some Python code doesn't tolerate non-ASCII characters
27 # in filenames very well, so if the current working directory is
28 # non-ASCII then we skip the tests that run those programs.
29 #
30 # This would be just papering over a real problem, except that the
31 # tests that we skip are launched from initscripts and thus normally
32 # run in system directories with ASCII names.  (This problem only came
33 # up at all because the Debian autobuilders do build in a top-level
34 # directory named /«BUILDDIR».)
35 case `pwd | tr -d ' -~'` in
36     '') non_ascii_cwd=false ;;
37     *) non_ascii_cwd=true
38 esac
39
40 # Enable malloc debugging features.
41 case `uname` in
42 Linux)
43     MALLOC_PERTURB_=165; export MALLOC_PERTURB_
44
45     # Before glibc 2.11, the feature enabled by MALLOC_CHECK_ was not
46     # thread-safe.  See https://bugzilla.redhat.com/show_bug.cgi?id=585674 and
47     # in particular the patch attached there, which was applied to glibc CVS as
48     # "Restore locking in free_check." between 1.11 and 1.11.1.
49     vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd
50     glibc=`ldd $vswitchd | sed -n 's/^  libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
51     glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'`
52     case $glibc_version in
53         2.[0-9] | 2.1[01]) mcheck=disabled ;;
54         *) mcheck=enabled ;;
55     esac
56     if test $mcheck = enabled; then
57         MALLOC_CHECK_=2; export MALLOC_CHECK_
58     else
59         echo >&2 "glibc $glibc_version detected, disabling memory checking"
60     fi
61     ;;
62 FreeBSD)
63     case `uname -r` in
64     [789].*)
65         MALLOC_CONF=AJ
66         ;;
67     *)
68         MALLOC_CONF=abort:true,junk:true,redzone:true
69         ;;
70     esac
71     export MALLOC_CONF
72 esac
73
74 # The name of loopback interface 
75 case `uname` in
76 Linux)
77     LOOPBACK_INTERFACE=lo
78     ;;
79 FreeBSD|NetBSD)
80     LOOPBACK_INTERFACE=lo0
81     ;;
82 esac
83
84 # Check for platform.
85 case `uname` in
86 MINGW*)
87     IS_WIN32="yes"
88     IS_BSD="no"
89     ;;
90 FreeBSD|NetBSD)
91     IS_WIN32="no"
92     IS_BSD="yes"
93     ;;
94 *)
95     IS_WIN32="no"
96     IS_BSD="no"
97     ;;
98 esac
99
100 # Check whether to run IPv6 tests.
101 if perl -e 'use Socket; socket(FH, PF_INET6, SOCK_STREAM, 0) || exit 1;'; then
102     HAVE_IPV6=yes
103 else
104     HAVE_IPV6=no
105 fi
106
107 # XXX: Disable Python related tests on Windows because Open vSwitch code
108 # written in Python has not been ported to the Windows platform. We will
109 # need to remove the next block after porting is complete.
110 if test "$IS_WIN32" = "yes"; then
111     HAVE_PYTHON="no"
112 fi
113
114 if test "$HAVE_PYTHON" = "yes" \
115    && test "x`$PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep 'ftp'`" != x; then
116     HAVE_PYFTPDLIB="yes"
117 else
118     HAVE_PYFTPDLIB="no"
119 fi
120
121 # Determine correct netcat option to quit on stdin EOF
122 if nc --version 2>&1 | grep -q nmap.org; then
123     NC_EOF_OPT="--send-only"
124 else
125     NC_EOF_OPT="-q 1"
126 fi