statcheck/testrunner
2024-09-01 20:23:34 -04:00

40 lines
1.1 KiB
Python
Executable file

#!/usr/bin/env python3
#
# Copyright (C) 2024 Simon Howard
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version. This program is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
import os
from os.path import join
import shlex
import sys
from common import *
source_port = os.getenv("SOURCE_PORT")
assert source_port != "", "SOURCE_PORT environment variable not set."
lmp_file, out_file = sys.argv[1:]
cfg = read_config(lmp_file)
args = [
source_port,
"-iwad", join("iwads", cfg["iwad"]),
"-statdump", out_file,
"-timedemo", lmp_file,
] + shlex.split(os.getenv("DOOMOPTS", ""))
if "gameversion" in cfg:
args.extend(("-gameversion", cfg["gameversion"]))
if "pwad" in cfg:
args.extend(("-file", join("extract", cfg["pwad"])))
command = shlex.join(args) + " >/dev/null 2>&1"
print(command)
os.system(command)