tests: Fix tunnel push pop test failure.
[cascardo/ovs.git] / tests / library.at
1 AT_BANNER([library unit tests])
2
3 AT_SETUP([test flow extractor])
4 AT_CHECK([$PERL `which flowgen.pl` >/dev/null 3>flows 4>pcap])
5 AT_CHECK([ovstest test-flows flows pcap], [0], [checked 247 packets, 0 errors
6 ])
7 AT_CLEANUP
8
9 AT_SETUP([test TCP/IP checksumming])
10 AT_CHECK([ovstest test-csum], [0], [....#....#....####................................#................................#
11 ])
12 AT_CLEANUP
13
14 AT_SETUP([test hash functions])
15 AT_CHECK([ovstest test-hash])
16 AT_CLEANUP
17
18 AT_SETUP([test hash map])
19 AT_KEYWORDS([hmap])
20 AT_CHECK([ovstest test-hmap], [0], [............
21 ])
22 AT_CLEANUP
23
24 AT_SETUP([test hash index])
25 AT_KEYWORDS([hindex])
26 AT_CHECK([ovstest test-hindex], [0], [.....................
27 ])
28 AT_CLEANUP
29
30 AT_SETUP([test cuckoo hash])
31 AT_KEYWORDS([cmap])
32 AT_CHECK([ovstest test-cmap check 1], [0], [...
33 ])
34 AT_CLEANUP
35
36 AT_SETUP([test atomic operations])
37 AT_CHECK([ovstest test-atomic])
38 AT_CLEANUP
39
40 AT_SETUP([test linked lists])
41 AT_CHECK([ovstest test-list], [0], [...
42 ])
43 AT_CLEANUP
44
45 AT_SETUP([test packet library])
46 AT_CHECK([ovstest test-packets])
47 AT_CLEANUP
48
49 AT_SETUP([test SHA-1])
50 AT_CHECK([ovstest test-sha1], [0], [.........
51 ])
52 AT_CLEANUP
53
54 AT_SETUP([test type properties])
55 AT_CHECK([test-type-props])
56 AT_CLEANUP
57
58 AT_SETUP([test strtok_r bug fix])
59 AT_CHECK([test-strtok_r], [0], [NULL NULL
60 ])
61 AT_CLEANUP
62
63 AT_SETUP([test byte order conversion])
64 AT_KEYWORDS([byte order])
65 AT_CHECK([ovstest test-byte-order])
66 AT_CLEANUP
67
68 AT_SETUP([test random number generator])
69 AT_CHECK([ovstest test-random], [0], [dnl
70 average=7fa2014f
71
72 bit      0     1
73   0  4946  5054
74   1  4939  5061
75   2  4947  5053
76   3  4935  5065
77   4  5004  4996
78   5  4998  5002
79   6  5062  4938
80   7  5009  4991
81   8  5001  4999
82   9  5022  4978
83  10  5006  4994
84  11  5039  4961
85  12  4940  5060
86  13  5048  4952
87  14  4930  5070
88  15  4973  5027
89  16  4954  5046
90  17  5043  4957
91  18  5020  4980
92  19  5104  4896
93  20  5051  4949
94  21  5003  4997
95  22  5110  4890
96  23  4950  5050
97  24  5016  4984
98  25  5019  4981
99  26  4948  5052
100  27  4995  5005
101  28  4995  5005
102  29  4969  5031
103  30  5109  4891
104  31  4984  5016
105 (expected values are 5000)
106
107 nibble   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
108      0 640 589 610 613 588 632 650 613 582 646 627 640 612 650 637 671
109      1 626 642 663 620 630 609 617 602 615 638 614 644 641 597 598 644
110      2 667 611 617 613 609 629 642 651 604 641 594 659 651 610 617 585
111      3 621 662 594 605 618 644 616 613 613 616 611 608 614 660 653 652
112      4 641 668 621 664 619 624 625 642 624 629 607 566 599 639 618 614
113      5 666 629 620 621 581 615 598 620 630 651 671 622 628 603 657 588
114      6 620 640 621 606 603 644 628 633 620 597 653 591 637 658 634 615
115      7 636 645 679 593 598 609 612 612 623 626 638 669 603 629 606 622
116 (expected values are 625)
117 ])
118 AT_CLEANUP
119
120 m4_foreach(
121   [testname],
122   [[ctz],
123    [clz],
124    [round_up_pow2],
125    [round_down_pow2],
126    [count_1bits],
127    [log_2_floor],
128    [bitwise_copy],
129    [bitwise_zero],
130    [bitwise_one],
131    [bitwise_is_all_zeros],
132    [bitwise_rscan],
133    [ovs_scan]],
134   [AT_SETUP([testname[()] function])
135    AT_KEYWORDS([testname])
136    AT_CHECK([ovstest test-util testname], [0], [], [])
137    AT_CLEANUP])
138
139 AT_SETUP([test unix socket, short pathname - C])
140 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
141 AT_CHECK([ovstest test-unix-socket x])
142 AT_CLEANUP
143
144 dnl Unix sockets with long names are problematic because the name has to
145 dnl go in a fixed-length field in struct sockaddr_un.  Generally the limit
146 dnl is about 100 bytes.  On Linux, we work around this by indirecting through
147 dnl a directory fd using /proc/self/fd/<dirfd>.  We do not have a workaround
148 dnl for other platforms, so we skip the test there.
149 AT_SETUP([test unix socket, long pathname - C])
150 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
151 dnl Linux sockaddr_un has a 108-byte limit, so this needs to be longer.
152 dnl Linux "ecryptfs" has a 143-byte limit, so we use that many bytes.
153 longname=01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
154
155 dnl Skip the test if the directory can't be created (presumably the file
156 dnl system doesn't support such long names).
157 AT_CHECK([mkdir $longname || exit 77])
158
159 AT_CHECK([cd $longname && ovstest test-unix-socket ../$longname/socket socket])
160 AT_CLEANUP
161
162 m4_define([UNIX_SOCKET_SHORT_PATHNAME_PYN],
163   [AT_SETUP([test unix socket, short pathname - $1])
164    AT_SKIP_IF([test $2 = no || test "$IS_WIN32" = "yes"])
165    AT_KEYWORDS([python unixsocket])
166    AT_CHECK([$3 $srcdir/test-unix-socket.py x])
167    AT_CLEANUP])
168
169 UNIX_SOCKET_SHORT_PATHNAME_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
170 UNIX_SOCKET_SHORT_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
171
172 dnl Unix sockets with long names are problematic because the name has to
173 dnl go in a fixed-length field in struct sockaddr_un.  Generally the limit
174 dnl is about 100 bytes.  On Linux, we work around this by indirecting through
175 dnl a directory fd using /proc/self/fd/<dirfd>.  We do not have a workaround
176 dnl for other platforms, so we skip the test there.
177 m4_define([UNIX_SOCKET_LONG_PATHNAME_PYN],
178   [AT_SETUP([test unix socket, long pathname - $1])
179    AT_SKIP_IF([test $2 = no || test "$IS_WIN32" = "yes"])
180    AT_KEYWORDS([python unixsocket])
181    dnl Linux sockaddr_un has a 108-byte limit, so this needs to be longer.
182    dnl Linux "ecryptfs" has a 143-byte limit, so we use that many bytes.
183    longname=01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
184
185    dnl Skip the test if the directory can't be created (presumably the file
186    dnl system doesn't support such long names).
187    AT_CHECK([mkdir $longname || exit 77])
188    AT_CHECK([cd $longname && $3 $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
189    AT_CLEANUP])
190
191 UNIX_SOCKET_LONG_PATHNAME_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
192 UNIX_SOCKET_LONG_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
193
194 AT_SETUP([ovs_assert])
195 if test "$IS_WIN32" = "yes"; then
196   exit_status=9
197 else
198   # SIGABRT + 128
199   exit_status=134
200 fi
201 AT_CHECK([ovstest test-util -voff -vfile:info '-vPATTERN:file:%c|%p|%m' --log-file assert],
202   [$exit_status], [], [stderr])
203
204 AT_CHECK([sed 's/\(opened log file\) .*/\1/
205 s/|[[^|]]*: /|/' test-util.log], [0], [dnl
206 vlog|INFO|opened log file
207 util|EMER|assertion false failed in test_assert()
208 ])
209
210 AT_CHECK([sed 's/.*: //
211 1q' stderr], [0],
212   [assertion false failed in test_assert()
213 ])
214
215 AT_CLEANUP
216
217 AT_SETUP([snprintf])
218 AT_CHECK([ovstest test-util snprintf])
219 AT_CLEANUP
220
221 AT_SETUP([test bitmap functions])
222 AT_CHECK([ovstest test-bitmap check], [0], [..
223 ])
224 AT_CLEANUP
225
226 AT_SETUP([use of public headers])
227 AT_CHECK([test-lib], [0], [])
228 AT_CLEANUP
229
230 AT_SETUP([test ofpbuf module])
231 AT_CHECK([ovstest test-ofpbuf], [0], [])
232 AT_CLEANUP
233
234 AT_SETUP([test rcu])
235 AT_CHECK([ovstest test-rcu-quiesce], [0], [])
236 AT_CLEANUP