mirror of
https://github.com/chocolate-doom/statcheck.git
synced 2024-11-10 07:12:09 +00:00
Initial test runner script
This commit is contained in:
parent
fa2d68af0b
commit
93cc45308e
8 changed files with 56 additions and 2 deletions
|
@ -7,9 +7,9 @@ check: expected output
|
|||
|
||||
output: $(OUTPUTS)
|
||||
|
||||
output/%:
|
||||
output/%.txt: demos/%.lmp
|
||||
@mkdir -p $(dir $@)
|
||||
touch $@ # TODO
|
||||
./testrunner $< $@
|
||||
|
||||
extract/%:
|
||||
unzip $(UNZIPOPTS) -d extract $< $(notdir $@)
|
||||
|
|
2
demos/pwads/av/.democonfig
Normal file
2
demos/pwads/av/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom2.wad
|
||||
pwad: av.wad
|
2
demos/pwads/class_ep/.democonfig
Normal file
2
demos/pwads/class_ep/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom.wad
|
||||
pwad: class_ep.wad
|
2
demos/pwads/hr/.democonfig
Normal file
2
demos/pwads/hr/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom2.wad
|
||||
pwad: hr.wad
|
2
demos/pwads/mm/.democonfig
Normal file
2
demos/pwads/mm/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom2.wad
|
||||
pwad: mm.wad
|
2
demos/pwads/mm2/.democonfig
Normal file
2
demos/pwads/mm2/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom2.wad
|
||||
pwad: mm2.wad
|
2
demos/pwads/requiem/.democonfig
Normal file
2
demos/pwads/requiem/.democonfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
iwad: doom2.wad
|
||||
pwad: requiem.wad
|
42
testrunner
Executable file
42
testrunner
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from os.path import dirname, basename, join, exists
|
||||
import shlex
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
def read_config(path):
|
||||
if path == '':
|
||||
return {}
|
||||
|
||||
# Config deeper in the hierarchy can override config files from
|
||||
# higher up in the hierarchy:
|
||||
result = read_config(dirname(path))
|
||||
config_file = join(path, ".democonfig")
|
||||
if exists(config_file):
|
||||
with open(config_file) as f:
|
||||
result.update(yaml.safe_load(f))
|
||||
|
||||
return result
|
||||
|
||||
lmp_file, out_file = sys.argv[1:]
|
||||
cfg = read_config(lmp_file)
|
||||
|
||||
os.environ["SDL_VIDEODRIVER"] = "dummy"
|
||||
|
||||
args = [
|
||||
"chocolate-doom", "-iwad", cfg["iwad"],
|
||||
"-statdump", out_file,
|
||||
"-timedemo", lmp_file,
|
||||
] + shlex.split("""
|
||||
-mb 16 -nodraw -noblit -nosound
|
||||
-noautoload -nogui -nograbmouse
|
||||
""")
|
||||
|
||||
if "pwad" in cfg:
|
||||
args.extend(("-file", join("extract", cfg["pwad"])))
|
||||
|
||||
print(shlex.join(args))
|
||||
sys.stdout.close()
|
||||
os.spawnvp(os.P_WAIT, args[0], args)
|
Loading…
Reference in a new issue