]>
Commit | Line | Data |
---|---|---|
1b233b95 BP |
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]) | |
7c126fbb | 5 | AT_CHECK([test-flows <flows 3<pcap], [0], [checked 247 packets, 0 errors |
1b233b95 BP |
6 | ]) |
7 | AT_CLEANUP | |
8 | ||
9 | AT_SETUP([test TCP/IP checksumming]) | |
97025b23 | 10 | AT_CHECK([test-csum], [0], [....#....#....###................................#................................# |
7fcfe998 | 11 | ]) |
1b233b95 BP |
12 | AT_CLEANUP |
13 | ||
1b233b95 | 14 | AT_SETUP([test hash functions]) |
7fcfe998 | 15 | AT_CHECK([test-hash]) |
1b233b95 BP |
16 | AT_CLEANUP |
17 | ||
18 | AT_SETUP([test hash map]) | |
7fcfe998 BP |
19 | AT_CHECK([test-hmap], [0], [......... |
20 | ]) | |
1b233b95 BP |
21 | AT_CLEANUP |
22 | ||
822b7f52 | 23 | AT_SETUP([test hash index]) |
faea2958 | 24 | AT_CHECK([test-hindex], [0], [..................... |
822b7f52 BP |
25 | ]) |
26 | AT_CLEANUP | |
27 | ||
31a3fc6e BP |
28 | AT_SETUP([test atomic operations]) |
29 | AT_CHECK([test-atomic]) | |
30 | AT_CLEANUP | |
31 | ||
1b233b95 | 32 | AT_SETUP([test linked lists]) |
7fcfe998 BP |
33 | AT_CHECK([test-list], [0], [.. |
34 | ]) | |
1b233b95 BP |
35 | AT_CLEANUP |
36 | ||
f696f12f JP |
37 | AT_SETUP([test packet library]) |
38 | AT_CHECK([test-packets]) | |
39 | AT_CLEANUP | |
40 | ||
1b233b95 | 41 | AT_SETUP([test SHA-1]) |
7fcfe998 BP |
42 | AT_CHECK([test-sha1], [0], [......... |
43 | ]) | |
1b233b95 BP |
44 | AT_CLEANUP |
45 | ||
46 | AT_SETUP([test type properties]) | |
7fcfe998 | 47 | AT_CHECK([test-type-props]) |
1b233b95 | 48 | AT_CLEANUP |
78f172aa BP |
49 | |
50 | AT_SETUP([test strtok_r bug fix]) | |
7fcfe998 BP |
51 | AT_CHECK([test-strtok_r], [0], [NULL NULL |
52 | ]) | |
78f172aa | 53 | AT_CLEANUP |
965f03d8 BP |
54 | |
55 | AT_SETUP([test byte order conversion]) | |
10a24935 | 56 | AT_KEYWORDS([byte order]) |
7fcfe998 | 57 | AT_CHECK([test-byte-order]) |
965f03d8 | 58 | AT_CLEANUP |
6e170b4c | 59 | |
78f3f316 BP |
60 | AT_SETUP([test random number generator]) |
61 | AT_CHECK([test-random], [0], [dnl | |
62 | average=7fa2014f | |
63 | ||
64 | bit 0 1 | |
65 | 0 4946 5054 | |
66 | 1 4939 5061 | |
67 | 2 4947 5053 | |
68 | 3 4935 5065 | |
69 | 4 5004 4996 | |
70 | 5 4998 5002 | |
71 | 6 5062 4938 | |
72 | 7 5009 4991 | |
73 | 8 5001 4999 | |
74 | 9 5022 4978 | |
75 | 10 5006 4994 | |
76 | 11 5039 4961 | |
77 | 12 4940 5060 | |
78 | 13 5048 4952 | |
79 | 14 4930 5070 | |
80 | 15 4973 5027 | |
81 | 16 4954 5046 | |
82 | 17 5043 4957 | |
83 | 18 5020 4980 | |
84 | 19 5104 4896 | |
85 | 20 5051 4949 | |
86 | 21 5003 4997 | |
87 | 22 5110 4890 | |
88 | 23 4950 5050 | |
89 | 24 5016 4984 | |
90 | 25 5019 4981 | |
91 | 26 4948 5052 | |
92 | 27 4995 5005 | |
93 | 28 4995 5005 | |
94 | 29 4969 5031 | |
95 | 30 5109 4891 | |
96 | 31 4984 5016 | |
97 | (expected values are 5000) | |
98 | ||
99 | nibble 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
100 | 0 640 589 610 613 588 632 650 613 582 646 627 640 612 650 637 671 | |
101 | 1 626 642 663 620 630 609 617 602 615 638 614 644 641 597 598 644 | |
102 | 2 667 611 617 613 609 629 642 651 604 641 594 659 651 610 617 585 | |
103 | 3 621 662 594 605 618 644 616 613 613 616 611 608 614 660 653 652 | |
104 | 4 641 668 621 664 619 624 625 642 624 629 607 566 599 639 618 614 | |
105 | 5 666 629 620 621 581 615 598 620 630 651 671 622 628 603 657 588 | |
106 | 6 620 640 621 606 603 644 628 633 620 597 653 591 637 658 634 615 | |
107 | 7 636 645 679 593 598 609 612 612 623 626 638 669 603 629 606 622 | |
108 | (expected values are 625) | |
109 | ]) | |
110 | AT_CLEANUP | |
111 | ||
8c2296a6 BP |
112 | m4_foreach( |
113 | [testname], | |
114 | [[ctz], | |
8c947903 | 115 | [clz], |
e93ab553 BP |
116 | [round_up_pow2], |
117 | [round_down_pow2], | |
fb9aefa3 | 118 | [count_1bits], |
8c2296a6 BP |
119 | [log_2_floor], |
120 | [bitwise_copy], | |
121 | [bitwise_zero], | |
122 | [bitwise_one], | |
ed2232fc BP |
123 | [bitwise_is_all_zeros], |
124 | [ovs_scan]], | |
8c2296a6 | 125 | [AT_SETUP([testname[()] function]) |
a656cb77 | 126 | AT_KEYWORDS([testname]) |
8c2296a6 BP |
127 | AT_CHECK([test-util testname], [0], [], []) |
128 | AT_CLEANUP]) | |
711e0157 | 129 | |
cd57233c | 130 | AT_SETUP([test unix socket, short pathname - C]) |
6e170b4c BP |
131 | AT_CHECK([test-unix-socket x]) |
132 | AT_CLEANUP | |
133 | ||
134 | dnl Unix sockets with long names are problematic because the name has to | |
135 | dnl go in a fixed-length field in struct sockaddr_un. Generally the limit | |
136 | dnl is about 100 bytes. On Linux, we work around this by indirecting through | |
137 | dnl a directory fd using /proc/self/fd/<dirfd>. We do not have a workaround | |
138 | dnl for other platforms, so we skip the test there. | |
cd57233c | 139 | AT_SETUP([test unix socket, long pathname - C]) |
6e170b4c | 140 | dnl Linux has a 108 byte limit; this is 150 bytes long. |
fabbeb21 BP |
141 | longname=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 |
142 | mkdir $longname | |
143 | cd $longname | |
144 | AT_CHECK([test-unix-socket ../$longname/socket socket]) | |
6e170b4c | 145 | AT_CLEANUP |
4749f73d | 146 | |
cd57233c BP |
147 | AT_SETUP([test unix socket, short pathname - Python]) |
148 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
149 | AT_CHECK([$PYTHON $srcdir/test-unix-socket.py x]) | |
150 | AT_CLEANUP | |
151 | ||
152 | dnl Unix sockets with long names are problematic because the name has to | |
153 | dnl go in a fixed-length field in struct sockaddr_un. Generally the limit | |
154 | dnl is about 100 bytes. On Linux, we work around this by indirecting through | |
155 | dnl a directory fd using /proc/self/fd/<dirfd>. We do not have a workaround | |
156 | dnl for other platforms, so we skip the test there. | |
157 | AT_SETUP([test unix socket, long pathname - Python]) | |
158 | AT_SKIP_IF([test $HAVE_PYTHON = no]) | |
cd57233c BP |
159 | dnl Linux has a 108 byte limit; this is 150 bytes long. |
160 | longname=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 | |
161 | mkdir $longname | |
162 | cd $longname | |
163 | AT_CHECK([$PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket]) | |
164 | AT_CLEANUP | |
165 | ||
4749f73d BP |
166 | AT_SETUP([ovs_assert]) |
167 | OVS_LOGDIR=`pwd`; export OVS_LOGDIR | |
168 | AT_CHECK([test-util -voff -vfile:info '-vPATTERN:file:%c|%p|%m' --log-file assert || kill -l $?], | |
169 | [0], [ABRT | |
170 | ], [stderr]) | |
171 | ||
172 | AT_CHECK([sed 's/\(opened log file\) .*/\1/ | |
173 | s/|[[^|]]*: /|/' test-util.log], [0], [dnl | |
174 | vlog|INFO|opened log file | |
175 | util|EMER|assertion false failed in test_assert() | |
176 | ]) | |
177 | ||
178 | AT_CHECK([sed 's/.*: // | |
179 | 1q' stderr], [0], | |
180 | [assertion false failed in test_assert() | |
181 | ]) | |
182 | ||
183 | AT_CLEANUP | |
cde1c287 BP |
184 | |
185 | AT_SETUP([snprintf]) | |
186 | AT_CHECK([test-util snprintf]) | |
187 | AT_CLEANUP |