From 8d3991d6cca1a57ef5c48460313a07f709c89248 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 22 Mar 2025 16:06:35 -0600 Subject: Enable running tests in parallel --- GNUmakefile | 5 ++++- lib9p/tests/runtest | 5 +++-- lib9p/tests/test_server/main.c | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 1311b6e..bae7357 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -74,6 +74,9 @@ generate-clean: platforms := rp2040 host # $(shell sed -nE 's/if *\(PICO_PLATFORM STREQUAL "(.*)"\)/\1/p' cmd/*/CMakeLists.txt) build_types = Debug Release RelWithDebInfo MinSizeRel +export CTEST_PARALLEL_LEVEL = 0 +export CTEST_OUTPUT_ON_FAILURE = 1 + build: $(foreach t,$(build_types),$(foreach p,$(platforms),build/$p-$t/build)) .PHONY: build @@ -89,7 +92,7 @@ check: build .PHONY: check $(foreach t,$(build_types),$(foreach p,$(platforms),build/$p-$t/check)): build/%/check: build/%/Makefile - CTEST_OUTPUT_ON_FAILURE=1 $(MAKE) -C $( +#include /* for atoi() */ #include #include @@ -32,6 +33,7 @@ static lo_interface lib9p_srv_file get_root(struct lib9p_srv_ctx *, struct lib9p const char *hexdig = "0123456789abcdef"; struct { + uint16_t port; struct hostnet_tcp_listener listeners[CONFIG_SRV9P_NUM_CONNS]; struct lib9p_srv srv; } globals = { @@ -146,7 +148,7 @@ static COROUTINE read_cr(void *_i) { int i = *((int *)_i); cr_begin(); - hostnet_tcp_listener_init(&globals.listeners[i], 9000); + hostnet_tcp_listener_init(&globals.listeners[i], globals.port); lib9p_srv_read_cr(&globals.srv, lo_box_hostnet_tcplist_as_net_stream_listener(&globals.listeners[i])); @@ -172,7 +174,10 @@ static COROUTINE init_cr(void *) { cr_exit(); } -int main() { +int main(int argc, char *argv[]) { + if (argc != 2) + error(2, 0, "usage: %s PORT_NUMBER", argv[0]); + globals.port = atoi(argv[1]); struct hostclock clock_monotonic = { .clock_id = CLOCK_MONOTONIC, }; -- cgit v1.2.3-2-g168b