xref: /xnu-11417.121.6/tests/skywalk/skywalk_mptests.c (revision a1e26a70f38d1d7daa7b49b258e2f8538ad81650)
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 <darwintest.h>
29 #include <darwintest_multiprocess.h>
30 #include <unistd.h>
31 
32 #include "skywalk/skywalk_test_driver.h"
33 #include "skywalk/skywalk_test_common.h"
34 
35 #define BATS_TESTS \
36 	X(mp100noop, "test just returns true from 100 children") \
37 	X(mpprotons, "test skywalk protocol namespace with two process doing conflicting reservation") \
38 	X(xferudp, "UDP bi-directional transfer over fake ethernet pair") \
39 	X(xferudpn, "UDP bi-directional transfer over native fake ethernet pair") \
40 	X(xferudpnsp, "UDP bi-directional transfer over native fake ethernet pair with split rx/tx pools") \
41 	X(xferudpfcs, "UDP bi-directional transfer over fake ethernet pair with link frame check sequence") \
42 	X(xferudptrailer, "UDP bi-directional transfer over fake ethernet pair with link trailer") \
43 	X(xferudpnfcs, "UDP bi-directional transfer over native fake ethernet pair with link frame check sequence") \
44 	X(xferudpntrailer, "UDP bi-directional transfer over native fake ethernet pair with link trailer") \
45 	X(xferudpoverwhelm, "UDP bi-directional transfer over fake ethernet pair overwhelm") \
46 	X(xferudpoverwhelmn, "UDP bi-directional transfer over native fake ethernet pair overwhelm") \
47 	X(xferudpoverwhelmnsp, "UDP bi-directional transfer over native fake ethernet pair overwhelm with split rx/tx pools") \
48 	X(xferudpping, "UDP ping-pong over fake ethernet pair") \
49 	X(xferudppingn, "UDP ping-pong over native fake ethernet pair") \
50 	X(xferudpping1, "UDP ping-pong once over fake ethernet pair") \
51 	X(xferudpping1n, "UDP ping-pong once over native fake ethernet pair") \
52 	X(xferudpping1wrong, "UDP ping-pong once over fake ethernet pair with wrong flow IDs") \
53 	X(xfertcpsynflood, "TCP SYN flood") \
54 	X(xfertcprstflood, "TCP RST flood") \
55 	X(xferudpwitherrors, "UDP bi-directional transfer over native fake ethernet pair with injected errors") \
56 	X(xferudpwitherrorscompat, "UDP bi-directional transfer over compat fake ethernet pair with injected errors") \
57 	X(xferudpping_aqm, "UDP ping-pong over fake ethernet pair with AQM") \
58 	X(xferudppingn_aqm, "UDP ping-pong over native fake ethernet pair with AQM") \
59 	X(xfertcpportzero, "TCP connect to port 0") \
60 	X(xferudpportzero, "UDP connect to port 0") \
61 	X(xfersetuponly, "setup fake ethernet pair only") \
62 	X(xfersetuponlyn, "setup native fake ethernet pair only") \
63 	X(xferudppingn_wmm, "UDP ping-pong over native fake ethernet pair in wmm mode") \
64 	X(xferflowmatch, "Packets not matching registered flow tuple should be dropped") \
65 	X(xferflowcleanup, "verification of flow cleanup on channel close") \
66 	X(xferudppingn_mb, "UDP ping-pong over native fake ethernet pair with multi-buflet packet") \
67 	X(xferfastlane, "fastlane qos marking") \
68 	X(xferfastlanen, "fastlane qos marking over native") \
69 	X(xferrfc4594, "rfc4594 qos marking") \
70 	X(xferrfc4594n, "rfc4594 qos marking over native") \
71 	X(xfercsumoffload, "Packet checksum offload") \
72 	X(xfercsumoffloadn, "Packet checksum offload over native") \
73 	X(xferudpfrags, "UDP fragmentation test (channel flow Tx)") \
74 	X(xferudpbadfrags, "UDP fragmentation test (channel flow Tx)") \
75 	X(xferlistenertcprst, "TCP Listner should be able to send RST") \
76 	X(netifdirecttxrx, "netif direct send receive test") \
77 	X(netifdirecttxrxsp, "netif direct send receive test with split rx/tx pools") \
78 	X(netifdirectifadvdisable, "netif interface advisory disabled test") \
79 	X(netifdirectchanevents, "netif interface channel events test") \
80 	X(netifdirectexpiryevents, "netif interface expiry events test") \
81 	X(xferudpifadvenable, "flowswitch interface advisory enabled test") \
82 	X(xferudpifadvdisable, "flowswitch interface advisory disabled test") \
83 	X(xferudpchanevents, "flowswitch channel events test") \
84 	X(xferudpchaneventsasync, "flowswitch channel events in async mode test") \
85 	X(xferudppingnll, "UDP ping-pong over low latency channel on native fake ethernet pair") \
86 	X(xferudppingllink, "UDP ping-pong over fake ethernet pair in llink mode") \
87 	X(xferudppingllink_wmm, "UDP ping-pong over fake ethernet pair in llink & wmm mode") \
88 	X(xferudppingllink_multi, "UDP ping-pong over fake ethernet pair in multi llink mode") \
89 	X(xferparentchildflow, "flowswitch parent child flows test") \
90 	X(xferparentchildflown, "flowswitch parent child flows on native fake ethernet interface test") \
91 	X(xferparentchildflow_offset_400, "flowswitch parent child flows test with demux offset 400") \
92 	X(xferparentchildflown_offset_400, "flowswitch parent child flows on native fake ethernet interface test with demux offset 400") \
93 	X(xferrdudpping, "UDP ping-pong between redirect and fake ethernet interface")
94 
95 /*
96  * This is equivalent to the following legacy test command:
97  * skywalk_mptests bats
98  */
99 #define X(test, desc, ...)                                                 \
100 	T_DECL(test, desc, T_META_NAMESPACE("xnu.skywalk_mptests"))        \
101 	{                                                                  \
102 	        const char *ignorefail_str = getenv("ignorefail");         \
103 	        bool ignorefail = false;                                   \
104 	        if (ignorefail_str) {                                      \
105 	                T_LOG("ignorefail option present");                \
106 	                ignorefail = true;                                 \
107 	        }                                                          \
108 	        skywalk_mptest_driver_run(&skt_##test, ignorefail);        \
109 	}
110 BATS_TESTS;
111 #undef X
112