Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU
@ 2026-12-03 12:09 Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

This series mainly:
- Fixes two bugs
- Adds arm64 support with QEMU
- Fixes two minor issues

---
Changes in v3:
- Drop "Allow suppressing noisy bluetoothd debug output" for now. Will
  send it separately, with an alternative, -d<log_path>, for discussion
- Link to v2: https://patch.msgid.link/20261125-tr_arm64-v2-0-4f02989f17ba@oss.qualcomm.com

Changes in v2:
- Add two test-runner fixes previously sent separately
- Add two minor test-runner fixes
- Document the architecture requirement in doc/test-runner.rst
- Print an error if QEMU fails to start
- Link to v1: https://patch.msgid.link/20261122-tr_arm64-v1-0-4eccf35daeca@oss.qualcomm.com

---
Zijun Hu (6):
      tools/test-runner: Fix TESTHOME parsing for short paths
      tools/test-runner: Fix termination of the emulator
      doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/
      tools/test-runner: Add arm64 support with QEMU
      tools/test-runner: Fix snprintf(..., "%s", NULL) with -a
      tools/test-runner: Fix spurious 9p root mount error

 doc/test-runner.rst | 25 ++++++++++++---------
 tools/test-runner.c | 63 +++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 64 insertions(+), 24 deletions(-)
---
base-commit: 736384fcdc45dc343c8109317510f4e2a31bd7fb
change-id: 20261122-tr_arm64-c6751a5cf021

Best regards,
--  
Zijun Hu <zijun.hu@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  2026-12-03 17:44   ` tools/test-runner: Add arm64 support with QEMU bluez.test.bot
  2026-12-03 12:09 ` [PATCH bluez v3 2/6] tools/test-runner: Fix termination of the emulator Zijun Hu
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

TESTHOME is parsed wrongly if its value is shorter than 4 characters.
Taking command line "TESTHOME=/ TESTDBUS=0" as an example, TESTHOME is
parsed as the wrong "/ TESTDBUS=0" instead of the right "/", which
causes the following error:

  $ cd /
  $ tools/test-runner -k /pathto/bzImage -- /bin/bash

  tools/test-runner TESTHOME=/ TESTDBUS=0 TESTDAEMON=0 ...
  ......
  Running command /bin/bash
  New process 67 created
  Changing into directory / TESTDBUS=0
  Failed to change directory: No such file or directory

Fix by searching from @ptr + 9, the TESTHOME value start, instead of
@home + 9.

Fixes: e622e623de13 ("build: Add test-runner utility for virtual machine execution")
Assisted-by: Claude:claude-opus-5-5
---
Previous version:
https://lore.kernel.org/all/20261119-fix_test_runner-v1-1-ddad300e86ed@oss.qualcomm.com

Changes since previous version:
- Improve the commit message with command and error log
---
 tools/test-runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 8a8406642209..a4d86a2576f2 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2169,17 +2169,17 @@ static void run_tests(void)
 			audio_server = strndup(start, end - start);
 			printf("Audio server %s requested\n", audio_server);
 		}
 	}
 
 	ptr = strstr(cmdline, "TESTHOME=");
 	if (ptr) {
 		home = ptr + 4;
-		ptr = strpbrk(home + 9, " \r\n");
+		ptr = strpbrk(ptr + 9, " \r\n");
 		if (ptr)
 			*ptr = '\0';
 	}
 
 	run_command(cmds, home);
 }
 
 static void usage(void)

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 2/6] tools/test-runner: Fix termination of the emulator
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

There is an obvious bug in run_command(): it intends to terminate the
emulator, but wrongly sends SIGTERM to the D-Bus system daemon instead.

Fix by sending SIGTERM to @emulator_pid instead of @dbus_pid.

Fixes: 850003734a74 ("test-runner: Add option to start emulator")
Assisted-by: Claude:claude-opus-5-5
---
Previous version:
https://lore.kernel.org/all/20261120-fix_kvm-v1-1-234e5043b516@oss.qualcomm.com

