]>
Commit | Line | Data |
---|---|---|
1b233b95 | 1 | # -*- shell-script -*- |
d27ce529 | 2 | HAVE_OPENSSL='@HAVE_OPENSSL@' |
05b3c97b | 3 | HAVE_PYTHON='@HAVE_PYTHON@' |
8fb7d026 | 4 | HAVE_PYTHON3='@HAVE_PYTHON3@' |
8073dd31 | 5 | EGREP='@EGREP@' |
79982e90 EJ |
6 | |
7 | if test x"$PYTHON" = x; then | |
8 | PYTHON='@PYTHON@' | |
9 | fi | |
99155935 | 10 | |
8fb7d026 RB |
11 | if test x"$PYTHON3" = x; then |
12 | PYTHON3='@PYTHON3@' | |
5cf6c71b TR |
13 | |
14 | # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on | |
15 | # stderr that breaks almost any Python3 test (PEP 0538) | |
16 | PYTHONCOERCECLOCALE=0 | |
17 | export PYTHONCOERCECLOCALE | |
8fb7d026 RB |
18 | fi |
19 | ||
67e96a5d | 20 | PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH |
99155935 | 21 | export PYTHONPATH |
be44585c BP |
22 | |
23 | PYTHONIOENCODING=utf_8 | |
24 | export PYTHONIOENCODING | |
42c2ebcd | 25 | |
e23812fc | 26 | # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo |
853d1083 BP |
27 | # files. Creating .py[co] works OK for any given version of Open |
28 | # vSwitch, but it causes trouble if you switch from a version with | |
29 | # foo/__init__.py into an (older) version with plain foo.py, since | |
30 | # foo/__init__.pyc will cause Python to ignore foo.py. | |
853d1083 BP |
31 | PYTHONDONTWRITEBYTECODE=yes |
32 | export PYTHONDONTWRITEBYTECODE | |
33 | ||
e6e590a7 BP |
34 | # Test whether the current working directory name is all ASCII |
35 | # characters. Some Python code doesn't tolerate non-ASCII characters | |
36 | # in filenames very well, so if the current working directory is | |
37 | # non-ASCII then we skip the tests that run those programs. | |
38 | # | |
39 | # This would be just papering over a real problem, except that the | |
40 | # tests that we skip are launched from initscripts and thus normally | |
41 | # run in system directories with ASCII names. (This problem only came | |
42 | # up at all because the Debian autobuilders do build in a top-level | |
43 | # directory named /«BUILDDIR».) | |
44 | case `pwd | tr -d ' -~'` in | |
45 | '') non_ascii_cwd=false ;; | |
46 | *) non_ascii_cwd=true | |
47 | esac | |
48 | ||
f0b87599 EM |
49 | # Enable malloc debugging features. |
50 | case `uname` in | |
51 | Linux) | |
b6137ea8 BP |
52 | MALLOC_PERTURB_=165; export MALLOC_PERTURB_ |
53 | ||
54 | # Before glibc 2.11, the feature enabled by MALLOC_CHECK_ was not | |
55 | # thread-safe. See https://bugzilla.redhat.com/show_bug.cgi?id=585674 and | |
56 | # in particular the patch attached there, which was applied to glibc CVS as | |
57 | # "Restore locking in free_check." between 1.11 and 1.11.1. | |
58 | vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd | |
59 | glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'` | |
60 | glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'` | |
61 | case $glibc_version in | |
62 | 2.[0-9] | 2.1[01]) mcheck=disabled ;; | |
63 | *) mcheck=enabled ;; | |
64 | esac | |
65 | if test $mcheck = enabled; then | |
66 | MALLOC_CHECK_=2; export MALLOC_CHECK_ | |
67 | else | |
68 | echo >&2 "glibc $glibc_version detected, disabling memory checking" | |
69 | fi | |
f0b87599 EM |
70 | ;; |
71 | FreeBSD) | |
72 | case `uname -r` in | |
73 | [789].*) | |
74 | MALLOC_CONF=AJ | |
75 | ;; | |
76 | *) | |
77 | MALLOC_CONF=abort:true,junk:true,redzone:true | |
78 | ;; | |
79 | esac | |
80 | export MALLOC_CONF | |
81 | esac | |
9a9808d7 YT |
82 | |
83 | # The name of loopback interface | |
84 | case `uname` in | |
85 | Linux) | |
86 | LOOPBACK_INTERFACE=lo | |
87 | ;; | |
88 | FreeBSD|NetBSD) | |
89 | LOOPBACK_INTERFACE=lo0 | |
90 | ;; | |
91 | esac | |
c7c1bdf3 | 92 | |
d98e1498 | 93 | # Check for platform. |
c7c1bdf3 GS |
94 | case `uname` in |
95 | MINGW*) | |
96 | IS_WIN32="yes" | |
d98e1498 PS |
97 | IS_BSD="no" |
98 | ;; | |
99 | FreeBSD|NetBSD) | |
100 | IS_WIN32="no" | |
101 | IS_BSD="yes" | |
c7c1bdf3 GS |
102 | ;; |
103 | *) | |
104 | IS_WIN32="no" | |
d98e1498 | 105 | IS_BSD="no" |
c7c1bdf3 GS |
106 | ;; |
107 | esac | |
0f1e8ed0 | 108 | |
4819b3a5 | 109 | # Check whether to run IPv6 tests. |
719dcfd4 BP |
110 | if $PYTHON -c ' |
111 | import socket | |
112 | socket.socket(family=socket.AF_INET6).bind(("::1", 0, 0, 0)) | |
1f3c6b2d | 113 | '; then |
4819b3a5 BP |
114 | HAVE_IPV6=yes |
115 | else | |
116 | HAVE_IPV6=no | |
117 | fi | |
118 | ||
40e28d13 YHW |
119 | # Look for a python L7 library 'LIB' in the system. If it is found, defines |
120 | # HAVE_LIB="yes", otherwise HAVE_LIB="no" | |
40c7b2fc JS |
121 | find_l7_lib() |
122 | { | |
123 | set +x | |
124 | var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'` | |
125 | if test "$HAVE_PYTHON" = "yes"; then | |
126 | result=$($PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep "$1") | |
127 | if test "x${result}" != x; then | |
128 | eval ${var}="yes" | |
129 | else | |
130 | eval ${var}="no" | |
131 | fi | |
132 | else | |
133 | eval ${var}="no" | |
134 | fi | |
135 | } | |
136 | ||
40e28d13 | 137 | # HAVE_FTP |
40c7b2fc | 138 | find_l7_lib ftp |
40e28d13 | 139 | # HAVE_TFTP |
40c7b2fc | 140 | find_l7_lib tftp |
b54971f7 | 141 | |
9c1ab985 YHW |
142 | # Look for a commnand in the system. If it is found, defines |
143 | # HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no". | |
ddd187f2 | 144 | find_command() |
9c1ab985 YHW |
145 | { |
146 | which $1 > /dev/null 2>&1 | |
147 | status=$? | |
148 | var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'` | |
149 | if test "$status" = "0"; then | |
150 | eval ${var}="yes" | |
151 | else | |
152 | eval ${var}="no" | |
153 | fi | |
154 | } | |
155 | ||
156 | # Set HAVE_NC | |
ddd187f2 | 157 | find_command nc |
9c1ab985 | 158 | |
b54971f7 LR |
159 | # Determine correct netcat option to quit on stdin EOF |
160 | if nc --version 2>&1 | grep -q nmap.org; then | |
0bedb3d6 | 161 | # Nmap netcat |
46ccfadd | 162 | NC_EOF_OPT="--send-only -w 5" |
b54971f7 | 163 | else |
0bedb3d6 | 164 | # BSD netcat |
46ccfadd | 165 | NC_EOF_OPT="-q 1 -w 5" |
b54971f7 | 166 | fi |
4fee8b13 | 167 | |
b020a416 DB |
168 | # Set HAVE_TCPDUMP |
169 | find_command tcpdump | |
170 | ||
40c7b2fc JS |
171 | CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1" |
172 | ||
4fee8b13 JR |
173 | # Turn off proxies. |
174 | unset http_proxy | |
175 | unset https_proxy | |
176 | unset ftp_proxy | |
177 | unset no_proxy | |
178 | unset HTTP_PROXY | |
179 | unset HTTPS_PROXY | |
180 | unset FTP_PROXY | |
181 | unset NO_PROXY |