initial commit
This commit is contained in:
65
container/drivers/verify_companions.py
Normal file
65
container/drivers/verify_companions.py
Normal file
@@ -0,0 +1,65 @@
|
||||
"""Runs inside the archipelago Docker image. Reports which core worlds
|
||||
can actually generate a seed in THIS environment, so the multi-game tests
|
||||
only ever draw companions that work.
|
||||
|
||||
Core worlds are shipped with Archipelago, but that does not make them all
|
||||
usable here: some need a base ROM this container has no copy of, and at
|
||||
least one (Final Fantasy) needs a settings yaml generated by an external
|
||||
website and refuses a generic one. Drawing such a world as a companion
|
||||
fails the whole seed, and the failure gets recorded against the apworld
|
||||
under test rather than the companion that caused it - Blender was marked
|
||||
flaky 7/10 purely because three of its ten draws included worlds like
|
||||
these.
|
||||
|
||||
Rather than maintain an exclusion list by hand, this generates one solo
|
||||
seed per core world and keeps the ones that succeed. A world drops out
|
||||
by itself when its ROM is missing, and comes back by itself once the ROM
|
||||
is added.
|
||||
|
||||
Shares run_test.py's generation machinery rather than repeating it, so
|
||||
"can generate" means exactly the same thing in both places.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
sys.path.insert(0, "/app")
|
||||
|
||||
import run_test # noqa: E402 - mounted alongside this script
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--output-dir", required=True)
|
||||
parser.add_argument("--timeout", type=int, default=120,
|
||||
help="Per-world timeout. Deliberately shorter than the apworld "
|
||||
"timeout: a companion that is slow to generate would multiply "
|
||||
"across every multi-game attempt that draws it.")
|
||||
parser.add_argument("--spoiler", type=int, default=2)
|
||||
args = parser.parse_args()
|
||||
|
||||
warnings.simplefilter("ignore")
|
||||
run_test.ensure_tutorials_default()
|
||||
|
||||
from pathlib import Path
|
||||
Path(args.output_dir).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
verified = []
|
||||
rejected = {}
|
||||
for game in run_test.core_worlds(exclude=None):
|
||||
results, timed_out, elapsed = run_test.run_with_timeout(
|
||||
[game], args.output_dir, args.timeout, spoiler=args.spoiler)
|
||||
outcome, detail = run_test.classify(results, timed_out, elapsed)
|
||||
if outcome == "passed":
|
||||
verified.append(game)
|
||||
else:
|
||||
rejected[game] = f"{outcome}: {detail}"[:300]
|
||||
|
||||
print(json.dumps({"verified": verified, "rejected": rejected}))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user