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