Skip to content

Commit 16c7eff

Browse files
committed
Add shared sampling regression and tests
Add a new shared sampling regression tool (src/imiv/tools/imiv_sampling_regression.py) to perform nearest vs linear preview sampling in a single app run. Integrate it into the test suite by adding an imiv_sampling_regression CTest entry in src/imiv/CMakeLists.txt and wire it into the backend verifier (src/imiv/tools/imiv_backend_verify.py) via a new _sampling_checks helper. Update verifier logic to emit the sampling logs, consolidate some smoke/screenshot handling, and skip certain checks if smoke fails. Replace the old Metal-specific sampling script with a thin compatibility wrapper (imiv_metal_sampling_regression.py) that delegates to the shared script. Update imiv docs to reference the shared sampling regression and note backend-specific logs.
1 parent 722abb4 commit 16c7eff

6 files changed

Lines changed: 572 additions & 570 deletions

File tree

src/imiv/CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,22 +1198,6 @@ if (TARGET imiv
11981198
TIMEOUT 180)
11991199

12001200
if (TARGET oiiotool)
1201-
add_test (
1202-
NAME imiv_metal_sampling_regression
1203-
COMMAND
1204-
"${Python3_EXECUTABLE}"
1205-
"${CMAKE_CURRENT_SOURCE_DIR}/tools/imiv_metal_sampling_regression.py"
1206-
--bin "$<TARGET_FILE:imiv>"
1207-
--cwd "$<TARGET_FILE_DIR:imiv>"
1208-
--backend metal
1209-
--env-script "${CMAKE_BINARY_DIR}/imiv_env.sh"
1210-
--oiiotool "$<TARGET_FILE:oiiotool>"
1211-
--out-dir "${CMAKE_BINARY_DIR}/imiv_captures/metal_sampling_regression")
1212-
set_tests_properties (
1213-
imiv_metal_sampling_regression PROPERTIES
1214-
LABELS "imiv;imiv_metal;gui"
1215-
TIMEOUT 180)
1216-
12171201
add_test (
12181202
NAME imiv_metal_orientation_regression
12191203
COMMAND
@@ -1349,6 +1333,22 @@ if (TARGET imiv
13491333
LABELS "imiv;imiv_rgb;gui"
13501334
TIMEOUT 120)
13511335

1336+
add_test (
1337+
NAME imiv_sampling_regression
1338+
COMMAND
1339+
"${Python3_EXECUTABLE}"
1340+
"${CMAKE_CURRENT_SOURCE_DIR}/tools/imiv_sampling_regression.py"
1341+
--bin "$<TARGET_FILE:imiv>"
1342+
--cwd "$<TARGET_FILE_DIR:imiv>"
1343+
${_imiv_ctest_default_backend_args}
1344+
--oiiotool "$<TARGET_FILE:oiiotool>"
1345+
--env-script "${CMAKE_BINARY_DIR}/imiv_env.sh"
1346+
--out-dir "${CMAKE_BINARY_DIR}/imiv_captures/sampling_regression")
1347+
set_tests_properties (
1348+
imiv_sampling_regression PROPERTIES
1349+
LABELS "imiv;imiv_sampling;gui"
1350+
TIMEOUT 180)
1351+
13521352
if (_imiv_enabled_backend_count GREATER 1)
13531353
add_test (
13541354
NAME imiv_backend_preferences_regression

src/imiv/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,11 @@ Main output logs:
119119
- `verify_smoke.log`
120120
- `verify_rgb.log`
121121
- `verify_ux.log`
122-
- `verify_screenshot.log`
123122
- `verify_sampling.log`
124-
- `verify_orientation.log`
125123
- `verify_ocio_missing.log`
126124
- `verify_ocio_config_source.log`
127125
- `verify_ocio_live.log`
128126
- `verify_ocio_live_display.log`
127+
128+
Backend-specific specialized regressions such as Metal orientation still write
129+
their own dedicated logs outside the shared verifier.

src/imiv/imiv_backends.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ Manual verification:
209209
- [imiv_backend_verify.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_backend_verify.py)
210210
- shared RGB-input regression:
211211
- [imiv_rgb_input_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_rgb_input_regression.py)
212+
- shared nearest-vs-linear sampling regression:
213+
- [imiv_sampling_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_sampling_regression.py)
212214
- compatibility frontends:
213215
- [imiv_macos_backend_verify.sh](/mnt/f/gh/openimageio/src/imiv/tools/imiv_macos_backend_verify.sh)
214216
- [imiv_linux_backend_verify.sh](/mnt/f/gh/openimageio/src/imiv/tools/imiv_linux_backend_verify.sh)
@@ -217,8 +219,6 @@ Manual verification:
217219
- [imiv_metal_smoke_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_metal_smoke_regression.py)
218220
- Metal screenshot smoke regression:
219221
- [imiv_metal_screenshot_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_metal_screenshot_regression.py)
220-
- Metal nearest vs linear sampling regression:
221-
- [imiv_metal_sampling_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_metal_sampling_regression.py)
222222
- Metal orientation regression:
223223
- [imiv_metal_orientation_regression.py](/mnt/f/gh/openimageio/src/imiv/tools/imiv_metal_orientation_regression.py)
224224

src/imiv/tools/imiv_backend_verify.py

Lines changed: 55 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -279,23 +279,6 @@ def _smoke_checks(
279279
checks.append(
280280
(
281281
"smoke",
282-
_script_cmd(
283-
repo_root / "src" / "imiv" / "tools" / "imiv_metal_smoke_regression.py",
284-
backend=backend,
285-
exe=exe,
286-
run_cwd=run_cwd,
287-
out_dir=out_dir / "runtime",
288-
trace=trace,
289-
extra=["--open", str(image)],
290-
env_script=env_script,
291-
),
292-
out_dir / "verify_smoke.log",
293-
None,
294-
)
295-
)
296-
checks.append(
297-
(
298-
"screenshot",
299282
_script_cmd(
300283
repo_root
301284
/ "src"
@@ -305,53 +288,12 @@ def _smoke_checks(
305288
backend=backend,
306289
exe=exe,
307290
run_cwd=run_cwd,
308-
out_dir=out_dir / "runtime_screenshot",
309-
trace=trace,
310-
extra=["--open", str(image)],
311-
env_script=env_script,
312-
),
313-
out_dir / "verify_screenshot.log",
314-
None,
315-
)
316-
)
317-
checks.append(
318-
(
319-
"sampling",
320-
_script_cmd(
321-
repo_root
322-
/ "src"
323-
/ "imiv"
324-
/ "tools"
325-
/ "imiv_metal_sampling_regression.py",
326-
backend=backend,
327-
exe=exe,
328-
run_cwd=run_cwd,
329-
out_dir=out_dir / "runtime_sampling",
330-
trace=trace,
331-
env_script=env_script,
332-
),
333-
out_dir / "verify_sampling.log",
334-
None,
335-
)
336-
)
337-
checks.append(
338-
(
339-
"orientation",
340-
_script_cmd(
341-
repo_root
342-
/ "src"
343-
/ "imiv"
344-
/ "tools"
345-
/ "imiv_metal_orientation_regression.py",
346-
backend=backend,
347-
exe=exe,
348-
run_cwd=run_cwd,
349-
out_dir=out_dir / "runtime_orientation",
291+
out_dir=out_dir / "runtime",
350292
trace=trace,
351293
extra=["--open", str(image)],
352294
env_script=env_script,
353295
),
354-
out_dir / "verify_orientation.log",
296+
out_dir / "verify_smoke.log",
355297
None,
356298
)
357299
)
@@ -422,6 +364,30 @@ def _ux_checks(
422364
return [("ux", cmd, out_dir / "verify_ux.log", None)]
423365

424366

367+
def _sampling_checks(
368+
repo_root: Path,
369+
backend: str,
370+
exe: Path,
371+
run_cwd: Path,
372+
oiiotool: Path,
373+
out_dir: Path,
374+
env_script: Path | None,
375+
trace: bool,
376+
) -> list[tuple[str, list[str], Path, dict[str, str] | None]]:
377+
script = repo_root / "src" / "imiv" / "tools" / "imiv_sampling_regression.py"
378+
cmd = _script_cmd(
379+
script,
380+
backend=backend,
381+
exe=exe,
382+
run_cwd=run_cwd,
383+
out_dir=out_dir / "runtime_sampling",
384+
trace=trace,
385+
extra=["--oiiotool", str(oiiotool)],
386+
env_script=env_script,
387+
)
388+
return [("sampling", cmd, out_dir / "verify_sampling.log", None)]
389+
390+
425391
def _rgb_checks(
426392
repo_root: Path,
427393
backend: str,
@@ -831,6 +797,18 @@ def main() -> int:
831797
args.trace,
832798
)
833799
)
800+
checks.extend(
801+
_sampling_checks(
802+
repo_root,
803+
args.backend,
804+
imiv,
805+
run_cwd,
806+
oiiotool,
807+
out_dir,
808+
env_script,
809+
args.trace,
810+
)
811+
)
834812
checks.extend(
835813
_ocio_checks(
836814
repo_root,
@@ -848,7 +826,20 @@ def main() -> int:
848826
)
849827

850828
failures: list[str] = []
829+
smoke_failed = False
830+
skip_after_smoke = {
831+
"ocio_missing",
832+
"ocio_config_source",
833+
"ocio_live",
834+
"ocio_live_display",
835+
}
851836
for name, cmd, log_path, env_override in checks:
837+
if smoke_failed and name in skip_after_smoke:
838+
message = "skip: skipped because smoke failed\n"
839+
_write_text(log_path, message)
840+
sys.stdout.write(f"==> {name}: skipped because smoke failed\n")
841+
timings.append((f"{name}(skipped)", 0.0))
842+
continue
852843
env = dict(base_env)
853844
if env_override:
854845
env.update(env_override)
@@ -862,6 +853,8 @@ def main() -> int:
862853
timings.append((name, elapsed))
863854
if rc != 0:
864855
failures.append(name)
856+
if name == "smoke":
857+
smoke_failed = True
865858

866859
print("")
867860
print(f"Verification logs written to: {out_dir}")
@@ -874,13 +867,8 @@ def main() -> int:
874867
print(f" runtime+rgb: {out_dir / 'runtime_rgb'}")
875868
print(f" ux: {out_dir / 'verify_ux.log'}")
876869
print(f" runtime+ux: {out_dir / 'runtime_ux'}")
877-
if args.backend == "metal":
878-
print(f" screenshot: {out_dir / 'verify_screenshot.log'}")
879-
print(f" runtime+ss: {out_dir / 'runtime_screenshot'}")
880-
print(f" sampling: {out_dir / 'verify_sampling.log'}")
881-
print(f" runtime+sa: {out_dir / 'runtime_sampling'}")
882-
print(f" orient: {out_dir / 'verify_orientation.log'}")
883-
print(f" runtime+or: {out_dir / 'runtime_orientation'}")
870+
print(f" sampling: {out_dir / 'verify_sampling.log'}")
871+
print(f" runtime+sa: {out_dir / 'runtime_sampling'}")
884872
print(f" ocio-miss: {out_dir / 'verify_ocio_missing.log'}")
885873
print(f" runtime+om: {out_dir / 'runtime_ocio_missing'}")
886874
print(f" ocio-src: {out_dir / 'verify_ocio_config_source.log'}")

0 commit comments

Comments
 (0)