mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-20 23:49:54 +00:00
Merge pull request #3456 from ethereum/testgen-fork-filter
Add `--fork-list` arg to testgen
This commit is contained in:
commit
79bfdad4d0
@ -171,7 +171,6 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
|
|||||||
help="if set re-generate and overwrite test files if they already exist",
|
help="if set re-generate and overwrite test files if they already exist",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-l",
|
|
||||||
"--preset-list",
|
"--preset-list",
|
||||||
dest="preset_list",
|
dest="preset_list",
|
||||||
nargs='*',
|
nargs='*',
|
||||||
@ -179,6 +178,14 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
|
|||||||
required=False,
|
required=False,
|
||||||
help="specify presets to run with. Allows all if no preset names are specified.",
|
help="specify presets to run with. Allows all if no preset names are specified.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--fork-list",
|
||||||
|
dest="fork_list",
|
||||||
|
nargs='*',
|
||||||
|
type=str,
|
||||||
|
required=False,
|
||||||
|
help="specify forks to run with. Allows all if no fork names are specified.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-c",
|
"-c",
|
||||||
"--collect-only",
|
"--collect-only",
|
||||||
@ -199,6 +206,7 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
|
|||||||
print(f"Generating tests into {output_dir}")
|
print(f"Generating tests into {output_dir}")
|
||||||
print(f'Error log file: {log_file}')
|
print(f'Error log file: {log_file}')
|
||||||
|
|
||||||
|
# preset_list arg
|
||||||
presets = args.preset_list
|
presets = args.preset_list
|
||||||
if presets is None:
|
if presets is None:
|
||||||
presets = []
|
presets = []
|
||||||
@ -206,6 +214,14 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
|
|||||||
if len(presets) != 0:
|
if len(presets) != 0:
|
||||||
print(f"Filtering test-generator runs to only include presets: {', '.join(presets)}")
|
print(f"Filtering test-generator runs to only include presets: {', '.join(presets)}")
|
||||||
|
|
||||||
|
# fork_list arg
|
||||||
|
forks = args.fork_list
|
||||||
|
if forks is None:
|
||||||
|
forks = []
|
||||||
|
|
||||||
|
if len(presets) != 0:
|
||||||
|
print(f"Filtering test-generator runs to only include forks: {', '.join(forks)}")
|
||||||
|
|
||||||
collect_only = args.collect_only
|
collect_only = args.collect_only
|
||||||
|
|
||||||
diagnostics_obj = Diagnostics()
|
diagnostics_obj = Diagnostics()
|
||||||
@ -224,6 +240,10 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]):
|
|||||||
if len(presets) != 0 and test_case.preset_name not in presets:
|
if len(presets) != 0 and test_case.preset_name not in presets:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# If fork list is assigned, filter by forks.
|
||||||
|
if len(forks) != 0 and test_case.fork_name not in forks:
|
||||||
|
continue
|
||||||
|
|
||||||
case_dir = get_test_case_dir(test_case, output_dir)
|
case_dir = get_test_case_dir(test_case, output_dir)
|
||||||
print(f"Collected test at: {case_dir}")
|
print(f"Collected test at: {case_dir}")
|
||||||
diagnostics_obj.collected_test_count += 1
|
diagnostics_obj.collected_test_count += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user