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(internalizemetdata, "test internalizex packet metadata verification") \ 104 X(ringidtx, "test opening tx ringids") \ 105 X(ringidrx, "test opening rx ringids") \ 106 X(closekqk, "test closing kqueue in kqueue") \ 107 X(debug_verify_u, "test confirms that skywalk is storing checksums of slots received on a upipe when in SKF_VERIFY debug mode") \ 108 X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \ 109 X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \ 110 X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \ 111 X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \ 112 X(bindupipeanon, "test binds a channel to an anonymous user pipe nexus") \ 113 X(bindupipekey, "test binds a channel to a non-anonymous user pipe nexus") \ 114 X(bindfswanon, "test binds a channel to an anonymous flowswitch nexus") \ 115 X(bindfswkey, "test binds a channel to a non-anonymous flowswitch nexus") \ 116 X(bindnetifkey, "test binds a channel to a non-anonymous netif nexus") \ 117 X(flowswitch_ns_reserve, "test confirms that flowswitches can reserve L4 ports") \ 118 X(flowswitch_ns_reserve2, "thorough test of netns for both BSD & flowswitch, IPv4/v6") \ 119 X(netifcompata, "Test setup and teardown netifcompat on feth0") \ 120 X(netifcompatb, "Test setup and teardown netifcompat on feth0 with deferred close channel") \ 121 X(netifcompatc, "Test setup and teardown netifcompat on feth0 with deferred detach and close channel") \ 122 X(fswloopfsw, "Test creates a flowswitch and attaches it to itself") \ 123 X(fswloop2ff, "Test attaches a flowswitch to a flowswitch without any netif") \ 124 X(teardown, "Test setup complicated topology tear it down") \ 125 X(teardownb, "Test setup complicated topology tear it down backwards") \ 126 X(fsw29301703a, "Test open 63 channels to a flowswitch") \ 127 X(fsw29301703b, "Test open 200 channels to a flowswitch") \ 128 X(fswbindany, "Test attempts to bind to port -1 of flowswitch") \ 129 X(fswbind0, "Test attempts to bind to port 0 of flowswitch") \ 130 X(fswbind1, "Test attempts to bind to port 1 of flowswitch") \ 131 X(fswbind512, "Test attempts to bind to port 512 of flowswitch") \ 132 X(fswbind2, "Test attempts to bind to port 2 of flowswitch") \ 133 X(fswbind5, "Test attempts to bind to port 5 of flowswitch") \ 134 X(fullupipe, "Test rx on full tx pipe") \ 135 X(upipepeerclosure, "Test channel operations on upipe with no peer") \ 136 X(listener, "Test skywalk listener flow creation check") \ 137 X(listener_stress, "Test stress skywalk listener flows") \ 138 X(listener_reuse, "Test stress skywalk listener reuse") \ 139 X(copy_cksum_single, "Test copy/checksum code: single buffer") \ 140 X(copy_cksum_multi, "Test copy/checksum code: buffer chain") \ 141 X(reass_timeout, "Test send partial fragment to flowswitch and check for ICMPv6 time exceeded reply") \ 142 X(reass_bad_fraglen, "Test send fragment with bad fragment length (!= 8*) to flowswitch and check for ICMPv6 param header reply") \ 143 X(reass_atomic, "Test send atomic ICMP echo fragment to flowswitch and check for reply") \ 144 X(reass_fuzz_queue_limit, "Test fuzz flowswitch to hit fragment limit") \ 145 X(cksum, "Test checksum code") \ 146 X(memory, "Test skmem allocator basic and advanced tests") \ 147 X(flow_req, "Test skywalk flow request api") \ 148 X(flow_req_ll, "Test skywalk flow request api for low latency flows") \ 149 X(flow_config, "Test skywalk flow config api") \ 150 X(flowlookup, "Test test flow lookup by send/receive of packets") \ 151 X(libcuckoo, "Test Cuckoo hashtable library basic and advanced tests") \ 152 X(restricted_port, "Test reserve a restricted ephemeral port") \ 153 X(steering, "Test steering rules") \ 154 X(listen_stress, "Test stress posix socket listen") \ 155 X(pllutxk, "Test send 10000000 slots to upipe sink using kqueue") 156 157 /* 158 * The following tetsts are disabled: 159 * X(writenfd, "test writing to a guarded nexus fd") due to rdar://133461652 160 */ 161 162 #define BATSPLL_TESTS \ 163 X(noop, "test just returns true") \ 164 X(crash, "test expects a segfault") \ 165 X(assert, "test verifies that assert catches failure") \ 166 X(features, "verifies skywalk features match kernel config") \ 167 X(pllutxk, "send 10000000 slots to upipe sink using kqueue") \ 168 X(pllutxs, "send 10000000 slots to upipe sink using select") \ 169 X(pllutxp, "send 10000000 slots to upipe sink using poll") \ 170 X(pllurxk, "receive 10000000 slots from upipe source using kqueue") \ 171 X(pllurxs, "receive 10000000 slots from upipe source using select") \ 172 X(pllurxp, "receive 10000000 slots to upipe source using poll") 173 174 #define BATSUTUN_TESTS \ 175 X(noop, "test just returns true") \ 176 X(crash, "test expects a segfault") \ 177 X(assert, "test verifies that assert catches failure") \ 178 X(features, "verifies skywalk features match kernel config") \ 179 X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \ 180 X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \ 181 X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \ 182 X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \ 183 X(utun27646755, "race cleaning up channel and utun socket (20 iterations)") \ 184 X(utunloopn4u1, "open 2 utuns without netif and floods ipv4 udp packets in one direction") \ 185 X(utunloopn4u2, "open 2 utuns without netif and floods ipv4 udp packets in two directions") \ 186 X(utunloopn4t1, "open 2 utuns without netif and floods ipv4 tcp packets in one direction") \ 187 X(utunloopn4t2, "open 2 utuns without netif and floods ipv4 tcp packets in two directions") \ 188 X(utunloopy4u1, "open 2 utuns with netif and floods ipv4 udp packets in one direction") \ 189 X(utunloopy4u2, "open 2 utuns with netif and floods ipv4 udp packets in two directions") \ 190 X(utunloopy4t1, "open 2 utuns with netif and floods ipv4 tcp packets in one direction") \ 191 X(utunloopy4t2, "open 2 utuns with netif and floods ipv4 tcp packets in two directions") 192 193 #define SHUTDOWN_TESTS \ 194 X(oneslotus, "test sends one slot of data on user pipe loopback using select") \ 195 X(oneslotks, "test sends one slot of data on kpipe loopback using select") \ 196 X(oneslotup, "test sends one slot of data on user pipe loopback using poll") \ 197 X(oneslotkp, "test sends one slot of data on kpipe loopback using poll") \ 198 X(oneslotuk, "test sends one slot of data on user pipe loopback using kqueue") \ 199 X(oneslotuk_defunct, "test sends one slot of data on user pipe loopback using kqueue with one end of the pipe defuncted") \ 200 X(oneslotkk, "test sends one slot of data on kpipe loopback using kqueue") \ 201 X(nslotsus, "test sends TX_SLOTS of data on user pipe loopback using select") \ 202 X(nslotsks, "test sends TX_SLOTS of data on kpipe loopback using select") \ 203 X(nslotsup, "test sends TX_SLOTS of data on user pipe loopback using poll") \ 204 X(nslotskp, "test sends TX_SLOTS of data on kpipe loopback using poll") \ 205 X(nslotsuk, "test sends TX_SLOTS of data on user pipe loopback using kqueue") \ 206 X(nslotskk, "test sends TX_SLOTS of data on kpipe loopback using kqueue") \ 207 X(mslotsus, "test sends 1000000 slots of data on user pipe loopback using select") \ 208 X(mslotsks, "test sends 1000000 slots of data on kpipe loopback using select") \ 209 X(mslotsup, "test sends 1000000 slots of data on user pipe loopback using poll") \ 210 X(mslotskp, "test sends 1000000 slots of data on kpipe loopback using poll") \ 211 X(mslotsuk, "test sends 1000000 slots of data on user pipe loopback using kqueue") \ 212 X(mslotskk, "test sends 1000000 slots of data on kpipe loopback using kqueue") \ 213 X(mmslotsus, "test sends 10000000 slots of data on user pipe loopback using select") \ 214 X(mmslotsks, "test sends 10000000 slots of data on kpipe loopback using select") \ 215 X(mmslotsup, "test sends 10000000 slots of data on user pipe loopback using poll") \ 216 X(mmslotskp, "test sends 10000000 slots of data on kpipe loopback using poll") \ 217 X(mmslotsuk, "test sends 10000000 slots of data on user pipe loopback using kqueue") \ 218 X(mmslotskk, "test sends 10000000 slots of data on kpipe loopback using kqueue") \ 219 X(closecfd, "test closing guarded channel fd") \ 220 X(writecfd, "test writing to channel fd") \ 221 X(readcfd, "test reading from channel fd") \ 222 X(closenfd, "test closing guarded nexus fd") \ 223 X(writeif, "test writes to the read only channel if") \ 224 X(writering, "test writes to the writeable ring") \ 225 X(readsmap, "test reads from the read only smap") \ 226 X(writesmap, "test writes to the read only smap") \ 227 X(verifynxadv, "test verifies nexus advisory region") \ 228 X(badringtl, "test calls select with bad tx ring pointers") \ 229 X(badringtp, "test calls poll with bad tx ring pointers") \ 230 X(badringtk, "test calls kqueue with bad tx ring pointers") \ 231 X(badringts, "test calls sync with bad tx ring pointers") \ 232 X(badringrl, "test calls select with bad rx ring pointers") \ 233 X(badringrp, "test calls poll with bad rx ring pointers") \ 234 X(badringrk, "test calls kqueue with bad rx ring pointers") \ 235 X(badringrs, "test calls sync with bad rx ring pointers") \ 236 X(kqueue_basic, "test kqueue return values") \ 237 X(kqueue_lowat_chan_slots, "test kqueue low watermark (slot watermark on channel)") \ 238 X(kqueue_lowat_chan_bytes, "test kqueue low watermark (byte watermark on channel)") \ 239 X(kqueue_lowat_note_slots, "test kqueue low watermark (slot watermark on knote)") \ 240 X(kqueue_lowat_note_bytes, "test kqueue low watermark (byte watermark on knote)") \ 241 X(change_len, "test kernel resilience to modified slot lengths") \ 242 X(big_len, "test unrealistically large slot lengths") \ 243 X(internalizemetdata, "test internalizex packet metadata verification") \ 244 X(ringidtx, "test opening tx ringids") \ 245 X(ringidrx, "test opening rx ringids") \ 246 X(debug_verify_u, "test confirms that skywalk is storing checksums of slots received on a upipe when in SKF_VERIFY debug mode") \ 247 X(debug_verify_k, "test confirms that skywalk is storing checksums of slots received on a kpipe when in SKF_VERIFY debug mode") \ 248 X(utun27302538a, "test cleaning up utun kpipe while channel is in kevent (case a)") \ 249 X(utun27302538b, "test cleaning up utun kpipe while channel is in kevent (case b)") \ 250 X(utun27302538c, "test cleaning up utun kpipe while channel is in kevent (case c)") \ 251 X(utun27302538d, "test cleaning up utun kpipe while channel is in kevent (case d)") \ 252 X(utun27646755, "race cleaning up channel and utun socket (20 iterations)") \ 253 X(utunloopn4u1, "open 2 utuns without netif and floods ipv4 udp packets in one direction") \ 254 X(utunloopn4u2, "open 2 utuns without netif and floods ipv4 udp packets in two directions") \ 255 X(utunloopn4t1, "open 2 utuns without netif and floods ipv4 tcp packets in one direction") \ 256 X(utunloopn4t2, "open 2 utuns without netif and floods ipv4 tcp packets in two directions") \ 257 X(utunloopy4u1, "open 2 utuns with netif and floods ipv4 udp packets in one direction") \ 258 X(utunloopy4u2, "open 2 utuns with netif and floods ipv4 udp packets in two directions") \ 259 X(utunloopy4t1, "open 2 utuns with netif and floods ipv4 tcp packets in one direction") \ 260 X(utunloopy4t2, "open 2 utuns with netif and floods ipv4 tcp packets in two directions") \ 261 X(ipsecloopy4u1, "open 2 ipsecs with netif and floods ipv4 udp packets in one direction") \ 262 X(ipsecloopy4u2, "open 2 ipsecs with netif and floods ipv4 udp packets in two directions") \ 263 X(ipsecloopy4t1, "open 2 ipsecs with netif and floods ipv4 tcp packets in one direction") \ 264 X(ipsecloopy4t2, "open 2 ipsecs with netif and floods ipv4 tcp packets in two directions") \ 265 X(bindupipekey, "test binds a channel to a non-anonymous user pipe nexus") \ 266 X(bindfswkey, "test binds a channel to a non-anonymous flowswitch nexus") \ 267 X(netifcompata, "Test setup and teardown netifcompat on feth0") \ 268 X(netifcompatb, "Test setup and teardown netifcompat on feth0 with deferred close channel") \ 269 X(netifcompatc, "Test setup and teardown netifcompat on feth0 with deferred detach and close channel") \ 270 X(teardown, "Test setup complicated topology tear it down") \ 271 X(teardownb, "Test setup complicated topology tear it down backwards") \ 272 X(teardownr, "setup complicated topology tear it down randomly (1000 iterations)") \ 273 X(teardownz, "setup complicated topology tear it down with each stage in an out of order position") \ 274 X(fsw29301703a, "Test open 63 channels to a flowswitch") \ 275 X(fsw29301703b, "Test open 200 channels to a flowswitch") \ 276 X(mf10x10, "test binds 10 ports with 10 flows per port") \ 277 X(mf10x100, "test binds 10 ports with 100 flows per port") \ 278 X(mf100x10, "test binds 100 ports with 10 flows per port") \ 279 X(mf100x100, "test binds 100 ports with 100 flows per port") \ 280 X(fullupipe, "Test rx on full tx pipe") \ 281 X(upipepeerclosure, "Test channel operations on upipe with no peer") \ 282 X(pllutxk, "send 10000000 slots to upipe sink using kqueue") \ 283 X(pllutxs, "send 10000000 slots to upipe sink using select") \ 284 X(pllutxp, "send 10000000 slots to upipe sink using poll") \ 285 X(pllurxk, "receive 10000000 slots from upipe source using kqueue") \ 286 X(pllurxs, "receive 10000000 slots from upipe source using select") \ 287 X(pllurxp, "receive 10000000 slots to upipe source using poll") 288 289 #define EXPAND_TO_T_DECL_COMMON(test, desc) \ 290 { \ 291 const char *memfail_str = getenv("memfail"); \ 292 const char *ignorefail_str = getenv("ignorefail"); \ 293 const char *shutdown_str = getenv("shutdown"); \ 294 const char *itersecs_str = getenv("itersecs"); \ 295 uint32_t memfail = 0; \ 296 bool ignorefail = false; \ 297 bool shutdown = false; \ 298 int itersecs = -1; \ 299 if (memfail_str) { \ 300 T_LOG("memfail option present: %s", memfail_str); \ 301 memfail = atoi(memfail_str); \ 302 } \ 303 if (ignorefail_str) { \ 304 T_LOG("ignorefail option present: %s", ignorefail_str);\ 305 ignorefail = true; \ 306 } \ 307 if (shutdown_str) { \ 308 T_LOG("shutdown option present: %s", shutdown_str); \ 309 shutdown = true; \ 310 ignorefail = true; \ 311 } \ 312 if (itersecs_str) { \ 313 T_LOG("itersecs option present: %s", itersecs_str); \ 314 itersecs = atoi(itersecs_str); \ 315 } \ 316 skywalk_test_driver_run(&skt_##test, argc, (skt_##test).skt_argv,\ 317 memfail, ignorefail, shutdown, itersecs); \ 318 } 319 320 /* 321 * T_DECL naming convention: <testset>_<options>_<testcase>, where: 322 * <testset> is one of pll or utun (we omit "bats" because it's redundant) 323 * <options> is one of memfail or shutdown 324 * <testcase> is the actual testcase name, such as nslotus 325 */ 326 #define EXPAND_TO_T_DECL(tdecl_name, test, desc) \ 327 T_DECL(tdecl_name, desc) \ 328 EXPAND_TO_T_DECL_COMMON(test, desc) 329 330 /* 331 * This is equivalent to the following legacy test command: 332 * skywalk_tests bats 333 */ 334 #define X(test, desc, ...) EXPAND_TO_T_DECL(test, test, desc) 335 BATS_TESTS; 336 #undef X 337 338 /* 339 * This is equivalent to the following legacy test command: 340 * skywalk_tests batspll 341 */ 342 #define X(test, desc, ...) EXPAND_TO_T_DECL(pll_##test, test, desc) 343 BATSPLL_TESTS; 344 #undef X 345 346 /* 347 * This is equivalent to the following legacy test command: 348 * skywalk_tests batsutun 349 */ 350 #define X(test, desc, ...) EXPAND_TO_T_DECL(utun_##test, test, desc) 351 BATSUTUN_TESTS; 352 #undef X 353 354 /* 355 * This is equivalent to the following legacy test command: 356 * skywalk_tests --ignorefail --memfail 127 bats 357 */ 358 #define X(test, desc, ...) \ 359 T_DECL_REF(memfail_##test, test, desc, \ 360 T_META_ENVVAR("memfail=127"), \ 361 T_META_ENVVAR("ignorefail=true")); 362 BATS_TESTS; 363 #undef X 364 365 /* 366 * This is equivalent to the following legacy test command: 367 * skywalk_tests --ignorefail --memfail 127 batspll 368 */ 369 #define X(test, desc, ...) \ 370 T_DECL_REF(pll_memfail_##test, pll_##test, desc, \ 371 T_META_ENVVAR("memfail=127"), \ 372 T_META_ENVVAR("ignorefail=true")); 373 BATSPLL_TESTS; 374 #undef X 375 376 /* 377 * This is equivalent to the following legacy test command: 378 * skywalk_tests --ignorefail --memfail 127 batsutun 379 */ 380 #define X(test, desc, ...) \ 381 T_DECL_REF(utun_memfail_##test, utun_##test, desc, \ 382 T_META_ENVVAR("memfail=127"), \ 383 T_META_ENVVAR("ignorefail=true")); 384 BATSUTUN_TESTS; 385 #undef X 386 387 /* 388 * This is equivalent to the following legacy test command: 389 * skywalk_tests --memfail 0 noop 390 */ 391 T_DECL_REF(noop_memcleanup, noop, "run noop test to cleanup memory failure sysctl", 392 T_META_NAMESPACE("xnu.skyawlk.memcleanup"), 393 T_META_ENVVAR("memfail=0")); 394 395 /* 396 * This is equivalent to the following legacy test command: 397 * skywalk_tests --ignorefail --shutdown --itersecs 1 shutdown 398 * Note that in the legacy test, the --itersecs option had a value of 60, but 399 * here we used 1. That's because the legacy tests ran a group of tests, but here 400 * it is only for a single test. 401 */ 402 #define X(test, desc, ...) \ 403 T_DECL(shutdown_##test, desc, \ 404 T_META_ENVVAR("ignorefail=true"), \ 405 T_META_ENVVAR("shutdown=true"), \ 406 T_META_ENVVAR("itersecs=1")) \ 407 EXPAND_TO_T_DECL_COMMON(test, desc) 408 SHUTDOWN_TESTS; 409 #undef X 410