MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / find_and_prepare_jar

Function find_and_prepare_jar

Tester.py:61–95  ·  view source on GitHub ↗

Finds the generated JAR and moves it to a predictable location.

(test_dir: str, test_name: str, target_dir: str, logs: list)

Source from the content-addressed store, hash-verified

59 logs.append(f"|---- ❌ java exited with code {proc.returncode}")
60 ci_diagnostic(logs, f"STDOUT:\n{proc.stdout}\nSTDERR:\n{proc.stderr}")
61 return False
62
63 expected_path = test.directory / (
64 "java-output.release.expected" if release else "java-output.expected"
65 )
66 if release and not expected_path.exists():
67 expected_path = test.directory / "java-output.expected"
68 if not expected_path.exists():
69 return True
70
71 # so it works on Windows
72 expected = "".join(read(expected_path).strip().split()).replace("\\", "/")
73 actual = "".join(f"STDOUT:{proc.stdout.strip()}STDERR:{proc.stderr.strip()}".split()).replace("\\", "/")
74
75 if actual == expected:
76 logs.append("|--- ✅ Output matches expected output!")
77 return True
78
79 diff = (
80 f"--- EXPECTED ---\n{read(expected_path)}\n\n"
81 f"--- ACTUAL STDOUT ---\n{proc.stdout}\n\n"
82 f"--- ACTUAL STDERR ---\n{proc.stderr}\n"
83 )
84 (test.directory / "output-diff.generated").write_text(diff, encoding="utf-8")
85 logs.append("|---- ❌ java output did not match expected output")
86 ci_diagnostic(logs, diff)
87 return False
88
89def java_process_inputs(test: TestCase) -> tuple[list[str], str | None]:
90 arguments_path = test.directory / "java-args.json"
91 arguments: list[str] = []
92 if arguments_path.exists():
93 parsed = json.loads(read(arguments_path))
94 if not isinstance(parsed, list) or not all(isinstance(value, str) for value in parsed):
95 raise ValueError(f"{arguments_path} must contain a JSON array of strings")
96 arguments = parsed
97 stdin_path = test.directory / "java-stdin.txt"
98 stdin = read(stdin_path) if stdin_path.exists() else None

Callers 2

process_binary_testFunction · 0.70
process_integration_testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected