2 HAVE_OPENSSL='@HAVE_OPENSSL@'
3 HAVE_PYTHON='@HAVE_PYTHON@'
4 HAVE_PYTHON2='@HAVE_PYTHON2@'
5 HAVE_PYTHON3='@HAVE_PYTHON3@'
8 if test x"$PYTHON" = x; then
12 if test x"$PYTHON2" = x; then
16 if test x"$PYTHON3" = x; then
19 # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
20 # stderr that breaks almost any Python3 test (PEP 0538)
22 export PYTHONCOERCECLOCALE
25 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
28 PYTHONIOENCODING=utf_8
29 export PYTHONIOENCODING
31 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
32 # files. Creating .py[co] works OK for any given version of Open
33 # vSwitch, but it causes trouble if you switch from a version with
34 # foo/__init__.py into an (older) version with plain foo.py, since
35 # foo/__init__.pyc will cause Python to ignore foo.py.
36 PYTHONDONTWRITEBYTECODE=yes
37 export PYTHONDONTWRITEBYTECODE
39 # Test whether the current working directory name is all ASCII
40 # characters. Some Python code doesn't tolerate non-ASCII characters
41 # in filenames very well, so if the current working directory is
42 # non-ASCII then we skip the tests that run those programs.
44 # This would be just papering over a real problem, except that the
45 # tests that we skip are launched from initscripts and thus normally
46 # run in system directories with ASCII names. (This problem only came
47 # up at all because the Debian autobuilders do build in a top-level
48 # directory named /«BUILDDIR».)
49 case `pwd | tr -d ' -~'` in
50 '') non_ascii_cwd=false ;;
54 # Enable malloc debugging features.
57 MALLOC_PERTURB_=165; export MALLOC_PERTURB_
59 # Before glibc 2.11, the feature enabled by MALLOC_CHECK_ was not
60 # thread-safe. See https://bugzilla.redhat.com/show_bug.cgi?id=585674 and
61 # in particular the patch attached there, which was applied to glibc CVS as
62 # "Restore locking in free_check." between 1.11 and 1.11.1.
63 vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd
64 glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
65 glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'`
66 case $glibc_version in
67 2.[0-9] | 2.1[01]) mcheck=disabled ;;
70 if test $mcheck = enabled; then
71 MALLOC_CHECK_=2; export MALLOC_CHECK_
73 echo >&2 "glibc $glibc_version detected, disabling memory checking"
82 MALLOC_CONF=abort:true,junk:true,redzone:true
85 MALLOC_CONF=abort:true,junk:true
91 # The name of loopback interface
97 LOOPBACK_INTERFACE=lo0
101 # Check for platform.
117 if test x"$PYTHON3" != x && test "$IS_WIN32" = yes; then
118 # enables legacy windows unicode printing needed for Python3 compatibility
119 # with the Python2 tests
120 PYTHONLEGACYWINDOWSFSENCODING=true
121 export PYTHONLEGACYWINDOWSFSENCODING
122 PYTHONLEGACYWINDOWSSTDIO=true
123 export PYTHONLEGACYWINDOWSSTDIO
126 # Check whether to run IPv6 tests.
132 socket.socket(family=socket.AF_INET6).bind(("::1", 0, 0, 0))
133 except socket.error as e:
134 if e.errno == errno.EAFNOSUPPORT or errno.EADDRNOTAVAIL:
141 *) echo "$0: unexpected error probing $PYTHON for IPv6 support" >&2 ;;
144 # Look for a python L7 library 'LIB' in the system. If it is found, defines
145 # HAVE_LIB="yes", otherwise HAVE_LIB="no"
149 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
150 if test "$HAVE_PYTHON" = "yes"; then
151 result=$($PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep "$1")
152 if test "x${result}" != x; then
167 # Look for a commnand in the system. If it is found, defines
168 # HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
171 which $1 > /dev/null 2>&1
173 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
174 if test "$status" = "0"; then
184 # Determine correct netcat option to quit on stdin EOF
185 if nc --version 2>&1 | grep -q nmap.org; then
187 NC_EOF_OPT="--send-only -w 5"
190 NC_EOF_OPT="-q 1 -w 5"
199 CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
201 # Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
202 if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
203 DIFF_SUPPORTS_NORMAL_FORMAT=yes
205 DIFF_SUPPORTS_NORMAL_FORMAT=no
218 # Avoid OVN environment variables leaking in from external environment.
222 # Prevent logging to syslog during tests.
223 OVS_SYSLOG_METHOD=null
224 export OVS_SYSLOG_METHOD
226 # Set default timeout for control utils
228 export OVS_CTL_TIMEOUT
230 # Add some default flags to make the tests run better under Address
231 # Sanitizer, if it was used for the build.
233 # We disable leak detection because otherwise minor leaks that don't
234 # matter break everything.
235 ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS