[validation] Only copy a single input file for ghostscript.
@@ -512,19 +512,23 @@ def validate_sha_output(result: BenchmarkExecutionResult):
)
-def setup_ghostscript_library_files(cwd: Path):
- """Pre-execution setup hook for ghostscript."""
- # Copy input data into current directory since ghostscript doesn't like long
- # input paths.
- for path in (_CBENCH_DATA / "office_data").iterdir():
- if path.name.endswith(".ps"):
- shutil.copyfile(path, cwd / path.name)
+def setup_ghostscript_library_files(dataset_id: int) -> Callable[[Path], None]:
+ """Make a pre-execution setup hook for ghostscript."""
+
+ def setup(cwd: Path):
+ # Copy the input data file into the current directory since ghostscript
+ # doesn't like long input paths.
+ shutil.copyfile(
+ _CBENCH_DATA / "office_data" / f"{dataset_id}.ps", cwd / "input.ps"
+ )
# Ghostscript doesn't like the library files being symlinks so copy them
# into the working directory as regular files.
for path in (_CBENCH_DATA / "ghostscript").iterdir():
if path.name.endswith(".ps"):
shutil.copyfile(path, cwd / path.name)
+ return setup
+
validator(
benchmark="benchmark://cBench-v0/bitcount",
@@ -710,9 +714,9 @@ for i in range(1, 21):
validator(
benchmark="benchmark://cBench-v0/ghostscript",
- cmd=f"$BIN -sDEVICE=ppm -dNOPAUSE -dQUIET -sOutputFile=output.ppm -- {i}.ps",
+ cmd="$BIN -sDEVICE=ppm -dNOPAUSE -dQUIET -sOutputFile=output.ppm -- input.ps",
data=[f"office_data/{i}.ps"],
outs=["output.ppm"],
linkopts=["-lm", "-lz"],
- pre_execution_callback=setup_ghostscript_library_files,
+ pre_execution_callback=setup_ghostscript_library_files(i),
)
