Skip to content

Allow Running vmm Unittests in Parallel #4709

Open
@roypat

Description

@roypat
Contributor

Currently, the unittests in the vmm package have to be run sequentially due to reliance on global state in some virtio device tests. More specifically, various tests in the vsock and rng modules use a global METRICS object (see also #2899). This design using a global METRICS object is fine for production, because a VMM can have at most one vsock and rng device each, however multiple unit tests running in parallel can create multiple device objects, which then simultaneously update the global metrics. Since our tests contain assertions on the value of the metrics to validate functionality, this causes spurious failures.

We can fix this by moving the vsock and rng device to a "per device metrics" model, as already adopted by net and block devices (see for example #4145).

As part of this issue, 3 things will need to be done

  • Update the vsock device to use a "per device metrics" model
    Update the rng device to use a "per device metrics" model
    Fix the test_tap_name test to no longer use a hardcoded value of tap0 (if multiple tests run in parallel and create tap devices, it is no longer guaranteed that the tap device created in this test will be called "tap0", it could be "tap1" or "tap43". Thus we probably just want some sort of regex match on the tap device name).

These can all be addressed in individual PRs, or all in one, depending on how much of a task you want to tackle :)

Activity

added
Good first issueIndicates a good issue for first-time contributors
Priority: MediumIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelled
Status: ParkedIndicates that an issues or pull request will be revisited later
on Jul 29, 2024
changed the title [-]Allow Running `vmm` unittests in parallel[/-] [+]Allow Running `vmm` Unittests in Parallel[/+] on Jul 29, 2024
jackabald

jackabald commented on Aug 2, 2024

@jackabald
Contributor

@roypat

I can try to look at this. Will send PR if I get anywhere.

Thanks!

added
Priority: LowIndicates that an issue or pull request should be resolved behind issues or pull requests labelled `
and removed
Priority: MediumIndicates than an issue or pull request should be resolved ahead of issues or pull requests labelled
on Oct 16, 2024
gjkeller

gjkeller commented on Apr 10, 2025

@gjkeller

@jackabald
CC @roypat

Are you still planning on working on this issue? If not, would I be able to take this on? Thank you!

bchalios

bchalios commented on Apr 16, 2025

@bchalios
Contributor

Hey @gjkeller. There isn't any progress here. Feel free to contribute to it, if you want.

bstrong04

bstrong04 commented on May 7, 2025

@bstrong04

Submitted a hopeful fix to this by working with @gjkeller. If there's any changes needed to be made or if I went in the wrong direction please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueIndicates a good issue for first-time contributorsPriority: LowIndicates that an issue or pull request should be resolved behind issues or pull requests labelled `Status: ParkedIndicates that an issues or pull request will be revisited later

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @gjkeller@bchalios@ShadowCurse@bstrong04@jackabald

      Issue actions

        Allow Running `vmm` Unittests in Parallel · Issue #4709 · firecracker-microvm/firecracker