]> git.proxmox.com Git - mirror_ovs.git/blob - tests/atlocal.in
tests/atlocal.in: Add check for aarch64 Architecture
[mirror_ovs.git] / tests / atlocal.in
1 # -*- shell-script -*-
2 HAVE_OPENSSL='@HAVE_OPENSSL@'
3 OPENSSL_SUPPORTS_SNI='@OPENSSL_SUPPORTS_SNI@'
4 HAVE_UNBOUND='@HAVE_UNBOUND@'
5 EGREP='@EGREP@'
6 PYTHON3='@PYTHON3@'
7
8 # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
9 # stderr that breaks almost any Python3 test (PEP 0538)
10 PYTHONCOERCECLOCALE=0
11 export PYTHONCOERCECLOCALE
12
13 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
14 export PYTHONPATH
15
16 PYTHONIOENCODING=utf_8
17 export PYTHONIOENCODING
18
19 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
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.
24 PYTHONDONTWRITEBYTECODE=yes
25 export PYTHONDONTWRITEBYTECODE
26
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».)
37 case `pwd | tr -d ' -~'` in
38 '') non_ascii_cwd=false ;;
39 *) non_ascii_cwd=true
40 esac
41
42 # Enable malloc debugging features.
43 case `uname` in
44 Linux)
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
52 glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
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
63 ;;
64 FreeBSD)
65 case `uname -r` in
66 [789].*)
67 MALLOC_CONF=AJ
68 ;;
69 1[01].*)
70 MALLOC_CONF=abort:true,junk:true,redzone:true
71 ;;
72 *)
73 MALLOC_CONF=abort:true,junk:true
74 ;;
75 esac
76 export MALLOC_CONF
77 esac
78
79 # The name of loopback interface
80 case `uname` in
81 Linux)
82 LOOPBACK_INTERFACE=lo
83 ;;
84 FreeBSD|NetBSD)
85 LOOPBACK_INTERFACE=lo0
86 ;;
87 esac
88
89 # Check for platform.
90 case `uname` in
91 MINGW*|MSYS*)
92 IS_WIN32="yes"
93 IS_BSD="no"
94 ;;
95 FreeBSD|NetBSD)
96 IS_WIN32="no"
97 IS_BSD="yes"
98 ;;
99 *)
100 IS_WIN32="no"
101 IS_BSD="no"
102 ;;
103 esac
104
105 if test "$IS_WIN32" = yes; then
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
112 fi
113
114 # Check for CPU architecture
115 case `uname -m` in
116 aarch64)
117 IS_ARM64="yes"
118 ;;
119 *)
120 IS_ARM64="no"
121 ;;
122 esac
123
124 # Check whether to run IPv6 tests.
125 $PYTHON3 -c '
126 import errno
127 import socket
128 import sys
129 try:
130 socket.socket(family=socket.AF_INET6).bind(("::1", 0, 0, 0))
131 except socket.error as e:
132 if e.errno == errno.EAFNOSUPPORT or errno.EADDRNOTAVAIL:
133 sys.exit(2)
134 raise
135 '
136 case $? in
137 0) HAVE_IPV6=yes ;;
138 2) HAVE_IPV6=no ;;
139 *) echo "$0: unexpected error probing $PYTHON3 for IPv6 support" >&2 ;;
140 esac
141
142 # Look for a python L7 library 'LIB' in the system. If it is found, defines
143 # HAVE_LIB="yes", otherwise HAVE_LIB="no"
144 find_l7_lib()
145 {
146 set +x
147 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
148 result=$($PYTHON3 $abs_top_srcdir/tests/test-l7.py --help | grep "$1")
149 if test "x${result}" != x; then
150 eval ${var}="yes"
151 else
152 eval ${var}="no"
153 fi
154 }
155
156 # HAVE_FTP
157 find_l7_lib ftp
158 # HAVE_TFTP
159 find_l7_lib tftp
160
161 # Look for a commnand in the system. If it is found, defines
162 # HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
163 find_command()
164 {
165 which $1 > /dev/null 2>&1
166 status=$?
167 var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
168 if test "$status" = "0"; then
169 eval ${var}="yes"
170 else
171 eval ${var}="no"
172 fi
173 }
174
175 # Set HAVE_NC
176 find_command nc
177
178 # Determine correct netcat option to quit on stdin EOF
179 if nc --version 2>&1 | grep -q nmap.org; then
180 # Nmap netcat
181 NC_EOF_OPT="--send-only -w 5"
182 else
183 # BSD netcat
184 NC_EOF_OPT="-q 1 -w 5"
185 fi
186
187 # Set HAVE_TCPDUMP
188 find_command tcpdump
189
190 # Set HAVE_LFTP
191 find_command lftp
192
193 CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
194
195 # Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
196 if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
197 DIFF_SUPPORTS_NORMAL_FORMAT=yes
198 else
199 DIFF_SUPPORTS_NORMAL_FORMAT=no
200 fi
201
202 # Turn off proxies.
203 unset http_proxy
204 unset https_proxy
205 unset ftp_proxy
206 unset no_proxy
207 unset HTTP_PROXY
208 unset HTTPS_PROXY
209 unset FTP_PROXY
210 unset NO_PROXY
211
212 # Prevent logging to syslog during tests.
213 OVS_SYSLOG_METHOD=null
214 export OVS_SYSLOG_METHOD
215
216 # Set default timeout for control utils
217 OVS_CTL_TIMEOUT=30
218 export OVS_CTL_TIMEOUT
219
220 # Add some default flags to make the tests run better under Address
221 # Sanitizer, if it was used for the build.
222 #
223 # We disable leak detection because otherwise minor leaks that don't
224 # matter break everything.
225 ASAN_OPTIONS=detect_leaks=0:abort_on_error=true:log_path=asan:$ASAN_OPTIONS
226 export ASAN_OPTIONS