Changes since previous version:
- Improve the commit message
---
 tools/test-runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index a4d86a2576f2..fcf9621c3505 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -2066,17 +2066,17 @@ start_next:
 
 	if (dbus_pid > 0)
 		kill(dbus_pid, SIGTERM);
 
 	if (dbus_session_pid > 0)
 		kill(dbus_session_pid, SIGTERM);
 
 	if (emulator_pid > 0)
-		kill(dbus_pid, SIGTERM);
+		kill(emulator_pid, SIGTERM);
 
 	if (monitor_pid > 0)
 		kill(monitor_pid, SIGTERM);
 
 	if (serial_fd >= 0)
 		close(serial_fd);
 }
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 2/6] tools/test-runner: Fix termination of the emulator Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 4/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

The btintel_pcie driver is enabled by CONFIG_BT_INTEL_PCIE, not
CONFIG_BT_HCIBTINTEL_PCIE, which does not exist.

Also split CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y into two lines.

Assisted-by: Claude:claude-opus-5-5
---
 doc/test-runner.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/doc/test-runner.rst b/doc/test-runner.rst
index 220a2cec1c55..b5876e4f5108 100644
--- a/doc/test-runner.rst
+++ b/doc/test-runner.rst
@@ -190,17 +190,18 @@ option (like the Bluetooth subsystem) can be enabled on top of this.
 	CONFIG_NET_9P=y
 	CONFIG_NET_9P_VIRTIO=y
 
 	CONFIG_9P_FS=y
 	CONFIG_9P_FS_POSIX_ACL=y
 
 	CONFIG_SERIAL_8250=y
 	CONFIG_SERIAL_8250_CONSOLE=y
-	CONFIG_SERIAL_8250_PCI=yCONFIG_DEBUG_KERNEL=y
+	CONFIG_SERIAL_8250_PCI=y
+	CONFIG_DEBUG_KERNEL=y
 	CONFIG_SERIAL_8250_NR_UARTS=4
 
 	CONFIG_TMPFS=y
 	CONFIG_TMPFS_POSIX_ACL=y
 	CONFIG_TMPFS_XATTR=y
 
 	CONFIG_DEVTMPFS=y
 	CONFIG_DEBUG_FS=y
@@ -381,17 +382,17 @@ Running shell with host controller PCIe-passthrough
 
 In addition the above kernel config option the following is required:
 
 .. code-block::
 
 	CONFIG_PCI=y
 	CONFIG_PCI_MSI=y
 	CONFIG_ACPI=y
