Skip to content

Commit 18f9299

Browse files
authored
Merge pull request #1254 from microsoft/enhancement-ci-windows-test-system
[ci] Support System Tests in Windows
2 parents bdb1fe0 + 3204fb1 commit 18f9299

File tree

4 files changed

+142
-2
lines changed

4 files changed

+142
-2
lines changed

tools/ci/config/test/catnapw.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
catnapw:
2+
udp_ping_pong: {}
3+
udp_push_pop: {}
4+
tcp_close:
5+
nclients: [32]
6+
run_mode: [sequential, concurrent]
7+
who_closes: [client, server]
8+
tcp_wait:
9+
nclients: [32]
10+
scenario: [push_close_wait, push_async_close_wait,
11+
push_async_close_pending_wait, pop_close_wait,
12+
pop_async_close_wait,
13+
pop_async_close_pending_wait]
14+
tcp_ping_pong: {}
15+
tcp_push_pop: {}
16+
tcp_echo:
17+
bufsize: [64, 1024]
18+
nclients: [1, 32]
19+
nrequests: [128, 1024]
20+
run_mode: [sequential, concurrent]
21+
nthreads: [1, 2, 4]

tools/ci/job/factory.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,22 @@ def integration_test(self, run_mode="") -> BaseJob:
6868

6969
def system_test(self, test_name: str, niterations: int = 0, run_mode: str = "", nclients: int = 0, bufsize: int = 0, nrequests: int = 0, nthreads: int = 1, who_closes: str = "", scenario: str = "") -> BaseJob:
7070
if self.config["platform"] == "windows":
71-
raise Exception("System tests are not supported on Windows")
71+
if test_name == "tcp_echo":
72+
return windows.TcpEchoTest(self.config, run_mode, nclients, bufsize, nrequests, nthreads)
73+
elif test_name == "tcp_close":
74+
return windows.TcpCloseTest(self.config, run_mode=run_mode, who_closes=who_closes, nclients=nclients)
75+
elif test_name == "tcp_wait":
76+
return windows.TcpWaitTest(self.config, scenario=scenario, nclients=nclients)
77+
elif test_name == "tcp_ping_pong":
78+
return windows.TcpPingPongTest(self.config)
79+
elif test_name == "tcp_push_pop":
80+
return windows.TcpPushPopTest(self.config)
81+
elif test_name == "udp_ping_pong":
82+
return windows.UdpPingPongTest(self.config)
83+
elif test_name == "udp_push_pop":
84+
return windows.UdpPushPopTest(self.config)
85+
else:
86+
raise Exception("Invalid test name")
7287
else:
7388
if self.config["libos"] == "catmem":
7489
if test_name == "open-close":

tools/ci/job/windows.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,110 @@ def execute(self) -> bool:
9898
return super().execute()
9999

100100

