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