-	CONFIG_BT_HCIBTINTEL_PCIE=y
+	CONFIG_BT_INTEL_PCIE=y
 
 IOMMU and interrupt remapping, without which vfio-pci fails to allocate
 MSI-X vectors (-ENOSPC):
 
 .. code-block::
 
 	CONFIG_INTEL_IOMMU=y
 	CONFIG_INTEL_IOMMU_DEFAULT_ON=y

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 4/6] tools/test-runner: Add arm64 support with QEMU
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
                   ` (2 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH bluez v3 3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 5/6] tools/test-runner: Fix snprintf(..., "%s", NULL) with -a Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 6/6] tools/test-runner: Fix spurious 9p root mount error Zijun Hu
  5 siblings, 0 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

Add arm64 support by:
- Using qemu-system-aarch64 with the virt machine to boot an arm64
  guest kernel
- Passing -cpu max or host, as the default virt CPU is 32-bit
- Using earlycon and leaving out the x86-only options
- Warning when /dev/kvm is not accessible, as QEMU then falls back
  to TCG
- Documenting that test-runner must be built for an architecture
  compatible with both the host and the guest kernel

Assisted-by: Claude:claude-opus-5-5
---
Note: the upstream kernel does not support UML on arm64.
---
 doc/test-runner.rst | 18 +++++++++++-------
 tools/test-runner.c | 49 ++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/doc/test-runner.rst b/doc/test-runner.rst
index b5876e4f5108..35dee021d8a0 100644
--- a/doc/test-runner.rst
+++ b/doc/test-runner.rst
@@ -21,34 +21,38 @@ OPTIONS
 :-m/--monitor: Start btmon
 :-l/--emulator[=num]: Start btvirt
 :-A/-audio[=path]: Start audio server
 :-u/--unix[=path]: Provide serial device
 :-U/--usb=<qemu_args>: Provide USB device
 :-P/--pcie=<qemu_args>: Provide PCIe device
 :-q/--qemu=<path>: QEMU binary
 :-H/--qemu-host-cpu: Use host CPU (requires KVM support)
-:-k/--kernel=<image>: Kernel image (bzImage) or User Mode Linux binary
+:-k/--kernel=<image>: Kernel image or source tree path:
+
+    | x86: bzImage or User Mode Linux binary
+    | arm64: Image, Image.gz, vmlinuz.efi, uImage
 :-F/--virtiofs[=<path>]: Path to virtiofsd, or no to disable virtio-fs
 :-T/--time-travel: Run a User Mode Linux kernel on simulated time, with
     btvirt as time travel calendar (default if the kernel supports it)
 :-R/--real-time: Run a User Mode Linux kernel on real time
 :-o/--option=<opt>: Additional argument passed to QEMU, or kernel
     parameter with User Mode Linux
 :-h/--help: Show help options
 
 ARCHITECTURE
 ============
 
-**test-runner(1)** is both the launcher and the guest ``init``.  When run
-normally it builds a QEMU command line and starts QEMU, replacing itself
-with it unless it has to stay around to clean up after a ``virtiofsd`` or
-a passed-through PCIe device.  The same binary is re-executed inside the
-guest as PID 1, where it sets up the sandbox and runs the requested
-command::
+**test-runner(1)** is both the launcher and the guest ``init``, so it must
+be built for an architecture compatible with both the host and the guest
+kernel, and fails otherwise.  When run normally it builds a QEMU command
+line and starts QEMU, replacing itself with it unless it has to stay
+around to clean up after a ``virtiofsd`` or a passed-through PCIe device.
+The same binary is re-executed inside the guest as PID 1, where it sets
+up the sandbox and runs the requested command::
 
     ┌────────────────────────────────────────────────────────┐
     │ test-runner (launcher)                                 │
     │   ├ virtiofsd (optional)  ←─── vhost-user ───┐         │
     │   └ qemu                                     │         │
     │      ┌──── guest ─────────────────────────────┴─────┐  │
     │      │ kernel (bzImage), init=test-runner           │  │
     │      │   ├ prepare_sandbox()                        │  │
diff --git a/tools/test-runner.c b/tools/test-runner.c
index fcf9621c3505..3c3c21269984 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -128,20 +128,25 @@ static void strv_cleanup(struct strv *s)
 
 	for (i = 0; i < s->i; ++i)
 		free(s->strv[i]);
 
 	memset(s, 0, sizeof(*s));
 }
 
 static const char *qemu_table[] = {
+#if defined(__aarch64__)
+	"qemu-system-aarch64",
+	"/usr/bin/qemu-system-aarch64",
+#else
 	"qemu-system-x86_64",
 	"qemu-system-i386",
 	"/usr/bin/qemu-system-x86_64",
 	"/usr/bin/qemu-system-i386",
+#endif
 	NULL
 };
 
 static const char *find_qemu(void)
 {
 	int i;
 
 	for (i = 0; qemu_table[i]; i++) {
@@ -150,21 +155,26 @@ static const char *find_qemu(void)
 		if (!stat(qemu_table[i], &st))
 			return qemu_table[i];
 	}
 
 	return NULL;
 }
 
 static const char *kernel_table[] = {
+#if defined(__aarch64__)
+	"Image",
+	"arch/arm64/boot/Image",
+#else
 	"bzImage",
 	"arch/x86/boot/bzImage",
 	"vmlinux",
 	"arch/x86/boot/vmlinux",
 	"linux",
+#endif
 	NULL
 };
 
 /* A User Mode Linux kernel is an executable with the .uml.setup.init
  * section, through which it registers its command line options.
  */
 static bool is_uml_kernel(const char *path)
 {
@@ -420,16 +430,19 @@ static char *const qemu_envp[] = {
 
 static void check_virtualization(void)
 {
 #ifdef HAVE_GET_CPUID
 	unsigned int eax, ebx, ecx, edx;
 
 	if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & (1 << 5)))
 		printf("Found support for Virtual Machine eXtensions\n");
+#elif defined(__aarch64__)
+	if (access("/dev/kvm", R_OK | W_OK) < 0)
+		fprintf(stderr, "No access to /dev/kvm, falling back to TCG\n");
 #endif
 }
 
 #define PCI_DEVICES_PATH "/sys/bus/pci/devices"
 
 static char pcie_bdf[16];
 static char pcie_driver[64];
 
@@ -894,16 +907,18 @@ static void qemu_signal(int sig)
 	if (qemu_pid > 0)
 		kill(qemu_pid, sig);
 }
 
 static int start_qemu(void)
 {
 	char cwd[PATH_MAX/2], initcmd[PATH_MAX], testargs[PATH_MAX];
 	const char *fscmdline;
+	const char *earlycon;
+	const char *noacpi;
 	char cmdline[CMDLINE_MAX];
 	char *argv_strv[EXTRA_OPT_MAX + 64];
 	struct strv _cleanup_(strv_cleanup) argv = { argv_strv,
 							ARRAY_SIZE(argv_strv) };
 	struct rootfs _cleanup_(rootfs_cleanup) rootfs = {{0}};
 	int i, pos, status = 0;
 	pid_t pid;
 
@@ -933,54 +948,71 @@ static int start_qemu(void)
 	}
 
 	if (!virtiofsd)
 		fscmdline = "rootfstype=9p "
 				"rootflags=trans=virtio,version=9p2000.u";
 	else
 		fscmdline = "rootfstype=virtiofs root=/dev/root";
 
+#if defined(__aarch64__)
+	earlycon = "earlycon";
+	noacpi = "";
+#else
+	earlycon = "earlyprintk=serial";
+	/* PCIe passthrough requires ACPI and APIC for device enumeration
+	 * and MSI interrupts.
+	 */
+	noacpi = pcie_dev ? "" : "acpi=off pci=noacpi noapic";
+#endif
+
 	snprintf(cmdline, sizeof(cmdline),
-				"console=hvc0 earlyprintk=serial "
+				"console=hvc0 %s "
 				"no_hash_pointers=1 %s %s quiet ro init=%s "
 				"TESTHOME=%s TESTDBUS=%u TESTDAEMON=%u "
 				"TESTDBUSSESSION=%u XDG_RUNTIME_DIR=/run/user/0 "
 				"TESTMONITOR=%u TESTEMULATOR=%u TESTDEVS=%d "
 				"TESTAUTO=%u TESTAUDIO='%s' TESTARGS=\'%s\'",
+				earlycon,
 				fscmdline,
-				/* PCIe passthrough requires ACPI and APIC for
-				 * device enumeration and MSI interrupts.
-				 */
-				pcie_dev ? "" : "acpi=off pci=noacpi noapic",
+				noacpi,
 				initcmd, cwd, start_dbus, start_daemon,
 				start_dbus_session,
 				start_monitor, num_emulator, num_devs,
 				run_auto, audio_server ? audio_server : "",
 				testargs);
 
 	/* Make sure qemu_binary is not null */
 	if (!qemu_binary) {
 		fprintf(stderr, "No QEMU binary is set\n");
 		return EXIT_FAILURE;
 	}
 
 	strv_append(&argv, "%s", qemu_binary);
 	strv_concat(&argv, qemu_argv);
 
+#if defined(__aarch64__)
+	strv_append(&argv, "-machine");
+	strv_append(&argv, "virt,gic-version=max,accel=kvm:tcg");
+
+	strv_append(&argv, "-cpu");
+	strv_append(&argv, qemu_host_cpu ? "host" : "max");
+#else
 	/* Interrupt remapping is required to pass through a device using
 	 * MSI-X, which in turn needs the split irqchip.
 	 */
 	strv_append(&argv, "-machine");
 	strv_append(&argv, "type=q35,accel=kvm:tcg%s",
 			pcie_dev ? ",kernel-irqchip=split" : "");
 
 	if (qemu_host_cpu) {
 		strv_append(&argv, "-cpu");
 		strv_append(&argv, "host");
 	}
+#endif
 
 	strv_append(&argv, "-kernel");
 	strv_append(&argv, "%s", kernel_image);
 	strv_append(&argv, "-append");
 	strv_append(&argv, "%s", cmdline);
 
 	coverage_setup(&argv, cwd);
 
@@ -994,18 +1026,20 @@ static int start_qemu(void)
 	if (usb_dev) {
 		strv_append(&argv, "-device");
 		strv_append(&argv, "qemu-xhci");
 		strv_append(&argv, "-device");
 		strv_append(&argv, "%s", usb_dev);
 	}
 
 	if (pcie_dev) {
+#if !defined(__aarch64__)
 		strv_append(&argv, "-device");
 		strv_append(&argv, "intel-iommu,intremap=on");
+#endif
 		strv_append(&argv, "-device");
 		strv_append(&argv, "%s", pcie_dev);
 	}
 
 	if (!rootfs_setup(&rootfs, &argv))
 		return EXIT_FAILURE;
 
 	for (i = 0; i < num_extra_opts; ++i)
@@ -2195,18 +2229,19 @@ static void usage(void)
 		"\t-m, --monitor          Start btmon\n"
 		"\t-l, --emulator[=num]   Start btvirt\n"
 		"\t-A, --audio[=path]     Start audio server\n"
 		"\t-u, --unix[=path]      Provide serial device\n"
 		"\t-U, --usb <qemu_args>  Provide USB device\n"
 		"\t-P, --pcie <qemu_args> Provide PCIe device\n"
 		"\t-q, --qemu <path>      QEMU binary\n"
 		"\t-H, --qemu-host-cpu    Use host CPU (requires KVM support)\n"
-		"\t-k, --kernel <image>   Kernel bzImage, User Mode Linux\n"
-		"\t                       binary or source tree path\n"
+		"\t-k, --kernel <image>   Kernel image or source tree path,\n"
+		"\t                       x86: bzImage or User Mode Linux\n"
+		"\t                       arm64: Image, Image.gz, vmlinuz.efi, uImage\n"
 		"\t-F, --virtiofs[=<path>]  Virtiofsd path or 'no'\n"
 		"\t-T, --time-travel      Run User Mode Linux on simulated\n"
 		"\t                       time, with btvirt as calendar\n"
 		"\t                       (default if supported)\n"
 		"\t-R, --real-time        Run User Mode Linux on real time\n"
 		"\t-o, --option <opt>     Additional argument passed to QEMU,\n"
 		"\t                       or kernel parameter with User\n"
 		"\t                       Mode Linux\n"

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 5/6] tools/test-runner: Fix snprintf(..., "%s", NULL) with -a
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
                   ` (3 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH bluez v3 4/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  2026-12-03 12:09 ` [PATCH bluez v3 6/6] tools/test-runner: Fix spurious 9p root mount error Zijun Hu
  5 siblings, 0 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

With -a, no command is given and test_argv[0] is argv[argc], which is
NULL, but it is passed to snprintf() for "%s" when building TESTARGS.

Fix by using an empty string if test_argv[0] is NULL.

Also correct the messages for the tmpfs config mounts, which are
mounted rather than created.

Fixes: 1856a335d8d6 ("tools: Add testing target to run all known test scripts")
Assisted-by: Claude:claude-opus-5-5
---
 tools/test-runner.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 3c3c21269984..2b84e36300d4 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -392,22 +392,22 @@ static void prepare_sandbox(void)
 
 	printf("Creating new session group leader\n");
 	setsid();
 
 	printf("Setting controlling terminal\n");
 	ioctl(STDIN_FILENO, TIOCSCTTY, 1);
 
 	for (i = 0; config_table[i]; i++) {
-		printf("Creating %s\n", config_table[i]);
+		printf("Mounting tmpfs to %s\n", config_table[i]);
 
 		if (mount("tmpfs", config_table[i], "tmpfs",
 				MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_STRICTATIME,
 				"mode=0755") < 0)
-			perror("Failed to create filesystem");
+			perror("Failed to mount filesystem");
 	}
 
 	enable_printk();
 }
 
 static const char *const qemu_argv[] = {
 	"-nodefaults",
 	"-no-user-config",
@@ -927,17 +927,17 @@ static int start_qemu(void)
 	if (!getcwd(cwd, sizeof(cwd)))
 		strcat(cwd, "/");
 
 	if (own_binary[0] == '/')
 		snprintf(initcmd, sizeof(initcmd), "%s", own_binary);
 	else
 		snprintf(initcmd, sizeof(initcmd), "%s/%s", cwd, own_binary);
 
-	pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0]);
+	pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0] ? : "");
 
 	for (i = 1; i < test_argc; i++) {
 		int len = sizeof(testargs) - pos;
 		int n = snprintf(testargs + pos, len, " %s", test_argv[i]);
 
 		if (n < 0 || n >= len) {
 			fprintf(stderr, "Buffer overflow detected in "
 					"testargs\n");
@@ -1243,17 +1243,17 @@ static int start_uml(void)
 	if (!getcwd(cwd, sizeof(cwd)))
 		strcat(cwd, "/");
 
 	if (own_binary[0] == '/')
 		snprintf(initcmd, sizeof(initcmd), "%s", own_binary);
 	else
 		snprintf(initcmd, sizeof(initcmd), "%s/%s", cwd, own_binary);
 
-	pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0]);
+	pos = snprintf(testargs, sizeof(testargs), "%s", test_argv[0] ? : "");
 
 	for (i = 1; i < test_argc; i++) {
 		int len = sizeof(testargs) - pos;
 		int n = snprintf(testargs + pos, len, " %s", test_argv[i]);
 
 		if (n < 0 || n >= len) {
 			fprintf(stderr, "Buffer overflow detected in "
 					"testargs\n");

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH bluez v3 6/6] tools/test-runner: Fix spurious 9p root mount error
  2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
                   ` (4 preceding siblings ...)
  2026-12-03 12:09 ` [PATCH bluez v3 5/6] tools/test-runner: Fix snprintf(..., "%s", NULL) with -a Zijun Hu
@ 2026-12-03 12:09 ` Zijun Hu
  5 siblings, 0 replies; 8+ messages in thread
From: Zijun Hu @ 2026-12-03 12:09 UTC (permalink / raw)
  To: Linux Bluetooth
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Pauli Virtanen,
	Bastien Nocera, Zijun Hu

Booting with the 9p root logs a spurious error:

  9p: Bad value for 'source'
  VFS: Mounted root (9p filesystem) readonly on device 0:25.

Without root=, the kernel first mounts the 9p root with an empty source,
which is rejected, then retries with "/dev/root", which happens to match
the mount_tag.

Fix by passing root=/dev/root, as already done for virtio-fs and UML.

Assisted-by: Claude:claude-opus-5-5
---
 doc/test-runner.rst | 2 +-
 tools/test-runner.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/test-runner.rst b/doc/test-runner.rst
index 35dee021d8a0..7ffcff72a2a5 100644
--- a/doc/test-runner.rst
+++ b/doc/test-runner.rst
@@ -79,17 +79,17 @@ available, a ``virtiofsd`` process is started alongside QEMU and exports
     -numa    node,memdev=mem0
     -append  "... rootfstype=virtiofs root=/dev/root ..."
 
 Since vhost-user requires the guest memory to be shareable, the machine
 memory is backed by a memfd object.  Otherwise, the fallback is 9p::
 
     -fsdev local,id=fsdev-root,path=/,readonly=on,security_model=none
     -device virtio-9p-pci,fsdev=fsdev-root,mount_tag=/dev/root
-    -append "... rootfstype=9p rootflags=trans=virtio,version=9p2000.u ..."
+    -append "... rootfstype=9p root=/dev/root rootflags=trans=virtio,version=9p2000.u ..."
 
 9p passthrough is noticeably more CPU intensive, so virtio-fs is used by
 default whenever possible.
 
 Either way the kernel command line also carries the launcher settings::
 
     -append "... init=<test-runner> TESTHOME=<cwd> TESTARGS='<command>' ..."
 
diff --git a/tools/test-runner.c b/tools/test-runner.c
index 2b84e36300d4..1af9fa700d81 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -943,17 +943,17 @@ static int start_qemu(void)
 					"testargs\n");
 			return EXIT_FAILURE;
 		}
 
 		pos += n;
 	}
 
 	if (!virtiofsd)
