feat: Add container execution backend (Docker/Podman)#22
Open
germainh512 wants to merge 1 commit intogvsoc:mainfrom
Open
feat: Add container execution backend (Docker/Podman)#22germainh512 wants to merge 1 commit intogvsoc:mainfrom
germainh512 wants to merge 1 commit intogvsoc:mainfrom
Conversation
Add support for running tests inside containers (Docker/Podman) while operating on the host filesystem via transparent bind mounts. Container config can be set at three levels (in priority order): 1. Testset-level: testset.set_container(image='...', setup='...') 2. gvtest.yaml: container section in hierarchical config 3. Inherited from parent testsets Key design decisions: - Transparent mounts: the container sees the same absolute paths as the host, so build artifacts are directly accessible from either side without any copy step - Single 'docker run' per test: all commands in a test execute in one container invocation - Works with both regular Shell tests and pytest integration - Supports Docker and Podman via 'runtime' config - JUnit XML for pytest batches is written to the test workdir (visible in both host and container) New files: - python/gvtest/container.py: ContainerConfig class - tests/test_container.py: 20 unit tests Modified files: - config.py: Parse 'container' from gvtest.yaml hierarchy - tests.py: Wrap Shell commands in docker run when configured - pytest_integration.py: Container-aware discovery and batch execution - testset_impl.py: set_container() and get_container() methods - testsuite.py: Abstract interface for container support - runner.py: Auto-apply container config from gvtest.yaml - __init__.py: Export ContainerConfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for running gvtest tests inside containers (Docker/Podman) while operating on the host filesystem via transparent bind mounts. This enables multi-project test suites where each project requires its own containerized environment, while keeping test artifacts directly accessible on the host.
Motivation
When integrating test suites from different projects, each may require its own set of toolchains, SDKs, and dependencies. Containers provide isolated environments, but traditionally require copying artifacts in and out. This feature lets gvtest orchestrate tests across multiple containers transparently — the container sees the same filesystem paths as the host, so build outputs, logs, and binaries are directly usable from either side.
Usage
Container config can be set at three levels (highest priority first):
1. In
testset.cfg(programmatic)2. In
gvtest.yaml(declarative, zero code changes)3. Inherited from parent testsets
Child testsets inherit the container config from their parent unless they override it.
Key Design Decisions
-v /path:/path), so all paths work identically on both sidesdocker runper test: All Shell commands within a test execute in one container invocation--collect-only) and batch execution run inside the container when configured; JUnit XML is written to the workdir (visible on both sides)runtimefieldgvtest.yamlhierarchy, the most specific (leaf-most) container config fully overrides parent configs (no merging)Changes
python/gvtest/container.pyContainerConfigclass withbuild_run_cmd(),from_dict(),validate()python/gvtest/config.pycontainerfromgvtest.yamlhierarchypython/gvtest/tests.pyShellcommands indocker runwhen container is configuredpython/gvtest/pytest_integration.pypython/gvtest/testset_impl.pyset_container()andget_container()with parent inheritancepython/gvtest/testsuite.pypython/gvtest/runner.pygvtest.yamlon testset importpython/gvtest/__init__.pyContainerConfigtests/test_container.pyTesting