xref: /xnu-12377.41.6/tests/skywalk_tests.c (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
1 /*
2  * Copyright (c) 2024 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 #include <stdlib.h>
29 #include <darwintest.h>
30 #include <darwintest_multiprocess.h>
31 #include <unistd.h>
32 
33 #include "skywalk/skywalk_test_driver.h"
34 #include "skywalk/skywalk_test_common.h"
35 
36 T_GLOBAL_META(
37 	T_META_NAMESPACE("xnu.skywalk"),
38 	T_META_RADAR_COMPONENT_NAME("xnu"),
39 	T_META_RADAR_COMPONENT_VERSION("skywalk")
40 	);
41 
42 #define BATS_TESTS \
43 	X(noop, "test just returns true") \
44 	X(crash, "test expects a segfault") \
45 	X(assert, "test verifies that assert catches failure") \
46 	X(features, "verifies skywalk features match kernel config") \
47 	X(oneslotus, "test sends one slot of data on user pipe loopback using select") \
48 	X(oneslotks, "test sends one slot of data on kpipe loopback using select") \
49 	X(oneslotup, "test sends one slot of data on user pipe loopback using poll") \
50 	X(oneslotkp, "test sends one slot of data on kpipe loopback using poll") \
51 	X(oneslotuk, "test sends one slot of data on user pipe loopback using kqueue") \
52 	X(oneslotkk, "test sends one slot of data on kpipe loopback using kqueue") \
53 	X(oneslotuk_defunct, "test sends one slot of data on user pipe loopback using kqueue with one end of the pipe defuncted") \
54 	X(shutdownus, "test shuts down channel on upipe and calls select") \
55 	X(shutdownks, "test shuts down channel on kpipe and calls select") \
56 	X(shutdownup, "test shuts down channel on upipe and calls poll") \
57 	X(shutdownkp, "test shuts down channel on kpipe and calls poll") \
58 	X(shutdownuk, "test shuts down channel on upipe and calls kqueue") \
59 	X(shutdownkk, "test shuts down channel on kpipe and calls kqueue") \
60 	X(shutdown2us, "test shuts down channel on upipe while in select") \
61 	X(shutdown2ks, "test shuts down channel on kpipe while in select") \
62 	X(shutdown2up, "test shuts down channel on upipe while in poll") \
63 	X(shutdown2kp, "test shuts down channel on kpipe while in poll") \
64 	X(shutdown2uk, "test shuts down channel on upipe while in kqueue") \
65 	X(shutdown2kk, "test shuts down channel on kpipe while in kqueue") \
66 	X(nslotsus, "test sends TX_SLOTS of data on user pipe loopback using select") \
67 	X(nslotsks, "test sends TX_SLOTS of data on kpipe loopback using select") \
68 	X(nslotsup, "test sends TX_SLOTS of data on user pipe loopback using poll") \
69 	X(nslotskp, "test sends TX_SLOTS of data on kpipe loopback using poll") \
70 	X(nslotsuk, "test sends TX_SLOTS of data on user pipe loopback using kqueue") \
71 	X(nslotskk, "test sends TX_SLOTS of data on kpipe loopback using kqueue") \
72 	X(mslotsus, "test sends 1000000 slots of data on user pipe loopback using select") \
73 	X(mslotsks, "test sends 1000000 slots of data on kpipe loopback using select") \
74 	X(mslotsup, "test sends 1000000 slots of data on user pipe loopback using poll") \
75 	X(mslotskp, "test sends 1000000 slots of data on kpipe loopback using poll") \
76 	X(mslotsuk, "test sends 1000000 slots of data on user pipe loopback using kqueue") \
77 	X(mslotskk, "test sends 1000000 slots of data on kpipe loopback using kqueue") \
78 	X(closecfd, "test closing guarded channel fd") \
79 	X(writecfd, "test writing to channel fd") \
80 	X(readcfd, "test reading from channel fd") \
81 	X(closenfd, "test closing guarded nexus fd") \
82 	X(readnfd, "test reading from a guarded nexus fd") \
83 	X(writeif, "test writes to the read only channel if") \
84 	X(writering, "test writes to the writeable ring") \
85 	X(readsmap, "test reads from the read only smap") \
86 	X(writesmap, "test writes to the read only smap") \
87 	X(verifynxadv, "test verifies nexus advisory region") \
88 	X(badringtl, "test calls select with bad tx ring pointers") \
89 	X(badringtp, "test calls poll with bad tx ring pointers") \
90 	X(badringtk, "test calls kqueue with bad tx ring pointers") \
91 	X(badringts, "test calls sync with bad tx ring pointers") \
92 	X(badringrl, "test calls select with bad rx ring pointers") \
93 	X(badringrp, "test calls poll with bad rx ring pointers") \
94 	X(badringrk, "test calls kqueue with bad rx ring pointers") \
95 	X(badringrs, "test calls sync with bad rx ring pointers") \
96 	X(kqueue_basic, "test kqueue return values") \
97 	X(kqueue_lowat_chan_bytes, "test kqueue low watermark (byte watermark on channel)") \
98 	X(kqueue_lowat_chan_slots, "test kqueue low watermark (slot watermark on channel)") \
99 	X(kqueue_lowat_note_bytes, "test kqueue low watermark (byte watermark on knote)") \
100 	X(kqueue_lowat_note_slots, "test kqueue low watermark (slot watermark on knote)") \
101 	X(change_len, "test kernel resilience to modified slot lengths") \
102 	X(big_len, "test unrealistically large slot lengths") \
103 	X(ringidtx, "test opening tx ringids") \
104 	X(ringidrx, "test opening rx ringids") \
105 	X(closekqk, "test closing kqueue in kqueue") \
106 	X(debug_verify_u, "test confirms that skywalk is storing checksums of slots received on a upipe when in SKF_VERIFY debug mode") \
107 	X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \
108 	X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \
109 	X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \
110 	X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \
111 	X(bindupipeanon, "test binds a channel to an anonymous user pipe nexus") \
112 	X(bindupipekey, "test binds a channel to a non-anonymous user pipe nexus") \
113 	X(bindfswanon, "test binds a channel to an anonymous flowswitch nexus") \
114 	X(bindnetifkey, "test binds a channel to a non-anonymous netif nexus") \
115 	X(netifcompata, "Test setup and teardown netifcompat on feth0") \
116 	X(netifcompatb, "Test setup and teardown netifcompat on feth0 with deferred close channel") \
117 	X(netifcompatc, "Test setup and teardown netifcompat on feth0 with deferred detach and close channel") \
118 	X(fswloopfsw, "Test creates a flowswitch and attaches it to itself") \
119 	X(fswloop2ff, "Test attaches a flowswitch to a flowswitch without any netif") \
120 	X(teardown, "Test setup complicated topology tear it down") \
121 	X(teardownb, "Test setup complicated topology tear it down backwards") \
122 	X(fsw29301703a, "Test open 63 channels to a flowswitch") \
123 	X(fsw29301703b, "Test open 200 channels to a flowswitch") \
124 	X(fsw29301703c, "Open too many channels to a flowswitch") \
125 	X(fswbind0, "Test attempts to bind to port 0 of flowswitch") \
126 	X(fswbind1, "Test attempts to bind to port 1 of flowswitch") \
127 	X(fswbind512, "Test attempts to bind to port 512 of flowswitch") \
128 	X(fullupipe, "Test rx on full tx pipe") \
129 	X(upipepeerclosure, "Test channel operations on upipe with no peer") \
130 	X(copy_cksum_single, "Test copy/checksum code: single buffer") \
131 	X(copy_cksum_multi, "Test copy/checksum code: buffer chain") \
132 	X(reass, "UDP fragmentation reassembly (channel flow Rx)") \
133 	X(reass_default_setting, "UDP fragmentation reassembly (channel flow Rx) (without forcing ip_reass sysctl)") \
134 	X(reass_timeout, "Test send partial fragment to flowswitch and check for ICMPv6 time exceeded reply") \
135 	X(reass_bad_fraglen, "Test send fragment with bad fragment length (!= 8*) to flowswitch and check for ICMPv6 param header reply") \
136 	X(reass_atomic, "Test send atomic ICMP echo fragment to flowswitch and check for reply") \
137 	X(reass_fuzz_queue_limit, "Test fuzz flowswitch to hit fragment limit") \
138 	X(cksum, "Test checksum code") \
139 	X(memory, "Test skmem allocator basic and advanced tests") \
140 	X(flow_req_ll, "Test skywalk flow request api for low latency flows") \
141 	X(flow_config, "Test skywalk flow config api") \
142 	X(flow_conn_idle, "Test skywalk flow connection idle api") \
143 	X(libcuckoo, "Test Cuckoo hashtable library basic and advanced tests") \
144 	X(steering, "Test steering rules") \
145 	X(listen_stress, "Test stress posix socket listen") \
146 	X(pllutxk, "Test send 10000000 slots to upipe sink using kqueue")
147 
148 /*
149  *  The following tetsts are disabled:
150  *       X(writenfd, "test writing to a guarded nexus fd") due to rdar://133461652
151  */
152 
153 #define BATSPLL_TESTS \
154 	X(noop, "test just returns true") \
155 	X(crash, "test expects a segfault") \
156 	X(assert, "test verifies that assert catches failure") \
157 	X(features, "verifies skywalk features match kernel config") \
158 	X(pllutxk, "send 10000000 slots to upipe sink using kqueue") \
159 	X(pllutxs, "send 10000000 slots to upipe sink using select") \
160 	X(pllutxp, "send 10000000 slots to upipe sink using poll") \
161 	X(pllurxk, "receive 10000000 slots from upipe source using kqueue") \
162 	X(pllurxs, "receive 10000000 slots from upipe source using select") \
163 	X(pllurxp, "receive 10000000 slots to upipe source using poll")
164 
165 #define BATSUTUN_TESTS \
166 	X(noop, "test just returns true") \
167 	X(crash, "test expects a segfault") \
168 	X(assert, "test verifies that assert catches failure") \
169 	X(features, "verifies skywalk features match kernel config") \
170 	X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \
171 	X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \
172 	X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \
173 	X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \
174 	X(utun27646755, "race cleaning up channel and utun socket (20 iterations)") \
175 	X(utunloopy4u1, "open 2 utuns with netif and floods ipv4 udp packets in one direction") \
176 	X(utunloopy4u2, "open 2 utuns with netif and floods ipv4 udp packets in two directions") \
177 	X(utunloopy4t1, "open 2 utuns with netif and floods ipv4 tcp packets in one direction") \
178 	X(utunloopy4t2, "open 2 utuns with netif and floods ipv4 tcp packets in two directions")
179 
180 #define SHUTDOWN_TESTS \
181 	X(oneslotus, "test sends one slot of data on user pipe loopback using select") \
182 	X(oneslotks, "test sends one slot of data on kpipe loopback using select") \
183 	X(oneslotup, "test sends one slot of data on user pipe loopback using poll") \
184 	X(oneslotkp, "test sends one slot of data on kpipe loopback using poll") \
185 	X(oneslotuk, "test sends one slot of data on user pipe loopback using kqueue") \
186 	X(oneslotuk_defunct, "test sends one slot of data on user pipe loopback using kqueue with one end of the pipe defuncted") \
187 	X(oneslotkk, "test sends one slot of data on kpipe loopback using kqueue") \
188 	X(nslotsus, "test sends TX_SLOTS of data on user pipe loopback using select") \
189 	X(nslotsks, "test sends TX_SLOTS of data on kpipe loopback using select") \
190 	X(nslotsup, "test sends TX_SLOTS of data on user pipe loopback using poll") \
191 	X(nslotskp, "test sends TX_SLOTS of data on kpipe loopback using poll") \
192 	X(nslotsuk, "test sends TX_SLOTS of data on user pipe loopback using kqueue") \
193 	X(nslotskk, "test sends TX_SLOTS of data on kpipe loopback using kqueue") \
194 	X(mslotsus, "test sends 1000000 slots of data on user pipe loopback using select") \
195 	X(mslotsks, "test sends 1000000 slots of data on kpipe loopback using select") \
196 	X(mslotsup, "test sends 1000000 slots of data on user pipe loopback using poll") \
197 	X(mslotskp, "test sends 1000000 slots of data on kpipe loopback using poll") \
198 	X(mslotsuk, "test sends 1000000 slots of data on user pipe loopback using kqueue") \
199 	X(mslotskk, "test sends 1000000 slots of data on kpipe loopback using kqueue") \
200 	X(mmslotsus, "test sends 10000000 slots of data on user pipe loopback using select") \
201 	X(mmslotsks, "test sends 10000000 slots of data on kpipe loopback using select") \
202 	X(mmslotsup, "test sends 10000000 slots of data on user pipe loopback using poll") \
203 	X(mmslotskp, "test sends 10000000 slots of data on kpipe loopback using poll") \
204 	X(mmslotsuk, "test sends 10000000 slots of data on user pipe loopback using kqueue") \
205 	X(mmslotskk, "test sends 10000000 slots of data on kpipe loopback using kqueue") \
206 	X(closecfd, "test closing guarded channel fd") \
207 	X(writecfd, "test writing to channel fd") \
208 	X(readcfd, "test reading from channel fd") \
209 	X(closenfd, "test closing guarded nexus fd") \
210 	X(writeif, "test writes to the read only channel if") \
211 	X(writering, "test writes to the writeable ring") \
212 	X(readsmap, "test reads from the read only smap") \
213 	X(writesmap, "test writes to the read only smap") \
214 	X(verifynxadv, "test verifies nexus advisory region") \
215 	X(badringtl, "test calls select with bad tx ring pointers") \
216 	X(badringtp, "test calls poll with bad tx ring pointers") \
217 	X(badringtk, "test calls kqueue with bad tx ring pointers") \
218 	X(badringts, "test calls sync with bad tx ring pointers") \
219 	X(badringrl, "test calls select with bad rx ring pointers") \
220 	X(badringrp, "test calls poll with bad rx ring pointers") \
221 	X(badringrk, "test calls kqueue with bad rx ring pointers") \
222 	X(badringrs, "test calls sync with bad rx ring pointers") \
223 	X(kqueue_basic, "test kqueue return values") \
224 	X(kqueue_lowat_chan_slots, "test kqueue low watermark (slot watermark on channel)") \
225 	X(kqueue_lowat_chan_bytes, "test kqueue low watermark (byte watermark on channel)") \
226 	X(kqueue_lowat_note_slots, "test kqueue low watermark (slot watermark on knote)") \
227 	X(kqueue_lowat_note_bytes, "test kqueue low watermark (byte watermark on knote)") \
228 	X(change_len, "test kernel resilience to modified slot lengths") \
229 	X(big_len, "test unrealistically large slot lengths") \
230 	X(ringidtx, "test opening tx ringids") \
231 	X(ringidrx, "test opening rx ringids") \
232 	X(debug_verify_u, "test confirms that skywalk is storing checksums of slots received on a upipe when in SKF_VERIFY debug mode") \
233 	X(debug_verify_k, "test confirms that skywalk is storing checksums of slots received on a kpipe when in SKF_VERIFY debug mode") \
234 	X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \
235 	X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \
236 	X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \
237 	X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \
238 	X(utun27646755, "race cleaning up channel and utun socket (20 iterations)") \
239 	X(utunloopy4u1, "open 2 utuns with netif and floods ipv4 udp packets in one direction") \
240 	X(utunloopy4u2, "open 2 utuns with netif and floods ipv4 udp packets in two directions") \
241 	X(utunloopy4t1, "open 2 utuns with netif and floods ipv4 tcp packets in one direction") \
242 	X(utunloopy4t2, "open 2 utuns with netif and floods ipv4 tcp packets in two directions") \
243 	X(ipsecloopy4u1, "open 2 ipsecs with netif and floods ipv4 udp packets in one direction") \
244 	X(ipsecloopy4u2, "open 2 ipsecs with netif and floods ipv4 udp packets in two directions") \
245 	X(ipsecloopy4t1, "open 2 ipsecs with netif and floods ipv4 tcp packets in one direction") \
246 	X(ipsecloopy4t2, "open 2 ipsecs with netif and floods ipv4 tcp packets in two directions") \
247 	X(bindupipekey, "test binds a channel to a non-anonymous user pipe nexus") \
248 	X(netifcompata, "Test setup and teardown netifcompat on feth0") \
249 	X(netifcompatb, "Test setup and teardown netifcompat on feth0 with deferred close channel") \
250 	X(netifcompatc, "Test setup and teardown netifcompat on feth0 with deferred detach and close channel") \
251 	X(teardownr, "setup complicated topology tear it down randomly (1000 iterations)") \
252 	X(teardownz, "setup complicated topology tear it down with each stage in an out of order position") \
253 	X(fsw29301703a, "Test open 63 channels to a flowswitch") \
254 	X(fsw29301703b, "Test open 200 channels to a flowswitch") \
255 	X(fsw29301703c, "Open too many channels to a flowswitch") \
256 	X(mf10x10, "test binds 10 ports with 10 flows per port") \
257 	X(mf10x100, "test binds 10 ports with 100 flows per port") \
258 	X(mf100x10, "test binds 100 ports with 10 flows per port") \
259 	X(mf100x100, "test binds 100 ports with 100 flows per port") \
260 	X(fullupipe, "Test rx on full tx pipe") \
261 	X(upipepeerclosure, "Test channel operations on upipe with no peer") \
262 	X(pllutxk, "send 10000000 slots to upipe sink using kqueue") \
263 	X(pllutxs, "send 10000000 slots to upipe sink using select") \
264 	X(pllutxp, "send 10000000 slots to upipe sink using poll") \
265 	X(pllurxk, "receive 10000000 slots from upipe source using kqueue") \
266 	X(pllurxs, "receive 10000000 slots from upipe source using select") \
267 	X(pllurxp, "receive 10000000 slots to upipe source using poll")
268 
269 #define RDAR_145328590_FAILING_TESTS \
270 	X(flow_req, "Test skywalk flow request api") \
271 	X(flowlookup, "Test test flow lookup by send/receive of packets") \
272 	X(flowswitch_ns_reserve, "test confirms that flowswitches can reserve L4 ports") \
273 	X(flowswitch_ns_reserve2, "thorough test of netns for both BSD & flowswitch, IPv4/v6") \
274 	X(fswbind2, "Test attempts to bind to port 2 of flowswitch") \
275 	X(fswbind5, "Test attempts to bind to port 5 of flowswitch") \
276 	X(fswbindany, "Test attempts to bind to port -1 of flowswitch") \
277 	X(internalizemetdata, "test internalizex packet metadata verification") \
278 	X(listener, "Test skywalk listener flow creation check") \
279 	X(listener_stress, "Test stress skywalk listener flows") \
280 	X(listener_reuse, "Test stress skywalk listener reuse") \
281 	X(restricted_port, "Test reserve a restricted ephemeral port") \
282 	X(teardown, "Test setup complicated topology tear it down") \
283 	X(teardownb, "Test setup complicated topology tear it down backwards") \
284 	X(utunloopy4u1, "open 2 utuns with netif and floods ipv4 udp packets in one direction") \
285 	X(utunloopy4u2, "open 2 utuns with netif and floods ipv4 udp packets in two directions") \
286 	X(utunloopy4t1, "open 2 utuns with netif and floods ipv4 tcp packets in one direction") \
287 	X(utunloopy4t2, "open 2 utuns with netif and floods ipv4 tcp packets in two directions") \
288 	X(bindfswkey, "test binds a channel to a non-anonymous flowswitch nexus")
289 
290 #define EXPAND_TO_T_DECL_COMMON(test, desc)                                    \
291 	{                                                                      \
292 	        const char *memfail_str = getenv("memfail");                   \
293 	        const char *ignorefail_str = getenv("ignorefail");             \
294 	        const char *shutdown_str = getenv("shutdown");                 \
295 	        const char *itersecs_str = getenv("itersecs");                 \
296 	        uint32_t memfail = 0;                                          \
297 	        bool ignorefail = false;                                       \
298 	        bool shutdown = false;                                         \
299 	        int itersecs = -1;                                             \
300 	        if (memfail_str) {                                             \
301 	                T_LOG("memfail option present: %s", memfail_str);      \
302 	                memfail = atoi(memfail_str);                           \
303 	        }                                                              \
304 	        if (ignorefail_str) {                                          \
305 	                T_LOG("ignorefail option present: %s", ignorefail_str);\
306 	                ignorefail = true;                                     \
307 	        }                                                              \
308 	        if (shutdown_str) {                                            \
309 	                T_LOG("shutdown option present: %s", shutdown_str);    \
310 	                shutdown = true;                                       \
311 	                ignorefail = true;                                     \
312 	        }                                                              \
313 	        if (itersecs_str) {                                            \
314 	                T_LOG("itersecs option present: %s", itersecs_str);    \
315 	                itersecs = atoi(itersecs_str);                         \
316 	        }                                                              \
317 	        skywalk_test_driver_run(&skt_##test, argc, (skt_##test).skt_argv,\
318 	            memfail, ignorefail, shutdown, itersecs);                  \
319 	}
320 
321 /*
322  * T_DECL naming convention: <testset>_<options>_<testcase>, where:
323  * <testset> is one of pll or utun (we omit "bats" because it's redundant)
324  * <options> is one of memfail or shutdown
325  * <testcase> is the actual testcase name, such as nslotus
326  */
327 #define EXPAND_TO_T_DECL(tdecl_name, test, desc)    \
328 	T_DECL(tdecl_name, desc)                    \
329 	EXPAND_TO_T_DECL_COMMON(test, desc)
330 
331 /*
332  * This is equivalent to the following legacy test command:
333  * skywalk_tests bats
334  */
335 #define X(test, desc, ...) EXPAND_TO_T_DECL(test, test, desc)
336 BATS_TESTS;
337 #undef X
338 
339 /*
340  * This is equivalent to the following legacy test command:
341  * skywalk_tests batspll
342  */
343 #define X(test, desc, ...) EXPAND_TO_T_DECL(pll_##test, test, desc)
344 BATSPLL_TESTS;
345 #undef X
346 
347 /*
348  * This is equivalent to the following legacy test command:
349  * skywalk_tests batsutun
350  */
351 #define X(test, desc, ...) EXPAND_TO_T_DECL(utun_##test, test, desc)
352 BATSUTUN_TESTS;
353 #undef X
354 
355 /*
356  * This is equivalent to the following legacy test command:
357  * skywalk_tests --ignorefail --memfail 127 bats
358  */
359 #define X(test, desc, ...)                                    \
360 	T_DECL_REF(memfail_##test, test, desc,                \
361 	        T_META_ENVVAR("memfail=127"),                 \
362 	        T_META_ENVVAR("ignorefail=true"));
363 BATS_TESTS;
364 #undef X
365 
366 /*
367  * This is equivalent to the following legacy test command:
368  * skywalk_tests --ignorefail --memfail 127 batspll
369  */
370 #define X(test, desc, ...)                                          \
371 	T_DECL_REF(pll_memfail_##test, pll_##test, desc,            \
372 	        T_META_ENVVAR("memfail=127"),                       \
373 	        T_META_ENVVAR("ignorefail=true"));
374 BATSPLL_TESTS;
375 #undef X
376 
377 /*
378  * This is equivalent to the following legacy test command:
379  * skywalk_tests --ignorefail --memfail 127 batsutun
380  */
381 #define X(test, desc, ...)                                              \
382 	T_DECL_REF(utun_memfail_##test, utun_##test, desc,              \
383 	        T_META_ENVVAR("memfail=127"),                           \
384 	        T_META_ENVVAR("ignorefail=true"));
385 BATSUTUN_TESTS;
386 #undef X
387 
388 /*
389  * This is equivalent to the following legacy test command:
390  * skywalk_tests --memfail 0 noop
391  */
392 T_DECL_REF(noop_memcleanup, noop, "run noop test to cleanup memory failure sysctl",
393     T_META_NAMESPACE("xnu.skyawlk.memcleanup"),
394     T_META_ENVVAR("memfail=0"));
395 
396 /*
397  * This is equivalent to the following legacy test command:
398  * skywalk_tests --ignorefail --shutdown --itersecs 1 shutdown
399  * Note that in the legacy test, the --itersecs option had a value of 60, but
400  * here we used 1. That's because the legacy tests ran a group of tests, but here
401  * it is only for a single test.
402  */
403 #define X(test, desc, ...)                           \
404 	T_DECL(shutdown_##test, desc,                \
405 	        T_META_ENVVAR("ignorefail=true"),    \
406 	        T_META_ENVVAR("shutdown=true"),      \
407 	        T_META_ENVVAR("itersecs=1"))         \
408 	EXPAND_TO_T_DECL_COMMON(test, desc)
409 SHUTDOWN_TESTS;
410 #undef X
411