modify harness framework

This commit is contained in:
김경종
2026-09-08 10:30:07 +09:00
parent 1239d5b9f6
commit 1a0f3c9aaf
68 changed files with 6729 additions and 957 deletions
@@ -0,0 +1,36 @@
from uuid import uuid4
from .base import AdapterError
from ..models import (CommandSpec, ProjectKind, ResultCheck, ResultCheckKind,
ValidationPlan, ValidationStep)
class DotnetAdapter:
def create_plan(self, root, selection, config, tools):
root = root.resolve()
if not config.dotnet.test_projects:
raise AdapterError("dotnet.testProjects must specify the product tests")
tests = tuple(dict.fromkeys(config.dotnet.test_projects))
targets = tuple(dict.fromkeys((selection.project_file, *tests)))
configuration = config.dotnet.configuration
steps = []
for action in ("restore", "build"):
for target in targets:
argv = (str(tools.dotnet), action, str(target))
# Restore and build must evaluate the same conditional references.
if action == "restore":
argv += (f"-p:Configuration={configuration}",)
else:
argv += ("-c", configuration, "--no-restore", "-warnaserror")
steps.append(ValidationStep(CommandSpec(argv, root, f"{action}: {target.name}")))
results = root / ".harness/test-results" / uuid4().hex
for index, target in enumerate(tests):
directory = results / str(index)
argv = (str(tools.dotnet), "test", str(target), "-c", configuration,
"--no-build", "--no-restore", "--logger", "trx",
"--results-directory", str(directory))
steps.append(ValidationStep(
CommandSpec(argv, root, f"test: {target.name}"),
(ResultCheck(ResultCheckKind.TRX_HAS_TESTS, directory),),
))
return ValidationPlan(ProjectKind.DOTNET, tuple(steps))