-		fscmdline = "rootfstype=9p "
+		fscmdline = "rootfstype=9p root=/dev/root "
 				"rootflags=trans=virtio,version=9p2000.u";
 	else
 		fscmdline = "rootfstype=virtiofs root=/dev/root";
 
 #if defined(__aarch64__)
 	earlycon = "earlycon";
 	noacpi = "";
 #else

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: tools/test-runner: Add arm64 support with QEMU
  2026-12-03 12:09 ` [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu
@ 2026-12-03 17:44   ` bluez.test.bot
  0 siblings, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2026-12-03 17:44 UTC (permalink / raw)
  To: linux-bluetooth, zijun.hu

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1230566/

---Test result---

Test Summary:
CheckPatch                    PASS      2.04 seconds
GitLint                       FAIL      1.48 seconds
BuildEll                      PASS      13.76 seconds
BluezMake                     PASS      177.46 seconds
MakeCheck                     PASS      12.99 seconds
MakeDistcheck                 PASS      102.44 seconds
CheckValgrind                 PASS      241.22 seconds
CheckSmatch                   PASS      187.52 seconds
bluezmakeextell               PASS      64.03 seconds
TestFunctional                PASS      905.58 seconds
IncrementalBuild              PASS      195.15 seconds
ScanBuild                     PASS      605.38 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[bluez,v3,3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/

1: T1 Title exceeds max length (81>80): "[bluez,v3,3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/"


https://github.com/bluez/bluez/pull/2970

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-12-03 17:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:09 [PATCH bluez v3 0/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
2026-12-03 12:09 ` [PATCH bluez v3 1/6] tools/test-runner: Fix TESTHOME parsing for short paths Zijun Hu
2026-12-03 17:44   ` tools/test-runner: Add arm64 support with QEMU bluez.test.bot
2026-12-03 12:09 ` [PATCH bluez v3 2/6] tools/test-runner: Fix termination of the emulator Zijun Hu
2026-12-03 12:09 ` [PATCH bluez v3 3/6] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/ Zijun Hu
2026-12-03 12:09 ` [PATCH bluez v3 4/6] tools/test-runner: Add arm64 support with QEMU Zijun Hu
2026-12-03 12:09 ` [PATCH bluez v3 5/6] tools/test-runner: Fix snprintf(..., "%s", NULL) with -a Zijun Hu
2026-12-03 12:09 ` [PATCH bluez v3 6/6] tools/test-runner: Fix spurious 9p root mount error Zijun Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox