Skip to content

Fixup the issue where lcov capture fails due to a long path#4341

Merged
chunfuwen merged 1 commit intoavocado-framework:masterfrom
Yingshun:lcov_libvirt
Mar 25, 2026
Merged

Fixup the issue where lcov capture fails due to a long path#4341
chunfuwen merged 1 commit intoavocado-framework:masterfrom
Yingshun:lcov_libvirt

Conversation

@Yingshun
Copy link
Copy Markdown
Contributor

@Yingshun Yingshun commented Mar 13, 2026

The full test case name is longer than before. The lcov output
file was created in test_result/test_debugdir, which caused the
lcov command to fail. Moving the file to test_result to avoid this
issue.
Add "extra_opts" to collect_lcov_coverage() to accept extra lcov
command options.

Test result:

 (1/3) virtio_block_test.block_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_blk.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: STARTED
 (1/3) virtio_block_test.block_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_blk.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: PASS (302.14 s)
 (2/3) virtio_scsi_test.scsi_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_scsi.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.packet_stress.user_type_iface.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: STARTED
 (2/3) virtio_scsi_test.scsi_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_scsi.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.packet_stress.user_type_iface.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: PASS (211.79 s)
 (3/3) virtio_scsi_test.scsi_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_scsi.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: STARTED
 (3/3) virtio_scsi_test.scsi_function_test.HostCpuVendor.intel.Host_RHEL.m10.u2.Hx86_64.vnc.bridge.ovmf.no_virtio_rng.filesystem.no_9p_export.smallpages.no_pci_assignable.qcow2.virtio_scsi.up.virtio_net.package.Guest.Linux.RHEL.10.2.x86_64.type_specific.io-github-autotest-libvirt.virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q35.HostCpuFamily.skylake.HostCpuVersion.4210R.HostCpuVendor.intel.Host.RHEL.m10.u2.Host_arch_x86_64: PASS (310.01 s)

lcov tracefiles:

job-2026-03-15T22.05-4159c95]# find -name coverage*
./test-results/gcov_libvirt/coverage_virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q3_kOHdO8W6.info
./test-results/gcov_libvirt/coverage_virtual_network.qemu_test.packet_stress.user_type_iface.q35.HostCpuFami_DBPo24Mb.info
./test-results/gcov_libvirt/coverage_virtual_network.qemu_test.netperf_stress_test.TCP_STREAM.guest2guest.q3_zH0DrxMw.info


@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue preventing lcov from successfully capturing coverage data. The problem stemmed from the generation of overly long file paths for coverage output, which caused the lcov command to fail. The solution involves strategically relocating the gcov_qemu and gcov_libvirt output directories to a higher level in the test results structure, thereby shortening the paths and ensuring reliable coverage collection for both QEMU and libvirt components.

Highlights

  • LCOV Path Issue Resolution: Addressed an issue where lcov capture failed due to excessively long file paths, particularly when test case names were extended.
  • Coverage Directory Relocation: Modified the logic for creating and managing gcov_qemu and gcov_libvirt directories, moving them directly under test-results/ instead of nested within test-results/{test-dir}/.
  • Working Directory Adjustment: Updated the os.chdir calls to navigate to the newly created gcov_qemu or gcov_libvirt directories before compressing coverage data, ensuring correct archiving.
Changelog
  • virttest/env_process.py
    • Introduced new logic to determine and create gcov_qemu_dir and gcov_libvirt_dir directly under test-results/.
    • Removed previous utils_misc.get_path calls for gcov_qemu_dir and gcov_libvirt_dir.
    • Adjusted os.chdir calls to change into the newly defined gcov_qemu_dir or gcov_libvirt_dir before compression.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request modifies the postprocess function in virttest/env_process.py to change the creation location of QEMU and libvirt coverage directories (gcov_qemu and gcov_libvirt) from test.debugdir to test_results_dir (one level up from test.debugdir) to avoid long path issues. However, the review comments highlight a critical issue where the change in the current working directory (os.chdir) during compression causes the newly created archives to be placed inside the coverage directories, leading to their immediate deletion when shutil.rmtree is called on those directories.

Comment thread virttest/env_process.py Outdated
Comment thread virttest/env_process.py Outdated
@Yingshun Yingshun marked this pull request as draft March 13, 2026 11:53
@Yingshun Yingshun force-pushed the lcov_libvirt branch 2 times, most recently from 03104f6 to f80834c Compare March 16, 2026 01:56
@Yingshun Yingshun marked this pull request as ready for review March 16, 2026 01:56
@Yingshun Yingshun force-pushed the lcov_libvirt branch 6 times, most recently from 8a43d44 to c2e1d6b Compare March 16, 2026 09:56
Copy link
Copy Markdown
Contributor

@cliping cliping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The full test case name is longer than before. The lcov output
file was created in test_result/test_debugdir, which caused the
lcov command to fail. Moving the file to test_result to avoid this
issue.
Add "extra_opts" to collect_lcov_coverage() to accept extra lcov
command options.

Signed-off-by: Yingshun Cui <yicui@redhat.com>
Comment thread virttest/test_setup/gcov.py
@Yingshun Yingshun requested a review from chunfuwen March 24, 2026 09:01
Copy link
Copy Markdown
Contributor

@chunfuwen chunfuwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chunfuwen chunfuwen merged commit d3f276d into avocado-framework:master Mar 25, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants