testing/next: python, pylint, gitlab update
cover testing/next: python, pylint, gitlab update
Most of this stuff is already reviewed but I've done a quick sweep for other patches for a potential PR on Monday assuming I get a clean CI.
Alex.
Alex Bennée (5):
python/qemu: split arg between base and harness lists python/qemu: split console from harness args python/qemu: dump a developer friendly version of cmdline to logs tests/functional: tell pylint not to check c-modules
gitlab: remove build target hacks
Daniel P. Berrangé (2):
gitlab: ensure "check-XXX' jobs capture functional test logs
gitlab: update bug template for sec issues & tool assistance
.gitlab-ci.d/buildtest-template.yml | 18 +++++++++--------- .gitlab-ci.d/macos.yml | 7 ++----- .gitlab/issue_templates/bug.md | 11 +++++++++-- python/qemu/machine/machine.py | 29 ++++++++++++++++++++++++----- tests/functional/pylintrc | 1 + 5 files changed, 45 insertions(+), 21 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/7 python/qemu: split arg between base and harness lists
There are argument we add because we want the test harness to control QEMU and arguments we default for handling the display and machine type. Split the obvious ones between base_args and a new list called harness_args.
We will leave the complexity of the serial ports for now.
Message-ID: <[email protected]>
--- python/qemu/machine/machine.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
python/qemu/machine/machine.py +10 -4
@@ -292,8 +292,8 @@ def _load_io_log(self) -> None: self._iolog = iolog.read() @property - def _base_args(self) -> List[str]: - args = ['-display', 'none', '-vga', 'none'] + def _harness_args(self) -> List[str]: + args: List[str] = [] if self._qmp_set: if self._sock_pair:
@@ -307,8 +307,6 @@ def _base_args(self) -> List[str]: args.extend(['-chardev', moncdev, '-mon', 'chardev=mon,mode=control']) - if self._machine is not None: - args.extend(['-machine', self._machine]) for _ in range(self._console_index): args.extend(['-serial', 'null']) if self._console_set:
@@ -323,6 +321,13 @@ def _base_args(self) -> List[str]: args.extend(['-device', device]) return args + @property + def _base_args(self) -> List[str]: + args: List[str] = ['-display', 'none', '-vga', 'none'] + if self._machine is not None: + args.extend(['-machine', self._machine]) + return args + @property def args(self) -> List[str]: """Returns the list of arguments given to the QEMU binary."""
@@ -366,6 +371,7 @@ def _pre_launch(self) -> None: self._qemu_full_args = tuple(chain( self._wrapper, [self._binary], + self._harness_args, self._base_args, self._args ))
Signature · 1 line
2.47.3
PATCH 2/7 python/qemu: split console from harness args
In reply to Alex BennéeBefore we mess with the console output lets create a new helper just for that.
Message-ID: <[email protected]>
--- python/qemu/machine/machine.py | 5 +++++ 1 file changed, 5 insertions(+)
python/qemu/machine/machine.py +5 -0
@@ -306,7 +306,11 @@ def _harness_args(self) -> List[str]: moncdev = f"socket,id=mon,path={self._monitor_address}" args.extend(['-chardev', moncdev, '-mon', 'chardev=mon,mode=control']) + return args + @property + def _console_args(self) -> List[str]: + args: List[str] = [] for _ in range(self._console_index): args.extend(['-serial', 'null']) if self._console_set:
@@ -372,6 +376,7 @@ def _pre_launch(self) -> None: self._wrapper, [self._binary], self._harness_args, + self._console_args, self._base_args, self._args ))
Signature · 1 line
2.47.3
PATCH 3/7 python/qemu: dump a developer friendly version of cmdline to logs
In reply to Alex BennéeNow we have the arguments nicely split up we can make _console_args a function call and present a slightly different version to the logs to save developers manually hacking the command line up.
Message-ID: <[email protected]>
--- python/qemu/machine/machine.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
python/qemu/machine/machine.py +12 -4
@@ -308,12 +308,15 @@ def _harness_args(self) -> List[str]: 'chardev=mon,mode=control']) return args - @property - def _console_args(self) -> List[str]: + def _console_args(self, interactive=False) -> List[str]: args: List[str] = [] + # redirect pre_console_index serials to null for _ in range(self._console_index): args.extend(['-serial', 'null']) - if self._console_set: + + if interactive: + args.extend(['-serial', 'mon:stdio']) + elif self._console_set: assert self._cons_sock_pair is not None fd = self._cons_sock_pair[0].fileno() chardev = f"socket,id=console,fd={fd}"
@@ -376,7 +379,7 @@ def _pre_launch(self) -> None: self._wrapper, [self._binary], self._harness_args, - self._console_args, + self._console_args(), self._base_args, self._args ))
@@ -485,6 +488,11 @@ def _launch(self) -> None: """ self._pre_launch() LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args)) + # Log a simplified, developer-runnable command: + # Exclude harness-managed infrastructure args (harness_args) + # and wrapper. + debug_cmd = [self._binary] + self._console_args(interactive=True) + self._base_args + self._args + LOG.debug('Developer-runnable command: %r', ' '.join(debug_cmd)) # Cleaning up of this subprocess is guaranteed by _do_shutdown. # pylint: disable=consider-using-with
Signature · 1 line
2.47.3
PATCH 4/7 tests/functional: tell pylint not to check c-modules
In reply to Alex BennéeTo fix:
qemu-test.test_pylint "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83: I1101: Module 'cv2' has no 'imread' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)"
Manually running python3 showed I could indeed import cv2 and call those functions. Rather than allowing pylint to introspect lets just tell it to skip c modules.
Message-ID: <[email protected]>
Message-ID: <[email protected]>
--- tests/functional/pylintrc | 1 + 1 file changed, 1 insertion(+)
tests/functional/pylintrc +1 -0
@@ -58,6 +58,7 @@ confidence=HIGH, # no Warning level messages displayed, use "--disable=all --enable=classes # --disable=W". disable=bad-inline-option, + c-extension-no-member, consider-using-f-string, file-ignored, fixme,
Signature · 1 line
2.47.3
PATCH 5/7 gitlab: ensure "check-XXX' jobs capture functional test logs
In reply to Alex BennéeFrom: Daniel P. Berrangé <[email protected]>
A small subset of functional tests are run by default with 'make check', and so run in the context of 'check-XXX' CI jobs, rather than 'functional-XXX' CI jobs. Thus we need to capture the functional test logs unconditionally for all test jobs.
Message-ID: <[email protected]>
--- .gitlab-ci.d/buildtest-template.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
.gitlab-ci.d/buildtest-template.yml +9 -9
@@ -78,6 +78,15 @@ extends: .meson_job_template stage: test image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + when: always + expire_in: 7 days + paths: + - build/meson-logs + - build/tests/functional/*/*/*.log + reports: + junit: build/meson-logs/*.junit.xml script: - source scripts/ci/gitlab-ci-section - section_start buildenv "Setting up to run tests"
@@ -111,15 +120,6 @@ paths: - ${CI_PROJECT_DIR}/functional-cache policy: pull-push - artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - when: always - expire_in: 7 days - paths: - - build/meson-logs - - build/tests/functional/*/*/*.log - reports: - junit: build/meson-logs/*.junit.xml before_script: - export QEMU_TEST_ALLOW_UNTRUSTED_CODE=1 - export QEMU_TEST_CACHE_DIR=${CI_PROJECT_DIR}/functional-cache
Signature · 1 line
2.47.3
PATCH 6/7 gitlab: remove build target hacks
In reply to Alex BennéeSince eef29e060dc (meson: build macOS signed binary as part of the default target) we should be able to do a plain build and everything just work.
--- .gitlab-ci.d/macos.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
.gitlab-ci.d/macos.yml +2 -5
@@ -29,7 +29,6 @@ - cd build - ../configure --enable-werror $CONFIGURE_ARGS || { cat config.log meson-logs/meson-log.txt; exit 1; } - $MAKE -j$(sysctl -n hw.ncpu) - - for TARGET in $TEST_BINARIES ; do $MAKE $TARGET ; done - for TARGET in $TEST_TARGETS ; do $MAKE $TARGET ; done aarch64-macos-15-build:
@@ -45,8 +44,7 @@ aarch64-macos-15-build: --cross-prefix-i386=i686-elf- --cross-prefix-x86_64=x86_64-elf- --disable-plugins - TEST_BINARIES: qemu-system-aarch64 qemu-system-i386 qemu-system-x86_64 - TEST_TARGETS: check-unit run-tcg-tests-aarch64-softmmu run-tcg-tests-i386-softmmu run-tcg-tests-x86_64-softmmu + TEST_TARGETS: check-unit check-tcg aarch64-macos-26-build: extends: .macos_job_template
@@ -62,5 +60,4 @@ aarch64-macos-26-build: --cross-prefix-i386=i686-elf- --cross-prefix-x86_64=x86_64-elf- --disable-plugins - TEST_BINARIES: qemu-system-aarch64 qemu-system-i386 qemu-system-x86_64 - TEST_TARGETS: check-unit run-tcg-tests-aarch64-softmmu run-tcg-tests-i386-softmmu run-tcg-tests-x86_64-softmmu + TEST_TARGETS: check-unit check-tcg
Signature · 1 line
2.47.3
Re: [PATCH 6/7] gitlab: remove build target hacks
Quoted 9 lines · Alex Bennée
Since
eef29e060dc(meson: build macOS signed binary as part of the default target) we should be able to do a plain build and everything just work.Signed-off-by Alex Bennée <[email protected]>--- .gitlab-ci.d/macos.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
PATCH 7/7 gitlab: update bug template for sec issues & tool assistance
In reply to Alex BennéeFrom: Daniel P. Berrangé <[email protected]>
Warn that a security issue must have the "confidential" flag set and that any findings from automated tools must be validated before submission.
Message-ID: <[email protected]>
--- .gitlab/issue_templates/bug.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
.gitlab/issue_templates/bug.md +9 -2
@@ -13,8 +13,9 @@ older than this should be reported to the distribution instead. See https://www.qemu.org/contribute/report-a-bug/ for additional guidance. -If this is a security issue, please consult -https://www.qemu.org/contribute/security-process/ +If this is a security issue, ensure this ticket is marked 'confidential' +before submission. See https://www.qemu.org/contribute/security-process/ +for additional guidance --> ## Host environment
@@ -49,6 +50,12 @@ https://www.qemu.org/contribute/security-process/ 2. 3. +<!-- +Note: if this issue was discovered with the assistance of automated +tooling LLM, static analysis, fuzzers), the reporter must disclose +that in the description. The steps to reproduce, and any other findings, +must be fully validated by the user of the tool prior to submission. +--> ## Additional information
Signature · 1 line
2.47.3
Re: [PATCH 7/7] gitlab: update bug template for sec issues & tool assistance
Quoted 6 lines · Alex Bennée
From: Daniel P. Berrangé <[email protected]>
Warn that a security issue must have the "confidential" flag set and that any findings from automated tools must be validated before submission.
Quoted 7 lines
Signed-off-by Daniel P. Berrangé <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- .gitlab/issue_templates/bug.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)