Skip to content

Commit 9d8a2a7

Browse files
author
Trong Nhan Mai
committed
test: modify the integration test script to use the compare rc build spec script
Signed-off-by: Trong Nhan Mai <[email protected]>
1 parent d37e1ab commit 9d8a2a7

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tests/integration/run.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def configure_logging(verbose: bool) -> None:
8080
"deps_report": ["tests", "dependency_analyzer", "compare_dependencies.py"],
8181
"vsa": ["tests", "vsa", "compare_vsa.py"],
8282
"find_source": ["tests", "find_source", "compare_source_reports.py"],
83+
"rc_build_spec": ["tests", "build_spec_generator", "reproducible_central", "compare_rc_build_spec.py"],
8384
}
8485

8586
VALIDATE_SCHEMA_SCRIPTS: dict[str, Sequence[str]] = {
@@ -465,6 +466,52 @@ def cmd(self, macaron_cmd: str) -> list[str]:
465466
return args
466467

467468

469+
class GenBuildSpecStepOptions(TypedDict):
470+
"""The configuration options of an gen-build-spec step."""
471+
472+
main_args: Sequence[str]
473+
command_args: Sequence[str]
474+
database: str
475+
476+
477+
class GenBuildSpecStep(Step[GenBuildSpecStepOptions]):
478+
"""A step running the ``macaron gen-build-spec`` command."""
479+
480+
@staticmethod
481+
def options_schema(cwd: str) -> cfgv.Map: # pylint: disable=unused-argument
482+
"""Generate the schema of a gen-build-spec step."""
483+
return cfgv.Map(
484+
"gen-build-spec options",
485+
None,
486+
*[
487+
cfgv.Optional(
488+
key="main_args",
489+
check_fn=cfgv.check_array(cfgv.check_string),
490+
default=[],
491+
),
492+
cfgv.Optional(
493+
key="command_args",
494+
check_fn=cfgv.check_array(cfgv.check_string),
495+
default=[],
496+
),
497+
cfgv.Optional(
498+
key="database",
499+
check_fn=cfgv.check_string,
500+
default="./output/macaron.db",
501+
),
502+
],
503+
)
504+
505+
def cmd(self, macaron_cmd: str) -> list[str]:
506+
"""Generate the command of the step."""
507+
args = [macaron_cmd]
508+
args.extend(self.options["main_args"])
509+
args.append("gen-build-spec")
510+
args.extend(["--database", self.options["database"]])
511+
args.extend(self.options["command_args"])
512+
return args
513+
514+
468515
class VerifyStepOptions(TypedDict):
469516
"""The configuration options of a verify step."""
470517

@@ -599,6 +646,7 @@ def gen_step_schema(cwd: str, check_expected_result_files: bool) -> cfgv.Map:
599646
"verify",
600647
"validate_schema",
601648
"find-source",
649+
"gen-build-spec",
602650
),
603651
),
604652
),
@@ -638,6 +686,12 @@ def gen_step_schema(cwd: str, check_expected_result_files: bool) -> cfgv.Map:
638686
key="options",
639687
schema=VerifyStep.options_schema(cwd=cwd),
640688
),
689+
cfgv.ConditionalRecurse(
690+
condition_key="kind",
691+
condition_value="gen-build-spec",
692+
key="options",
693+
schema=GenBuildSpecStep.options_schema(cwd=cwd),
694+
),
641695
cfgv.ConditionalRecurse(
642696
condition_key="kind",
643697
condition_value="find-source",
@@ -842,6 +896,7 @@ def parse_step_config(step_id: int, step_config: Mapping) -> Step:
842896
"compare": CompareStep,
843897
"validate_schema": ValidateSchemaStep,
844898
"find-source": FindSourceStep,
899+
"gen-build-spec": GenBuildSpecStep,
845900
}[kind]
846901
return step_cls( # type: ignore # https://github.com/python/mypy/issues/3115
847902
step_id=step_id,

0 commit comments

Comments
 (0)