tools/test-runner: Add arm64 host support
v2 cover tools/test-runner: Add arm64 host support
This series mainly:
- Fixes two bugs
- Adds support for running on arm64 hosts
- Allows starting bluetoothd without debug output
- Fixes two minor issues
---
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/[email protected]
---
Zijun Hu (7):
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: Allow suppressing noisy bluetoothd debug output tools/test-runner: Fix snprintf(..., "%s", NULL) with -a tools/test-runner: Fix spurious 9p root mount error
doc/test-runner.rst | 41 +++++++++++----- tools/test-runner.c | 131 +++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 129 insertions(+), 43 deletions(-)
---
base-commit: 1adfe662efeff12997df9ddd0960dbd0de9c8ea7
change-id: 20261122-tr_arm64-c6751a5cf021
Best regards,
Signature · 1 line
Zijun Hu <[email protected]>
PATCH v2 1/7 tools/test-runner: Fix TESTHOME parsing for short paths
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.
---
Previous version:
https://lore.kernel.org/all/[email protected]
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(-)
tools/test-runner.c +1 -1
@@ -2167,17 +2167,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 )
Signature · 1 line
2.34.1
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/1222817/
---Test result---
Test Summary:
CheckPatch PASS 3.47 seconds GitLint FAIL 2.31 seconds BuildEll PASS 20.29 seconds BluezMake PASS 313.61 seconds MakeCheck PASS 14.88 seconds MakeDistcheck PASS 148.04 seconds CheckValgrind PASS 354.53 seconds CheckSmatch PASS 317.68 seconds bluezmakeextell PASS 101.07 seconds TestFunctional PASS 1234.81 seconds IncrementalBuild PASS 325.35 seconds ScanBuild PASS 1211.39 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[bluez,v2,3/7] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/
1: T1 Title exceeds max length (81>80): "[bluez,v2,3/7] doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/" [bluez,v2,5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output
1: T1 Title exceeds max length (81>80): "[bluez,v2,5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output"
https://github.com/bluez/bluez/pull/2930
---
Regards,
Linux Bluetooth
PATCH v2 2/7 tools/test-runner: Fix termination of the emulator
In reply to Zijun HuThere 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.
---
Previous version:
https://lore.kernel.org/all/[email protected]
Changes since previous version:
- Improve the commit message
--- tools/test-runner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/test-runner.c +1 -1
@@ -2064,17 +2064,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); }
Signature · 1 line
2.34.1
PATCH v2 3/7 doc/test-runner: s/CONFIG_BT_HCIBTINTEL_PCIE/CONFIG_BT_INTEL_PCIE/
In reply to Zijun HuThe 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.
--- doc/test-runner.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
doc/test-runner.rst +3 -2
@@ -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
Signature · 1 line
2.34.1
PATCH v2 4/7 tools/test-runner: Add arm64 support with QEMU
In reply to Zijun HuAdd 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
---
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(-)
doc/test-runner.rst +11 -7
@@ -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() │ │
tools/test-runner.c +42 -7
205 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 5/7 tools/test-runner: Allow suppressing noisy bluetoothd debug output
In reply to Zijun Hutest-runner always starts bluetoothd with -d, which floods the console with debug output when only the test output is of interest.
Add an optional bluetoothd run mode to -d, e.g. -d2:
- 1: --nodetach -d [-f src/main.conf] (default)
- 2: --nodetach [-f src/main.conf]
Also make supporting other run modes easier in the future.
Existing usage in doc/test-runner.rst still works since -d without a mode behaves as before.
--- doc/test-runner.rst | 16 ++++++++++++- tools/test-runner.c | 68 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 65 insertions(+), 19 deletions(-)
doc/test-runner.rst +15 -1
@@ -12,17 +12,20 @@ it launches a virtual machine using qemu(1) with the host filesystem mounted read-only inside the guest. OPTIONS ======= :-a:--auto: Find tests and run them :-b/--dbus: Start D-Bus system daemon :-s/--dbus-session: Start D-Bus session daemon -:-d/--daemon: Start bluetoothd +:-d/--daemon[=mode]: Start bluetoothd, mode (default 1): + + | 1: --nodetach -d [-f src/main.conf] + | 2: --nodetach [-f src/main.conf] :-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)
@@ -360,16 +363,27 @@ Running bluetoothctl with emulated controller and audio support Running shell with host controller using btproxy ------------------------------------------------ .. code-block:: $ tools/btproxy -u [1] $ tools/test-runner -u -d -k /pathto/bzImage -- /bin/bash [2] +Running bluetoothctl with host controller using btproxy for normal output +-------------------------------------------------------------------------- + +With -d2, bluetoothd is started without -d, so the bluetoothctl console +is not flooded with debug output: + +.. code-block:: + + $ tools/btproxy -u [1] + $ tools/test-runner -u -d2 -k /pathto/bzImage -- client/bluetoothctl [2] + Running shell with host controller USB-passthrough -------------------------------------------------- In addition the above kernel config option the following is required: .. code-block:: CONFIG_USB=y
tools/test-runner.c +50 -18
206 lines not on this page · raw message
Signature · 1 line
2.34.1
Luiz Augusto von Dentz
maintainerRe: [PATCH bluez v2 5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output
Hi Zijun,
Quoted 7 lines · Zijun Hu
test-runner always starts bluetoothd with -d, which floods the console with debug output when only the test output is of interest.
Add an optional bluetoothd run mode to -d, e.g. -d2:
- 1: --nodetach -d [-fsrc/main.conf] (default)
- 2: --nodetach [-fsrc/main.conf]
Let's not do that, the logging is actually important if there is an error. Perhaps we can make -d take an optional path and write the output there rather than omitting all bluetoothd traces.
Quoted 287 lines
Also make supporting other run modes easier in the future.
Existing usage in
doc/test-runner.rststill works since -d without a mode behaves as before.Assisted-by Claude:claude-opus-5-5--- doc/test-runner.rst | 16 ++++++++++++- tools/test-runner.c | 68 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 65 insertions(+), 19 deletions(-)doc/test-runner.rst +15
-1@@ -12,17 +12,20 @@ it launches a virtual machine using qemu(1) with the host filesystem mounted read-only inside the guest. OPTIONS ======= :-a:--auto: Find tests and run them :-b/--dbus: Start D-Bus system daemon :-s/--dbus-session: Start D-Bus session daemon -:-d/--daemon: Start bluetoothd +:-d/--daemon[=mode]: Start bluetoothd, mode (default 1): + + | 1: --nodetach -d [-f src/main.conf] + | 2: --nodetach [-f src/main.conf] :-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)@@ -360,16 +363,27 @@ Running bluetoothctl with emulated controller and audio support Running shell with host controller using btproxy ------------------------------------------------ .. code-block:: $ tools/btproxy -u [1] $ tools/test-runner -u -d -k /pathto/bzImage -- /bin/bash [2] +Running bluetoothctl with host controller using btproxy for normal output +-------------------------------------------------------------------------- + +With -d2, bluetoothd is started without -d, so the bluetoothctl console +is not flooded with debug output: + +.. code-block:: + + $ tools/btproxy -u [1] + $ tools/test-runner -u -d2 -k /pathto/bzImage -- client/bluetoothctl [2] + Running shell with host controller USB-passthrough -------------------------------------------------- In addition the above kernel config option the following is required: .. code-block:: CONFIG_USB=ytools/test-runner.c +50
-19@@ -50,25 +50,26 @@#endif #define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]))#define _cleanup_ (f) __attribute__((cleanup(f)))#define CMDLINE_MAX (2048 * 10)#define EXTRA_OPT_MAX 64 +#define DAEMON_MODE_MAX 3static const char *own_binary;static char **test_argv;static int test_argc;static bool run_auto = false;static bool start_dbus = false;static bool start_dbus_session; -static bool start_daemon = false; +static unsigned int start_daemon;static bool start_monitor = false;static bool qemu_host_cpu = false;/* Simulated time with User Mode Linux: -1 if supported by the kernel */ static int time_travel =-1 ;static int num_devs =0 ;static int num_emulator =0 ;static const char *device_path ="/tmp/bt-server-bredr" ;static const char *qemu_binary =NULL ;@@ -1578,17 +1579,17 @@ static const char *daemon_table[] = {"/usr/sbin/bluetoothd" ,"/usr/libexec/bluetooth/bluetoothd" , NULL };static pid_t start_bluetooth_daemon (const char *home) {const char *daemon =NULL ; -char *argv[6 ], *envp[2 ]; +char *argv[6 ] = {NULL }, *envp[2 ];pid_t pid;struct stat st;int i;if (chdir (home +5 ) <0 ) {perror ("Failed to change home directory for daemon" );return -1 ; }@@ -1603,25 +1604,40 @@ static pid_t start_bluetooth_daemon(const char *home)if (!daemon) {fprintf (stderr,"Failed to locate Bluetooth daemon binary\n" );return -1 ; }printf ("Using Bluetooth daemon %s\n" , daemon); - argv[0 ] = (char *) daemon; - argv[1 ] ="--nodetach" ; - argv[2 ] ="-d" ; - argv[3 ] =NULL ; + i =0 ; + argv[i++] = (char *) daemon; -if (!stat ("src/main.conf" , &st)) { - argv[3 ] ="-f" ; - argv[4 ] ="src/main.conf" ; - argv[5 ] =NULL ; +switch (start_daemon) { +case 1 : + argv[i++] ="--nodetach" ; + argv[i++] ="-d" ; + +if (!stat ("src/main.conf" , &st)) { + argv[i++] ="-f" ; + argv[i++] ="src/main.conf" ; + } +break ; +case 2 : + argv[i++] ="--nodetach" ; + +if (!stat ("src/main.conf" , &st)) { + argv[i++] ="-f" ; + argv[i++] ="src/main.conf" ; + } +break ; +default : +fprintf (stderr,"Invalid daemon mode %u\n" , start_daemon); +return -1 ; } envp[0 ] ="DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket" ; envp[1 ] =NULL ;printf ("Starting Bluetooth daemon\n" ); pid =fork ();@@ -2165,20 +2181,21 @@ static void run_tests(void) } ptr =strstr (cmdline,"TESTDBUSSESSION=1" );if (ptr) {printf ("D-Bus session daemon requested\n" ); start_dbus_session = true; } - ptr =strstr (cmdline,"TESTDAEMON=1" ); + ptr =strstr (cmdline,"TESTDAEMON=" );if (ptr) { -printf ("bluetoothd requested\n" ); - start_daemon = true; + start_daemon =strtoul (ptr +11 ,NULL ,0 ); +if (start_daemon) +printf ("bluetoothd mode %u requested\n" , start_daemon); } ptr =strstr (cmdline,"TESTMONITOR=1" );if (ptr) {printf ("Monitor requested\n" ); start_monitor = true; }@@ -2218,17 +2235,19 @@ static void usage(void) {printf ("test-runner - Automated test execution utility\n" "Usage:\n" );printf ("\ttest-runner [options] [--] <command> [args]\n" );printf ("Options:\n" "\t-a, --all,--auto Find tests and run them\n" "\t-b, --dbus Start D-Bus system daemon\n" "\t-s, --dbus-session Start D-Bus session daemon\n" -"\t-d, --daemon Start bluetoothd\n" +"\t-d, --daemon[=mode] Start bluetoothd, mode (default 1):\n" +"\t 1: --nodetach -d [-f src/main.conf]\n" +"\t 2: --nodetach [-f src/main.conf]\n" "\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"@@ -2247,17 +2266,17 @@ static void usage(void) }static const struct option main_options[] = { {"all" , no_argument,NULL ,'a' }, {"auto" , no_argument,NULL ,'a' }, {"dbus" , no_argument,NULL ,'b' }, {"dbus-session" , no_argument,NULL ,'s' }, {"unix" , optional_argument,NULL ,'u' }, - {"daemon" , no_argument,NULL ,'d' }, + {"daemon" , optional_argument,NULL ,'d' }, {"emulator" , no_argument,NULL ,'l' }, {"monitor" , no_argument,NULL ,'m' }, {"qemu" , required_argument,NULL ,'q' }, {"qemu-host-cpu" , no_argument,NULL ,'H' }, {"kernel" , required_argument,NULL ,'k' }, {"audio" , optional_argument,NULL ,'A' }, {"usb" , required_argument,NULL ,'U' }, {"pcie" , required_argument,NULL ,'P' },@@ -2288,17 +2307,17 @@ int main(int argc, char *argv[])reboot (RB_AUTOBOOT );return EXIT_SUCCESS ; }for (;;) {int opt; opt =getopt_long (argc, argv, -"au::bdsl::mq:Hk:A::U:P:o:F::TRvh" , +"au::bd::sl::mq:Hk:A::U:P:o:F::TRvh" , main_options,NULL );if (opt <0 )break ;switch (opt) {case 'a' : run_auto = true;break ;@@ -2309,18 +2328,31 @@ int main(int argc, char *argv[])break ;case 'b' : start_dbus = true;break ;case 's' : start_dbus_session = true;break ;case 'd' : - start_dbus = true; - start_daemon = true; + start_daemon =1 ; +if (optarg) { +char *endptr; + + start_daemon =strtoul (optarg, &endptr,0 ); +if (start_daemon >=DAEMON_MODE_MAX || + *endptr) { +fprintf (stderr, +"Invalid daemon mode %s\n" , + optarg); +return EXIT_FAILURE ; + } + } +if (start_daemon) + start_dbus = true;break ;case 'l' : num_emulator = optarg ?atoi (optarg) :1 ;break ;case 'm' : start_monitor = true;break ;case 'q' : --2.34.1
Signature · 1 line
Luiz Augusto von Dentz
Re: [PATCH bluez v2 5/7] tools/test-runner: Allow suppressing noisy bluetoothd debug output
Hi Luiz,
Quoted 10 lines · Luiz Augusto von Dentz
Quoted 4 lines · Zijun Hu
Add an optional bluetoothd run mode to -d, e.g. -d2:
- 1: --nodetach -d [-fsrc/main.conf] (default)
- 2: --nodetach [-fsrc/main.conf]Let's not do that, the logging is actually important if there is an error. Perhaps we can make
-dtake an optional path and write the output there rather than omitting all bluetoothd traces.
For test-runner -d/tmp/btd.log ..., is /tmp/btd.log a guest path or a host path?
Currently test-runner starts 'bluetoothd -n -d ...', and -n makes bluetoothd send all debug logs to the console's stderr. To write them to a file, test-runner would redirect stderr to the file. Any other solution to suggest?
Could you consider this instead: add a new option such as -D <log_path> rather than -d<log_path>, and let the optional argument of -d say how to start bluetoothd, e.g. a comma-separated list of bluetoothd's args?
PATCH v2 6/7 tools/test-runner: Fix snprintf(..., "%s", NULL) with -a
In reply to Zijun HuWith -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.
--- tools/test-runner.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/test-runner.c +4 -4
@@ -393,22 +393,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" ,
@@ -928,17 +928,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" );
@@ -1244,17 +1244,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" );
Signature · 1 line
2.34.1
PATCH v2 7/7 tools/test-runner: Fix spurious 9p root mount error
In reply to Zijun HuBooting 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.
--- doc/test-runner.rst | 2 +- tools/test-runner.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
doc/test-runner.rst +1 -1
@@ -82,17 +82,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>' ..."
tools/test-runner.c +1 -1
@@ -944,17 +944,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
Signature · 1 line
2.34.1