Message ID | f12e6f606a2612fab4d1038d088959710a423a9f.1677579750.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kunit: tool: Add support for SH under QEMU | expand |
On Tue, 28 Feb 2023 at 18:31, Geert Uytterhoeven <geert+renesas@glider.be> wrote: > > On some platforms, the console is not the first serial port. To make > this work, the first serial port in QEMU must be set to "null". > > Add support for this by adding an optional "serial" parameter, which > defaults to "stdio", and can be overridden by platform-specific > configuration. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- Seems good to me, cheers! Reviewed-by: David Gow <davidgow@google.com> Thanks, -- David > tools/testing/kunit/kunit_kernel.py | 3 ++- > tools/testing/kunit/qemu_config.py | 1 + > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py > index 53e90c3358348dbe..64262875993ff070 100644 > --- a/tools/testing/kunit/kunit_kernel.py > +++ b/tools/testing/kunit/kunit_kernel.py > @@ -106,6 +106,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): > self._kernel_path = qemu_arch_params.kernel_path > self._kernel_command_line = qemu_arch_params.kernel_command_line + ' kunit_shutdown=reboot' > self._extra_qemu_params = qemu_arch_params.extra_qemu_params > + self._serial = qemu_arch_params.serial > > def make_arch_config(self, base_kunitconfig: kunit_config.Kconfig) -> kunit_config.Kconfig: > kconfig = kunit_config.parse_from_string(self._kconfig) > @@ -121,7 +122,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): > '-append', ' '.join(params + [self._kernel_command_line]), > '-no-reboot', > '-nographic', > - '-serial', 'stdio'] + self._extra_qemu_params > + '-serial', self._serial] + self._extra_qemu_params > # Note: shlex.join() does what we want, but requires python 3.8+. > print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command)) > return subprocess.Popen(qemu_command, > diff --git a/tools/testing/kunit/qemu_config.py b/tools/testing/kunit/qemu_config.py > index 0b6a80398cccb50f..b1fba9016eed00d0 100644 > --- a/tools/testing/kunit/qemu_config.py > +++ b/tools/testing/kunit/qemu_config.py > @@ -17,3 +17,4 @@ class QemuArchParams: > kernel_path: str > kernel_command_line: str > extra_qemu_params: List[str] > + serial: str = 'stdio' > -- > 2.34.1 >
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index 53e90c3358348dbe..64262875993ff070 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -106,6 +106,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): self._kernel_path = qemu_arch_params.kernel_path self._kernel_command_line = qemu_arch_params.kernel_command_line + ' kunit_shutdown=reboot' self._extra_qemu_params = qemu_arch_params.extra_qemu_params + self._serial = qemu_arch_params.serial def make_arch_config(self, base_kunitconfig: kunit_config.Kconfig) -> kunit_config.Kconfig: kconfig = kunit_config.parse_from_string(self._kconfig) @@ -121,7 +122,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): '-append', ' '.join(params + [self._kernel_command_line]), '-no-reboot', '-nographic', - '-serial', 'stdio'] + self._extra_qemu_params + '-serial', self._serial] + self._extra_qemu_params # Note: shlex.join() does what we want, but requires python 3.8+. print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command)) return subprocess.Popen(qemu_command, diff --git a/tools/testing/kunit/qemu_config.py b/tools/testing/kunit/qemu_config.py index 0b6a80398cccb50f..b1fba9016eed00d0 100644 --- a/tools/testing/kunit/qemu_config.py +++ b/tools/testing/kunit/qemu_config.py @@ -17,3 +17,4 @@ class QemuArchParams: kernel_path: str kernel_command_line: str extra_qemu_params: List[str] + serial: str = 'stdio'
On some platforms, the console is not the first serial port. To make this work, the first serial port in QEMU must be set to "null". Add support for this by adding an optional "serial" parameter, which defaults to "stdio", and can be overridden by platform-specific configuration. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- tools/testing/kunit/kunit_kernel.py | 3 ++- tools/testing/kunit/qemu_config.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)