]> git.proxmox.com Git - mirror_ovs.git/blob - tests/atlocal.in
tests: Skip tests that need "normal" diff if not available.
[mirror_ovs.git] / tests / atlocal.in
1 # -*- shell-script -*-
2 HAVE_OPENSSL='@HAVE_OPENSSL@'
3 HAVE_PYTHON='@HAVE_PYTHON@'
4 HAVE_PYTHON3='@HAVE_PYTHON3@'
5 EGREP='@EGREP@'
6
7 if test x"$PYTHON" = x; then
8 PYTHON='@PYTHON@'
9 fi
10
11 if test x"$PYTHON3" = x; then
12 PYTHON3='@PYTHON3@'
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
18 fi
19
20 PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
21 export PYTHONPATH
22
23 PYTHONIOENCODING=utf_8
24 export PYTHONIOENCODING
25
26 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
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.
31 PYTHONDONTWRITEBYTECODE=yes
32 export PYTHONDONTWRITEBYTECODE
33
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
49 # Enable malloc debugging features.
50 case `uname` in
51 Linux)
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
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
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
92
93 # Check for platform.
94 case `uname` in
95 MINGW*)
96 IS_WIN32="yes"
97 IS_BSD="no"
98 ;;
99 FreeBSD|NetBSD)
100 IS_WIN32="no"
101 IS_BSD="yes"
102 ;;
103 *)
104 IS_WIN32="no"
105 IS_BSD="no"
106 ;;
107 esac
108
109 # Check whether to run IPv6 tests.
110 if $PYTHON -c '
111 import socket
112 socket.socket(family=socket.AF_INET6).bind(("::1", 0, 0, 0))
113 '; then
114 HAVE_IPV6=yes
115 else
116 HAVE_IPV6=no
117 fi
118
119 # Look for a python L7 library 'LIB' in the system. If it is found, defines
120 # HAVE_LIB="yes", otherwise HAVE_LIB="no"
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
137 # HAVE_FTP
138 find_l7_lib ftp
139 # HAVE_TFTP
140 find_l7_lib tftp
141
142 # Look for a commnand in the system. If it is found, defines
143 # HAVE_COMMAND="yes", otherwise HAVE_COMMAND="no".
144 find_command()
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
157 find_command nc
158
159 # Determine correct netcat option to quit on stdin EOF
160 if nc --version 2>&1 | grep -q nmap.org; then
161 # Nmap netcat
162 NC_EOF_OPT="--send-only -w 5"
163 else
164 # BSD netcat
165 NC_EOF_OPT="-q 1 -w 5"
166 fi
167
168 # Set HAVE_TCPDUMP
169 find_command tcpdump
170
171 CURL_OPT="-g -v --max-time 1 --retry 2 --retry-delay 1 --connect-timeout 1"
172
173 # Determine whether "diff" supports "normal" diffs. (busybox diff does not.)
174 if echo xyzzy | diff /dev/null - | grep '^>' >/dev/null; then
175 DIFF_SUPPORTS_NORMAL_FORMAT=yes
176 else
177 DIFF_SUPPORTS_NORMAL_FORMAT=no
178 fi
179
180 # Turn off proxies.
181 unset http_proxy
182 unset https_proxy
183 unset ftp_proxy
184 unset no_proxy
185 unset HTTP_PROXY
186 unset HTTPS_PROXY
187 unset FTP_PROXY
188 unset NO_PROXY