allow filtering tests to run
This commit is contained in:
parent
6c65b1dfac
commit
b09edd28fe
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# TODO load all saves from the save/ dir
|
||||||
saves = [
|
saves = [
|
||||||
'brush2_01',
|
'brush2_01',
|
||||||
'brush_01',
|
'brush_01',
|
||||||
@ -23,11 +24,22 @@ displays = {
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
def test_list(arg: str) -> [str]:
|
||||||
|
items = arg.split(',')
|
||||||
|
tests = []
|
||||||
|
for item in items:
|
||||||
|
# TODO regex?
|
||||||
|
if not item in saves:
|
||||||
|
raise argparse.ArgumentTypeError(f'Test {item} is not available. Available tests are: {saves}')
|
||||||
|
tests.append(item)
|
||||||
|
return tests
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Generate scripts and makefiles for rendertest')
|
parser = argparse.ArgumentParser(description='Generate scripts and makefiles for rendertest')
|
||||||
parser.add_argument('--script', '-s', type=argparse.FileType('w'), help='Console script for generating images')
|
parser.add_argument('--script', '-s', type=argparse.FileType('w'), help='Console script for generating images')
|
||||||
|
parser.add_argument('--tests', '-t', type=test_list, default=saves, help='Run only these tests')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
def make_script(file):
|
def make_script(file, tests: [str]):
|
||||||
header = '''sv_cheats 1
|
header = '''sv_cheats 1
|
||||||
developer 0
|
developer 0
|
||||||
m_ignore 1
|
m_ignore 1
|
||||||
@ -42,18 +54,24 @@ rt_debug_fixed_random_seed 31337
|
|||||||
|
|
||||||
file.write(header)
|
file.write(header)
|
||||||
|
|
||||||
for save in saves:
|
for test in tests:
|
||||||
screenshot_base = 'rendertest/'
|
screenshot_base = 'rendertest/'
|
||||||
file.write(f'load rendertest_{save}\n')
|
file.write(f'load rendertest_{test}\n')
|
||||||
file.write(f'wait 4; echo DONE WAIT4; playersonly; wait 11\n')
|
file.write(f'wait 4; echo DONE WAIT4; playersonly; wait 11\n')
|
||||||
# for i in range(13):
|
# for i in range(13):
|
||||||
# file.write(f'echo FRAME {i+4}; wait 1;\n')
|
# file.write(f'echo FRAME {i+4}; wait 1;\n')
|
||||||
for name, display in displays.items():
|
for name, display in displays.items():
|
||||||
file.write(f'rt_debug_display_only "{display}"; screenshot {screenshot_base}{save}_{name}.tga; wait 1\n')
|
file.write(f'rt_debug_display_only "{display}"; screenshot {screenshot_base}{test}_{name}.tga; wait 1\n')
|
||||||
file.write('\n')
|
file.write('\n')
|
||||||
|
|
||||||
file.write('quit\n')
|
file.write('quit\n')
|
||||||
|
|
||||||
if args.script:
|
if args.script:
|
||||||
print(f'Generating script {args.script.name}')
|
print(f'Generating script {args.script.name}')
|
||||||
make_script(args.script)
|
make_script(args.script, args.tests)
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# - single command to do everything: compile, run, and compare
|
||||||
|
# - filter by specific save files
|
||||||
|
# - parallel processing
|
||||||
|
# - HTML report
|
||||||
|
@ -63,6 +63,7 @@ convert_png() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run() {
|
run() {
|
||||||
|
time compile
|
||||||
prepare
|
prepare
|
||||||
time generate
|
time generate
|
||||||
time compare
|
time compare
|
||||||
|
Loading…
Reference in New Issue
Block a user