diff options
| author | OreoFR <tony37160@hotmail.fr> | 2026-11-30 11:29:46 +0100 |
|---|---|---|
| committer | OreoFR <tony37160@hotmail.fr> | 2026-11-30 11:29:46 +0100 |
| commit | ca71fd7f5c04ca3ec269fd3983e7201ac3344b8b (patch) | |
| tree | c92cfb77f76f7fd422f7efefcc8468526384af17 /scripts/dev.py | |
| parent | e76cabc17a7400d6ab73da0e2689554b182df52a (diff) | |
| parent | 012b79a6787cd47d31dcf023eb2b67a1eac6d77f (diff) | |
Merge remote-tracking branch 'origin/main' into reprise-1837
Diffstat (limited to 'scripts/dev.py')
| -rw-r--r-- | scripts/dev.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/scripts/dev.py b/scripts/dev.py index fada30da4..00bf1bb21 100644 --- a/scripts/dev.py +++ b/scripts/dev.py | |||
| @@ -13,6 +13,7 @@ from pathlib import Path | |||
| 13 | ROOT = Path(__file__).resolve().parents[1] | 13 | ROOT = Path(__file__).resolve().parents[1] |
| 14 | BOOT_TRACE = "tools/boot_trace.py" | 14 | BOOT_TRACE = "tools/boot_trace.py" |
| 15 | GUEST_SCENE = "scripts/run_guest_scene.py" | 15 | GUEST_SCENE = "scripts/run_guest_scene.py" |
| 16 | SMOKE = "scripts/smoke.py" | ||
| 16 | TOOLS = ( | 17 | TOOLS = ( |
| 17 | ( | 18 | ( |
| 18 | "boot-trace", | 19 | "boot-trace", |
| @@ -29,6 +30,14 @@ TOOLS = ( | |||
| 29 | "Wine when running the Windows loader outside Windows", | 30 | "Wine when running the Windows loader outside Windows", |
| 30 | ), | 31 | ), |
| 31 | ), | 32 | ), |
| 33 | ( | ||
| 34 | "smoke", | ||
| 35 | SMOKE, | ||
| 36 | ( | ||
| 37 | "Python 3.10+", | ||
| 38 | "Synthetic source-only smoke suite (compilation, clean-room, CLI help, fast tests)", | ||
| 39 | ), | ||
| 40 | ), | ||
| 32 | ) | 41 | ) |
| 33 | 42 | ||
| 34 | 43 | ||
| @@ -81,19 +90,21 @@ def guest_scene(args: list[str]) -> int: | |||
| 81 | parser.add_argument("-h", "--help", action="store_true") | 90 | parser.add_argument("-h", "--help", action="store_true") |
| 82 | parser.add_argument("--out", metavar="PATH") | 91 | parser.add_argument("--out", metavar="PATH") |
| 83 | options, _ = parser.parse_known_args(args) | 92 | options, _ = parser.parse_known_args(args) |
| 84 | if not options.help and not options.out: | 93 | if not options.help and not (options.out and options.out.strip()): |
| 85 | parser.error("--out PATH is required to keep the scene results") | 94 | parser.error("--out PATH is required to keep the scene results") |
| 86 | 95 | ||
| 87 | return run_producer(GUEST_SCENE, args) | 96 | return run_producer(GUEST_SCENE, args) |
| 88 | 97 | ||
| 89 | 98 | ||
| 90 | def main() -> int: | 99 | def main(argv: list[str] | None = None) -> int: |
| 91 | # The producer owns its arguments and help. Forward before argparse handles them. | 100 | # The producer owns its arguments and help. Forward before argparse handles them. |
| 92 | argv = sys.argv[1:] | 101 | argv = sys.argv[1:] if argv is None else list(argv) |
| 93 | if argv[:1] == ["boot-trace"]: | 102 | if argv[:1] == ["boot-trace"]: |
| 94 | return run_producer(BOOT_TRACE, argv[1:]) | 103 | return run_producer(BOOT_TRACE, argv[1:]) |
| 95 | if argv[:1] == ["guest-scene"]: | 104 | if argv[:1] == ["guest-scene"]: |
| 96 | return guest_scene(argv[1:]) | 105 | return guest_scene(argv[1:]) |
| 106 | if argv[:1] == ["smoke"]: | ||
| 107 | return run_producer(SMOKE, argv[1:]) | ||
| 97 | 108 | ||
| 98 | parser = argparse.ArgumentParser(description=__doc__) | 109 | parser = argparse.ArgumentParser(description=__doc__) |
| 99 | commands = parser.add_subparsers(dest="command", required=True) | 110 | commands = parser.add_subparsers(dest="command", required=True) |
| @@ -101,13 +112,17 @@ def main() -> int: | |||
| 101 | inventory.add_argument("--json", action="store_true", help="write a JSON inventory to stdout") | 112 | inventory.add_argument("--json", action="store_true", help="write a JSON inventory to stdout") |
| 102 | commands.add_parser("boot-trace", help="summarize startup and D3D12 boot traces") | 113 | commands.add_parser("boot-trace", help="summarize startup and D3D12 boot traces") |
| 103 | commands.add_parser("guest-scene", help="run the synthetic guest scene with a required --out") | 114 | commands.add_parser("guest-scene", help="run the synthetic guest scene with a required --out") |
| 115 | commands.add_parser("smoke", help="run the synthetic source-only smoke suite (DX-07)") | ||
| 104 | args = parser.parse_args(argv) | 116 | args = parser.parse_args(argv) |
| 105 | 117 | ||
| 106 | result = discover() | 118 | result = discover() |
| 107 | if args.json: | 119 | if args.json: |
| 108 | print(json.dumps(result, indent=2)) | 120 | print(json.dumps(result, indent=2)) |
| 109 | else: | 121 | else: |
| 110 | sys.stdout.reconfigure(encoding="utf-8") | 122 | try: |
| 123 | sys.stdout.reconfigure(encoding="utf-8") | ||
| 124 | except (AttributeError, ValueError, OSError): | ||
| 125 | pass | ||
| 111 | print("Paths and help commands are relative to the Leonida checkout root.") | 126 | print("Paths and help commands are relative to the Leonida checkout root.") |
| 112 | for tool in result["tools"]: | 127 | for tool in result["tools"]: |
| 113 | status = "present" if tool["present"] else "missing" | 128 | status = "present" if tool["present"] else "missing" |