]> git.proxmox.com Git - mirror_ovs.git/blob - tests/atlocal.in
tests: Remove redzone flag for FreeBSD 12+.
[mirror_ovs.git] / tests / atlocal.in
1 # -*- shell-script -*-
2 HAVE_OPENSSL='@HAVE_OPENSSL@'
3 HAVE_PYTHON='@HAVE_PYTHON@'
4 HAVE_PYTHON2='@HAVE_PYTHON2@'
5 HAVE_PYTHON3='@HAVE_PYTHON3@'
6 EGREP='@EGREP@'
7
8 if test x"$PYTHON" = x; then
9 PYTHON='@PYTHON@'
10 fi
11
12 if test x"$PYTHON2" = x; then
13 PYTHON2='@PYTHON2@'
14 fi
15
16 if test x"$PYTHON3" = x; then
17 PYTHON3='@PYTHON3@'
18
19 # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
20 # stderr that breaks almost any Python3 test (PEP 0538)
21 PYTHONCOERCECLOCALE=0
22 export PYTHONCOERCECLOCALE
23 fi
24
25 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
26 export PYTHONPATH
27
28 PYTHONIOENCODING=utf_8
29 export PYTHONIOENCODING
30
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
38
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.
43 #
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 ;;
51 *) non_ascii_cwd=true
52 esac
53
54 # Enable malloc debugging features.
55 case `uname` in
56 Linux)
57 MALLOC_PERTURB_=165; export MALLOC_PERTURB_
58
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 ;;
68 *) mcheck=enabled ;;
69 esac
70 if test $mcheck = enabled; then
71 MALLOC_CHECK_=2; export MALLOC_CHECK_
72 else
73 echo >&2 "glibc $glibc_version detected, disabling memory checking"
74 fi
75 ;;
76 FreeBSD)
77 case `uname -r` in
78 [789].*)
79 MALLOC_CONF=AJ
80 ;;
81 1[01].*)
82 MALLOC_CONF=abort:true,junk:true,redzone:true
83 ;;
84 *)
85 MALLOC_CONF=abort:true,junk:true
86 ;;
87 esac
88 export MALLOC_CONF
89 esac
90
91 # The name of loopback interface
92 case `uname` in
93 Linux)
94 LOOPBACK_INTERFACE=lo
95 ;;
96 FreeBSD|NetBSD)
97 LOOPBACK_INTERFACE=lo0
98 ;;
99 esac
100
101 # Check for platform.
102 case `uname` in
103 MINGW*)
104 IS_WIN32="yes"
105 IS_BSD="no"
106 ;;
107 FreeBSD|NetBSD)
108 IS_WIN32="no"
109 IS_BSD="yes"
110 ;;
111 *)
112 IS_WIN32="no"
113 IS_BSD="no"
114 ;;
115 esac
116
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
124 fi
125
126 # Check whether to run IPv6 tests.
127 $PYTHON -c '
128 import errno
129 import socket
130 import sys
131 try:
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:
135 sys.exit(2)
136 raise
137 '
138 case $? in
139 0) HAVE_IPV6=yes ;;
140 2) HAVE_IPV6=no ;;
141 *) echo "$0: unexpected error probing $PYTHON for IPv6 support" >&2 ;;
142 esac
143
144 # Look for a python L7 library 'LIB' in the system. If it is found, defines
145 # HAVE_LIB="yes", otherwise HAVE_LIB="no"
146 find_l7_lib()
147 {
148 set +x
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
153 eval ${var}="yes"
154 else
155 eval ${var}="no"
156 fi
157 else
158 eval ${var}="no"
159 fi
160 }
161
162 # HAVE_FTP
163 find_l7_lib ftp
164 # HAVE_TFTP
165 find_l7_lib tftp
166
167 # Look for a commnand in the system. If it is found, defines
168 # HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
169 find_command()
170 {
171 which $1 > /dev/null 2>&1
172 status=$?
173 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
174 if test "$status" = "0"; then
175 eval ${var}="yes"
176 else
177 eval ${var}="no"
178 fi
179 }
180
181 # Set HAVE_NC
182 find_command nc
183
184 # Determine correct netcat option to quit on stdin EOF
185 if nc --version 2>&1 | grep -q nmap.org; then
186 # Nmap netcat
187 NC_EOF_OPT="--send-only -w 5"
188 else
189 # BSD netcat
190 NC_EOF_OPT="-q 1 -w 5"
191 fi
192
193 # Set HAVE_TCPDUMP
194 find_command tcpdump
195
196 CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
197
198 # Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
199 if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
200 DIFF_SUPPORTS_NORMAL_FORMAT=yes
201 else
202 DIFF_SUPPORTS_NORMAL_FORMAT=no
203 fi
204
205 # Turn off proxies.
206 unset http_proxy
207 unset https_proxy
208 unset ftp_proxy
209 unset no_proxy
210 unset HTTP_PROXY
211 unset HTTPS_PROXY
212 unset FTP_PROXY
213 unset NO_PROXY
214
215 # Avoid OVN environment variables leaking in from external environment.
216 unset OVN_NB_DB
217 unset OVN_SB_DB
218
219 # Prevent logging to syslog during tests.
220 OVS_SYSLOG_METHOD=null
221 export OVS_SYSLOG_METHOD
222
223 # Set default timeout for control utils
224 OVS_CTL_TIMEOUT=30
225 export OVS_CTL_TIMEOUT
226
227 # Add some default flags to make the tests run better under Address
228 # Sanitizer, if it was used for the build.
229 #
230 # We disable leak detection because otherwise minor leaks that don't
231 # matter break everything.
232 ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS
233 export ASAN_OPTIONS