From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id AB7F9D46D; Fri, 13 Jun 2025 14:05:45 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id D733ED2CB; Fri, 13 Jun 2025 14:05:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-a3-smtp.messagingengine.com (fhigh-a3-smtp.messagingengine.com [103.168.172.154]) by atuin.qyliss.net (Postfix) with ESMTPS id 177FDD297 for ; Fri, 13 Jun 2025 14:05:27 +0000 (UTC) Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id BDD061140141; Fri, 13 Jun 2025 10:05:24 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Fri, 13 Jun 2025 10:05:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1749823524; x= 1749909924; bh=6LM6bTaOFowOSa/JlV/GUZlkYZc3wImVfUL771B0KXc=; b=k IKdIquAnE0QJ9AUPeN/qGmxQToSVUEizSebPdYvbvVPKGNkgkLI/1wo6p0e0fVVt P8p5FJv0gkVqgpTAQZIXNqFu5jpa+zrVOjMj0lpz2c+hZW5iKurkbEOpCKoBEVw0 CkTFkZFY1H/+ygB7WqbqsiHkV1DqGMpyPG/Mw3PF748Y0dB8K4wnAUTh6ngYK1x0 UyywX/G1nJsznCJE27fCrxrPFxHCw1hJvyXD51xJKlndRE+hgSWyuunJBDOP+215 BrZBwKepJaPlwf2lwPOKCkGS4FazM2Sw9+JSD87gnNYiX+Fdy4mIOKHTAdu2/A9x 7VnxDLGj1F0QpdCAUhg1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1749823524; x=1749909924; bh=6 LM6bTaOFowOSa/JlV/GUZlkYZc3wImVfUL771B0KXc=; b=Q/swThdqxtUsSC/XZ MjpRO5F8nFIzYz9QRqTu42+QAthyVQ96W3ouGl+zP4mL+NcGkr1KFYrNuYfqQP/b Hd+HeAVa8AMHnjdDPz4Dk646GllVAUTGwsbnhrwMvoqy/lEPRZ2cA1UvE82IDGUf JLoXnhRsBnQayB1bG5sUXE7DeAuCdtQMmLbfvXaThHpdlbCqaLFWMXS4+UklihNY HMfovUEMqp0plXNYo5Wr27kSsdaWPjd5tadoFxDEfQOOGM6zit/tC6sN096iqadB QIbZljyRKvb56oEdzmuotd1ck5Em5tIOeNwmQttZH4OxsdLa+75E+QVJJXxTHbgF D2baA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddukedugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvve fufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehlhihsshgrucftohhsshcu oehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepgeeuieduueekkeeivd etffegkeduhfduvedvledvkefhfeeiteekuddujefffeegnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrihhspdhnsg gprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeguvghvvghl sehsphgvtghtrhhumhdqohhsrdhorhhgpdhrtghpthhtohephihukhgrseihuhhkrgdrug gvvh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 Jun 2025 10:05:24 -0400 (EDT) Received: by sf.qyliss.net (Postfix, from userid 1000) id E0143245D670F; Fri, 13 Jun 2025 16:05:20 +0200 (CEST) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 8/8] release/checks/integration: test late serial Date: Fri, 13 Jun 2025 16:05:08 +0200 Message-ID: <20250613140508.76998-9-hi@alyssa.is> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613140508.76998-1-hi@alyssa.is> References: <20250613140508.76998-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 32NKGGI7AF7A3OZWQSRGLMAMHKFNQNQ5 X-Message-ID-Hash: 32NKGGI7AF7A3OZWQSRGLMAMHKFNQNQ5 X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Yureka X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: By "late", I mean the serial device won't be configured by the kernel until full userspace is running. Here I'm doing this with a USB serial device, for which driver modules need to be loaded by the kernel. This is a regression test, because that didn't used to work, since serial consoles were only configured once at boot. Signed-off-by: Alyssa Ross --- release/checks/integration/late-serial.c | 15 +++++++++++++++ release/checks/integration/lib.c | 16 ++++++++++------ release/checks/integration/lib.h | 4 ++++ release/checks/integration/meson.build | 9 ++++++--- 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 release/checks/integration/late-serial.c diff --git a/release/checks/integration/late-serial.c b/release/checks/integration/late-serial.c new file mode 100644 index 0000000..46f312a --- /dev/null +++ b/release/checks/integration/late-serial.c @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: EUPL-1.2+ +// SPDX-FileCopyrightText: 2025 Alyssa Ross + +#include "lib.h" + +void test(struct config c) +{ + c.serial = (typeof(c.serial)) { + .optname = "-device", + .optval = "usb-serial,chardev=socket", + .console = "ttyUSB0", + }; + + start_qemu(c); +} diff --git a/release/checks/integration/lib.c b/release/checks/integration/lib.c index b0b4507..bc2b9dd 100644 --- a/release/checks/integration/lib.c +++ b/release/checks/integration/lib.c @@ -114,10 +114,12 @@ FILE *start_qemu(struct config c) "-drive", nullptr, "-drive", nullptr, "-drive", nullptr, + "-smbios", nullptr, "-m", "4G", "-nodefaults", "-machine", "virtualization=on", "-cpu", "max", + "-device", "qemu-xhci", "-device", "virtio-keyboard", "-device", "virtio-mouse", "-device", "virtio-gpu", @@ -125,19 +127,20 @@ FILE *start_qemu(struct config c) "-device", "e1000e,netdev=net0", "-monitor", "vc", "-vga", "none", - "-smbios", "type=11,value=io.systemd.stub.kernel-cmdline-extra=console=ttyS0", - "-serial", "unix:console", + "-chardev", "socket,id=socket,path=console", + c.serial.optname ? (char *)c.serial.optname : "-serial", + c.serial.optval ? (char *)c.serial.optval : "chardev:socket", nullptr, }; char **efi_arg = &args[2], **img_arg = &args[4], - **user_data_arg = &args[6]; + **user_data_arg = &args[6], **console_arg = &args[8]; if (!(arch = getenv("ARCH"))) { uname(&u); arch = u.machine; } - if (strcmp(arch, "x86_64")) - args[sizeof args / sizeof *args - 3] = nullptr; + if (!c.serial.console && !strcmp(arch, "x86_64")) + c.serial.console = "ttyS0"; console_listener = setup_unix("console"); @@ -153,7 +156,8 @@ FILE *start_qemu(struct config c) if (asprintf(efi_arg, "file=%s,format=raw,if=pflash,readonly=true", c.drives.efi) == -1 || asprintf(img_arg, "file=%s,format=raw,if=virtio,readonly=true", c.drives.img) == -1 || - asprintf(user_data_arg, "file=%s,format=raw,if=virtio,readonly=true", c.drives.user_data) == -1) { + asprintf(user_data_arg, "file=%s,format=raw,if=virtio,readonly=true", c.drives.user_data) == -1 || + asprintf(console_arg, "type=11,value=io.systemd.stub.kernel-cmdline-extra=%s%s", c.serial.console ? "console=" : "", c.serial.console) == -1) { perror("asprintf"); exit(EXIT_FAILURE); } diff --git a/release/checks/integration/lib.h b/release/checks/integration/lib.h index 959573d..743c906 100644 --- a/release/checks/integration/lib.h +++ b/release/checks/integration/lib.h @@ -9,6 +9,10 @@ struct config { struct { const char *efi, *img, *user_data; } drives; + + struct { + const char *optname, *optval, *console; + } serial; }; extern void test(struct config); diff --git a/release/checks/integration/meson.build b/release/checks/integration/meson.build index 7edc314..4a58cce 100644 --- a/release/checks/integration/meson.build +++ b/release/checks/integration/meson.build @@ -7,12 +7,15 @@ project('spectrum-integration-tests', 'c', add_project_arguments('-D_GNU_SOURCE', language : 'c') +run_qemu = find_program('../../../scripts/run-qemu.sh') + lib = static_library('spectrum-integration-test', 'lib.c') -test('networking', executable('networking', 'networking.c', link_with : lib), - args : [ - find_program('../../../scripts/run-qemu.sh'), +foreach test : ['networking', 'late-serial'] + test(test, executable(test, test + '.c', link_with : lib), args : [ + run_qemu, get_option('efi'), get_option('img'), get_option('user_data'), ]) +endforeach -- 2.49.0