]> git.proxmox.com Git - ovs.git/blame - tests/atlocal.in
raft: Fix the problem of stuck in candidate role forever.
[ovs.git] / tests / atlocal.in
CommitLineData
1b233b95 1# -*- shell-script -*-
d27ce529 2HAVE_OPENSSL='@HAVE_OPENSSL@'
b291eb69 3OPENSSL_SUPPORTS_SNI='@OPENSSL_SUPPORTS_SNI@'
b291eb69 4HAVE_UNBOUND='@HAVE_UNBOUND@'
8073dd31 5EGREP='@EGREP@'
1ca0323e 6PYTHON3='@PYTHON3@'
79982e90 7
1ca0323e
BP
8# PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
9# stderr that breaks almost any Python3 test (PEP 0538)
10PYTHONCOERCECLOCALE=0
11export PYTHONCOERCECLOCALE
8fb7d026 12
e6703555 13PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
99155935 14export PYTHONPATH
be44585c
BP
15
16PYTHONIOENCODING=utf_8
17export PYTHONIOENCODING
42c2ebcd 18
e23812fc 19# PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
853d1083
BP
20# files. Creating .py[co] works OK for any given version of Open
21# vSwitch, but it causes trouble if you switch from a version with
22# foo/__init__.py into an (older) version with plain foo.py, since
23# foo/__init__.pyc will cause Python to ignore foo.py.
853d1083
BP
24PYTHONDONTWRITEBYTECODE=yes
25export PYTHONDONTWRITEBYTECODE
26
e6e590a7
BP
27# Test whether the current working directory name is all ASCII
28# characters. Some Python code doesn't tolerate non-ASCII characters
29# in filenames very well, so if the current working directory is
30# non-ASCII then we skip the tests that run those programs.
31#
32# This would be just papering over a real problem, except that the
33# tests that we skip are launched from initscripts and thus normally
34# run in system directories with ASCII names. (This problem only came
35# up at all because the Debian autobuilders do build in a top-level
36# directory named /«BUILDDIR».)
37case `pwd | tr -d ' -~'` in
38 '') non_ascii_cwd=false ;;
39 *) non_ascii_cwd=true
40esac
41
f0b87599
EM
42# Enable malloc debugging features.
43case `uname` in
44Linux)
b6137ea8
BP
45 MALLOC_PERTURB_=165; export MALLOC_PERTURB_
46
47 # Before glibc 2.11, the feature enabled by MALLOC_CHECK_ was not
48 # thread-safe. See https://bugzilla.redhat.com/show_bug.cgi?id=585674 and
49 # in particular the patch attached there, which was applied to glibc CVS as
50 # "Restore locking in free_check." between 1.11 and 1.11.1.
51 vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd
1ca0323e 52 glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
b6137ea8
BP
53 glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'`
54 case $glibc_version in
55 2.[0-9] | 2.1[01]) mcheck=disabled ;;
56 *) mcheck=enabled ;;
57 esac
58 if test $mcheck = enabled; then
59 MALLOC_CHECK_=2; export MALLOC_CHECK_
60 else
61 echo >&2 "glibc $glibc_version detected, disabling memory checking"
62 fi
f0b87599
EM
63 ;;
64FreeBSD)
65 case `uname -r` in
66 [789].*)
67 MALLOC_CONF=AJ
68 ;;
f9993a82 69 1[01].*)
f0b87599
EM
70 MALLOC_CONF=abort:true,junk:true,redzone:true
71 ;;
f9993a82
IM
72 *)
73 MALLOC_CONF=abort:true,junk:true
74 ;;
f0b87599
EM
75 esac
76 export MALLOC_CONF
77esac
9a9808d7
YT
78
79# The name of loopback interface
80case `uname` in
81Linux)
82 LOOPBACK_INTERFACE=lo
83 ;;
84FreeBSD|NetBSD)
85 LOOPBACK_INTERFACE=lo0
86 ;;
87esac
c7c1bdf3 88
d98e1498 89# Check for platform.
c7c1bdf3 90case `uname` in
760f5738 91MINGW*|MSYS*)
c7c1bdf3 92 IS_WIN32="yes"
d98e1498
PS
93 IS_BSD="no"
94 ;;
95FreeBSD|NetBSD)
96 IS_WIN32="no"
97 IS_BSD="yes"
c7c1bdf3
GS
98 ;;
99*)
100 IS_WIN32="no"
d98e1498 101 IS_BSD="no"
c7c1bdf3
GS
102 ;;
103esac
0f1e8ed0 104
1ca0323e 105if test "$IS_WIN32" = yes; then
73ac791f
AGS
106 # enables legacy windows unicode printing needed for Python3 compatibility
107 # with the Python2 tests
108 PYTHONLEGACYWINDOWSFSENCODING=true
109 export PYTHONLEGACYWINDOWSFSENCODING
110 PYTHONLEGACYWINDOWSSTDIO=true
111 export PYTHONLEGACYWINDOWSSTDIO
112fi
113
4819b3a5 114# Check whether to run IPv6 tests.
1ca0323e 115$PYTHON3 -c '
5c1d812d 116import errno
719dcfd4 117import socket
5c1d812d
BP
118import sys
119try:
120 socket.socket(family=socket.AF_INET6).bind(("::1", 0, 0, 0))
121except socket.error as e:
f7979b11 122 if e.errno == errno.EAFNOSUPPORT or errno.EADDRNOTAVAIL:
5c1d812d
BP
123 sys.exit(2)
124 raise
125'
126case $? in
127 0) HAVE_IPV6=yes ;;
128 2) HAVE_IPV6=no ;;
1ca0323e 129 *) echo "$0: unexpected error probing $PYTHON3 for IPv6 support" >&2 ;;
5c1d812d 130esac
4819b3a5 131
40e28d13
YHW
132# Look for a python L7 library 'LIB' in the system. If it is found, defines
133# HAVE_LIB="yes", otherwise HAVE_LIB="no"
40c7b2fc
JS
134find_l7_lib()
135{
136 set +x
137 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
1ca0323e
BP
138 result=$($PYTHON3 $abs_top_srcdir/tests/test-l7.py --help | grep "$1")
139 if test "x${result}" != x; then
140 eval ${var}="yes"
40c7b2fc
JS
141 else
142 eval ${var}="no"
143 fi
144}
145
40e28d13 146# HAVE_FTP
40c7b2fc 147find_l7_lib ftp
40e28d13 148# HAVE_TFTP
40c7b2fc 149find_l7_lib tftp
b54971f7 150
9c1ab985
YHW
151# Look for a commnand in the system. If it is found, defines
152# HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
ddd187f2 153find_command()
9c1ab985
YHW
154{
155 which $1 > /dev/null 2>&1
156 status=$?
157 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
158 if test "$status" = "0"; then
159 eval ${var}="yes"
160 else
161 eval ${var}="no"
162 fi
163}
164
165# Set HAVE_NC
ddd187f2 166find_command nc
9c1ab985 167
b54971f7
LR
168# Determine correct netcat option to quit on stdin EOF
169if nc --version 2>&1 | grep -q nmap.org; then
0bedb3d6 170 # Nmap netcat
46ccfadd 171 NC_EOF_OPT="--send-only -w 5"
b54971f7 172else
0bedb3d6 173 # BSD netcat
46ccfadd 174 NC_EOF_OPT="-q 1 -w 5"
b54971f7 175fi
4fee8b13 176
b020a416
DB
177# Set HAVE_TCPDUMP
178find_command tcpdump
179
253e4dc0
DM
180# Set HAVE_LFTP
181find_command lftp
182
40c7b2fc
JS
183CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
184
baee3741
BP
185# Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
186if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
187 DIFF_SUPPORTS_NORMAL_FORMAT=yes
188else
189 DIFF_SUPPORTS_NORMAL_FORMAT=no
190fi
191
4fee8b13
JR
192# Turn off proxies.
193unset http_proxy
194unset https_proxy
195unset ftp_proxy
196unset no_proxy
197unset HTTP_PROXY
198unset HTTPS_PROXY
199unset FTP_PROXY
200unset NO_PROXY
66842c00 201
e11f0c25
BP
202# Prevent logging to syslog during tests.
203OVS_SYSLOG_METHOD=null
204export OVS_SYSLOG_METHOD
9551e80b
IM
205
206# Set default timeout for control utils
207OVS_CTL_TIMEOUT=30
208export OVS_CTL_TIMEOUT
5f223e92
BP
209
210# Add some default flags to make the tests run better under Address
211# Sanitizer, if it was used for the build.
212#
213# We disable leak detection because otherwise minor leaks that don't
214# matter break everything.
215ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS
216export ASAN_OPTIONS