101+
class EndToEndTestJobOnWindows(BaseWindowsJob):
102+
103+
def __init__(self, config, job_name: str):
104+
self.job_name = job_name
105+
self.all_pass = config["all_pass"]
106+
super().__init__(config, job_name)
107+
108+
def execute(self, server_cmd: str, client_cmd: str) -> bool:
109+
serverTask: RunOnWindows = RunOnWindows(
110+
super().server(), super().repository(), server_cmd, super().is_debug(), super().is_sudo(), super().config_path())
111+
jobs: dict[str, subprocess.Popen[str]] = {}
112+
jobs[self.job_name + "-server-" +
113+
super().server()] = serverTask.execute()
114+
time.sleep(super().delay())
115+
clientTask: RunOnWindows = RunOnWindows(
116+
super().client(), super().repository(), client_cmd, super().is_debug(), super().is_sudo(), super().config_path())
117+
jobs[self.job_name + "-client-" +
118+
super().client()] = clientTask.execute()
119+
return wait_and_report(self.job_name, super().log_directory(), jobs, self.all_pass)
120+
121+
122+
class SystemTestJobOnWindows(EndToEndTestJobOnWindows):
123+
def __init__(self, config: dict):
124+
self.test_name = config["test_name"]
125+
self.server_args = config["server_args"]
126+
self.client_args = config["client_args"]
127+
super().__init__(config, f"system-test-{config['test_alias']}")
128+
129+
def execute(self) -> bool:
130+
server_cmd: str = f"test-system-rust LIBOS={super().libos()} TEST={self.test_name} ARGS=\\'{self.server_args}\\'"
131+
client_cmd: str = f"test-system-rust LIBOS={super().libos()} TEST={self.test_name} ARGS=\\'{self.client_args}\\'"
132+
return super().execute(server_cmd, client_cmd)
133+
134+
135+
class TcpCloseTest(SystemTestJobOnWindows):
136+
def __init__(self, config: dict, run_mode: str, who_closes: str, nclients: int):
137+
config["test_name"] = "tcp-close"
138+
config["test_alias"] = f"tcp-close-{run_mode}-{who_closes}-closes-sockets"
139+
config["all_pass"] = True
140+
config["server_args"] = f"--peer server --address {config['server_addr']}:12345 --nclients {nclients} --run-mode {run_mode} --whocloses {who_closes}"
141+
config["client_args"] = f"--peer client --address {config['server_addr']}:12345 --nclients {nclients} --run-mode {run_mode} --whocloses {who_closes}"
142+
super().__init__(config)
143+
144+
145+
class TcpEchoTest(SystemTestJobOnWindows):
146+
def __init__(self, config: dict, run_mode: str, nclients: int, bufsize: int, nrequests: int, nthreads: int):
147+
config["test_name"] = "tcp-echo"
148+
config["test_alias"] = f"tcp-echo-{run_mode}-{nclients}-{bufsize}-{nrequests}-{nthreads}"
149+
config["all_pass"] = True
150+
config["server_args"] = f"--peer server --address {config['server_addr']}:12345 --nthreads {nthreads}"
151+
config["client_args"] = f"--peer client --address {config['server_addr']}:12345 --nclients {nclients} --nrequests {nrequests} --bufsize {bufsize} --run-mode {run_mode}"
152+
super().__init__(config)
153+
154+
155+
class TcpPingPongTest(SystemTestJobOnWindows):
156+
def __init__(self, config: dict):
157+
config["test_name"] = "tcp-ping-pong"
158+
config["test_alias"] = "tcp-ping-pong"
159+
config["all_pass"] = True
160+
config["server_args"] = f"--server {config['server_addr']}:12345"
161+
config["client_args"] = f"--client {config['server_addr']}:12345"
162+
super().__init__(config)
163+
164+
165+
class TcpPushPopTest(SystemTestJobOnWindows):
166+
def __init__(self, config: dict):
167+
config["test_name"] = "tcp-push-pop"
168+
config["test_alias"] = "tcp-push-pop"
169+
config["all_pass"] = True
170+
config["server_args"] = f"--server {config['server_addr']}:12345"
171+
config["client_args"] = f"--client {config['server_addr']}:12345"
172+
super().__init__(config)
173+
174+
175+
class TcpWaitTest(SystemTestJobOnWindows):
176+
def __init__(self, config: dict, scenario: str, nclients: int):
177+
config["test_name"] = "tcp-wait"
178+
config["test_alias"] = f"tcp-wait-scenario-{scenario}"
179+
config["all_pass"] = True
180+
config["server_args"] = f"--peer server --address {config['server_addr']}:12345 --nclients {nclients} --scenario {scenario}"
181+
config["client_args"] = f"--peer client --address {config['server_addr']}:12345 --nclients {nclients} --scenario {scenario}"
182+
super().__init__(config)
183+
184+
185+
class UdpPingPongTest(SystemTestJobOnWindows):
186+
def __init__(self, config: dict):
187+
config["test_name"] = "udp-ping-pong"
188+
config["test_alias"] = "udp-ping-pong"
189+
config["all_pass"] = False
190+
config["server_args"] = f"--server {config['server_addr']}:12345 {config['client_addr']}:23456"
191+
config["client_args"] = f"--client {config['client_addr']}:23456 {config['server_addr']}:12345"
192+
super().__init__(config)
193+
194+
195+
class UdpPushPopTest(SystemTestJobOnWindows):
196+
def __init__(self, config: dict):
197+
config["test_name"] = "udp-push-pop"
198+
config["test_alias"] = "udp-push-pop"
199+
config["all_pass"] = True
200+
config["server_args"] = f"--server {config['server_addr']}:12345 {config['client_addr']}:23456"
201+
config["client_args"] = f"--client {config['client_addr']}:23456 {config['server_addr']}:12345"
202+
super().__init__(config)
203+
204+
101205
class IntegrationTestJobOnWindows(BaseWindowsJob):
102206
def __init__(self, config: dict, name: str):
103207
super().__init__(config, name)

tools/demikernel_ci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def run_pipeline(
8181
status["integration_tests"] = factory.integration_test("pop-wait-async").execute()
8282

8383
# STEP 5: Run system tests.
84-
if test_system and config["platform"] == "linux":
84+
if test_system and config["platform"]:
8585
if status["checkout"] and status["compile"]:
8686
ci_map = read_yaml(libos)
8787
# Run pipe-open test.

0 commit comments

Comments
 (0)