Testing and Validation Internals#

This page of the Technical Guide is for maintainers who change tests or validation scripts. It shows where each test lives, what it proves and how test_cpp schedules the native test programs. It ends with the boundaries that the KPI harness modules keep and the file and selection rules of KPI baseline collection. The Architecture glossary defines the implementation terms, and Concepts the consumer vocabulary.

Other pages own the neighboring topics:

Topic

Canonical page

Run tests and read the validation output

Test and validate

Worker limits, Python shard planning and task logs

Parallel tests and shard planning

Temporary directories, thread limits and fixture rules

Test environment and fixtures

What each CMake test target does

CMake targets

The sample checks of test_samples

How the samples are tested

The steps of a --validate run

Validation steps

Engine and serialization correctness

Sentinel guide

Performance budgets

KPI maintainer guide

The evidence a change needs before handoff

Required validation in Contributing, and the “Validation matrix” section of AGENTS.md

ovRTX clash sample app tests and diagnostics

The “Developer checks” section of samples/ovrtx_clash_sample_app/README.md

Testing and validation strategy#

Validation tests the product as it ships:

  • test_cpp, test_c_compat and test_python_runtime load the native library from the install tree (_build/install/<backend>), not from the compile tree. Each run therefore also checks that the runtime loads from the install layout, that its dependency closure is complete and that the OpenUSD plugin registry is set up.

  • test_c_compat_sdk_archive repeats the C consumer check against the extracted SDK archive. test_python_wheel checks the wheel in a clean virtual environment.

  • Source-contract tests read the sources and public headers directly. They pin the C ABI layouts and prototypes, the argument forwarding of every export and the backend parity of the canonical API.

Rules:

  • During development, run the focused tests of the surface you changed; see Run focused tests.

  • Before handoff, run the full gate that Required validation names for the change. --validate and test_all.* run it. A passing ovclash.native.test --test run alone does not complete the gate.

  • Sentinel runs separately. It checks the engine and serialization results of one build against independent oracles and reviewed goldens. It never compares the two backends with each other, and it does not qualify a release.

Where the tests live#

Path

Contents

Run by

tests/native/

Native C++ test programs

test_cpp

tests/c_compat/

A pure C11 consumer of the installed CMake package, and a stub test for the C example in docs/consumer/c_quickstart.md

test_c_compat, test_c_compat_sdk_archive

tests/python_tests/

Python tests in two groups; see Python test groups

test_python_runtime, test_sentinel_checkers

tests/kpi_tests/

Full KPI reference-fixture generation only; the other KPI tests are in tests/python_tests/

test_kpi_full_fixtures

tests/sentinel/

The Sentinel controller, its native consumer and its goldens

test_sentinel.*

tests/common/

ToolHelp.h, the --help and --version controls of every test program, and CheckToolHelp.cmake

The test programs

tests/data/

Test stages and other fixtures

Every suite

scripts/test_*.cmake

Validation drivers, source scans and packaging checks

The matching step

tests/sample_app_tests/

ovRTX clash sample app tests

test_python_sample_app

tests/diagnostics/

Opt-in diagnostic scripts

By hand

Native tests compile the path of tests/data/ in; OVCLASH_NATIVE_TEST_DATA overrides it at run time. Python tests read it from OVCLASH_TEST_DATA_DIR.

Native test programs#

tests/native/CMakeLists.txt builds the native test programs. scripts/test_cpp.cmake is their only run inventory: it lists each group, its selectors and its timeout. The ovclash project does not register native tests with CTest.

  • Build-tree programs land in <compile-tree>/<platform>/<configuration>/tests/, for example _build/compile/ovstage/vs/windows-x86_64/release/tests/.

  • ovclash.native.test also installs into _build/install/<backend>/bin. test_cpp runs that copy. No SDK archive or wheel ships it.

Every program accepts --help and --version. --help names the program’s purpose and selectors:

ovclash.suite_guard_failure.test (ovclash <version>)
Check allocation failure containment at Suite guard boundaries.

Usage: ovclash.suite_guard_failure.test entry|exception-format|restore
One selector is required; injected failures must be contained.
Example: ovclash.suite_guard_failure.test entry

Controls:
  -h, --help  Show this help and exit.
  --version   Show the ovclash build version and exit.

The public API suite#

ovclash.native.test tests the public C API through the packaged runtime:

Source

Covers

TestNativeClash.cpp

The runner: the test registry, --test and --shard selection, packaged runtime loading and environment setup, Windows packaging checks and C ABI static_asserts

TestNativeClash.h, TestNativeCommon.cpp

Test declarations and the shared check helpers

TestNativeMeshQueries.cpp

Mesh-vs-mesh queries and the query setters

TestNativePointClouds.cpp

Point-vs-mesh queries, static and dynamic

TestNativeSuite.cpp

The Suite runtime, Suite data, the SQLite round trip and the export helpers

TestNativeContracts.cpp, TestNativePipeline.cpp, TestNativeDuplicates.cpp, TestNativeDynamicDuplicates.cpp, TestNativeSelection.cpp, TestNativeSampling.cpp, TestNativeTransforms.cpp, TestNativeResultLifecycle.cpp

The remaining cases, one file per behavior area

TestMatrixDecomposition.cpp

Matrix decomposition. Builds of the OpenUSD backend compare it with the live GfTransform; builds of the ovstage backend with captured words

TestAttachedOvstage.cpp, TestOverlapReportFloatingPoint.cpp, TestNarrowPhaseReuse.cpp

ovstage builds only: attached ovstage stages, overlap-report floating-point state and narrow-phase reuse

The Windows packaging checks require that the install tree omits files the SDK archive must not ship, such as physxSchema.dll, the PhysX schema resources and the MSVC runtime DLLs under plugins/.

The runner takes one selector:

Arguments

Runs

none

Every registered test, in registration order

--test EXACT_NAME

One test

--shard K/N

Shard K of N, with 1 <= K <= N and N at most the number of registered tests

--shard assigns tests longest-first to the least-loaded shard. The weights are the duration estimates in kSlowTestCosts and a typical cost for every other test. Each shard keeps registration order. Before it runs, every --shard process checks that the N shards together name each registered test exactly once.

The runner prints a start and a verdict line for each test, so a log shows which test was running when a crash or hang happened. Like every test program, it first prints a three-line banner to stderr:

ovclash.native.test (ovclash <version>)
Exercise the standalone clash engine public C API and packaged runtime.
Run ovclash.native.test --help for usage.
Starting ovclash standalone native tests
Standalone DLL loaded successfully
Shard 60/60 runs 3 of 184 registered tests
Running 3 ovclash standalone native tests
[1/3] testOpenStageClearsScopeButPreservesFullSceneState
[1/3] testOpenStageClearsScopeButPreservesFullSceneState ok (<ms> ms)
[2/3] testPositiveDenormalRateKeepsFirstSampleAtStart
[2/3] testPositiveDenormalRateKeepsFirstSampleAtStart ok (<ms> ms)
[3/3] testReleaseMemoryKeepsContextUsable
[3/3] testReleaseMemoryKeepsContextUsable ok (<ms> ms)
Finished ovclash standalone native tests: 3 passed

Standalone DLL loaded successfully appears on Windows only. A failing check prints [i/n] <name> FAILED: <message> and exits 1.

Add a native test#

Before you begin, build and install the backend that the test covers, so that _build/install/<backend>/bin holds ovclash.native.test (Test and validate). A test that needs a stage uses a fixture under tests/data/.

The backends that a test covers decide where it registers in the tests list of runRegisteredTests() in TestNativeClash.cpp:

The test covers

Its registration block

Both backends

Outside the backend blocks

ovstage only

The existing #if defined(OVCLASH_OVSTAGE_ONLY) block

OpenUSD only

The existing #if !defined(OVCLASH_OVSTAGE_ONLY) block

  1. Write the test in the source file of its behavior area.

  2. Declare it in TestNativeClash.h.

  3. Register it with OVCLASH_NATIVE_TEST(name) in the registration block of its backends.

Two scheduling lists take only some tests. Add the test to each list that applies to it before you rebuild:

  • kSlowTestCosts in TestNativeClash.cpp: a test much slower than its neighbors gets an entry with its approximate duration from a serial Release ovstage run. A test of ordinary duration gets none. The estimate only balances the shards; every test still runs exactly once.

  • _OVCLASH_NATIVE_FRESH_PROCESS_TESTS in scripts/test_cpp.cmake: a test that needs a process in which no other test has run gets an entry, and test_cpp then runs it alone with --test <name>. Any other test gets none.

Field

Type

Required

Default or values

Description

kSlowTestCosts entry, first member

std::string_view

Yes

The name registered with OVCLASH_NATIVE_TEST

The test that the estimate weights

kSlowTestCosts entry, second member

uint32_t

Yes

Milliseconds; a test without an entry weighs kTypicalTestCost, 15

The approximate duration, written as { "testName", 450u },

_OVCLASH_NATIVE_FRESH_PROCESS_TESTS item

CMake list item

No

A registered test name

A test that runs in its own process

  1. Rebuild and reinstall the backend, for example with build_ovstage.* --release --target test_cpp, which runs the packaged native tests.

  2. Run the new test alone with --test <name>, as Run focused tests shows.

The new test passes when the runner prints [1/1] <name> ok (<ms> ms) and Finished ovclash standalone native tests: 1 passed, and exits with 0. A failing check prints [1/1] <name> FAILED: <message> and exits with 1.

For example, a test that expects one overlap between two meshes of an existing fixture:

// TestNativeMeshQueries.cpp
void testMeshPairHasOneOverlap()
{
    ovclash_context_t* context = nullptr;
    checkApi(ovclash_create_context(&context), "failed to create clash context");
    const std::string fixturePath = toApiPath(getFixturePath("mesh_mesh_overlapping.usda"));
    checkApi(ovclash_open_stage(context, makeString(fixturePath)), "failed to open mesh fixture", context);

    ovclash_settings_t settings;
    ovclash_reset_settings(&settings);
    settings.flags &= ~static_cast<uint32_t>(OVCLASH_SETTINGS_FLAG_ENABLE_POINT_CLOUDS);
    checkApi(ovclash_set_settings(context, &settings), "failed to apply query settings", context);

    const ovclash_string_t scopeA[] = { makeString("/World/Objects/meshA") };
    const ovclash_string_t scopeB[] = { makeString("/World/Objects/meshB") };
    checkApi(ovclash_set_scope_paths(context, scopeA, 1u, scopeB, 1u), "failed to set mesh scope", context);
    runSyncPipeline(context);

    uint32_t overlapCount = 0u;
    checkApi(ovclash_get_overlap_count(context, &overlapCount), "failed to read the overlap count", context);
    check(overlapCount == 1u, "expected exactly one mesh overlap");
    ovclash_release_context(context);
}

// TestNativeClash.h
void testMeshPairHasOneOverlap();

// TestNativeClash.cpp, in the tests list of runRegisteredTests()
OVCLASH_NATIVE_TEST(testMeshPairHasOneOverlap),

makeString takes a std::string or a string literal and does not copy it, so the string must outlive the call.

Private test programs#

Most other programs compile the private sources they test into the executable, so the product library does not have to export them. test_cpp runs them from the compile tree:

Program

What it checks

Runs on

ovclash.owned_async_launch.test

The ownership rule of source/OwnedAsyncLaunch.h: the async owner is allocated before the native launch and published only after it succeeds. Allocation failures, null and throwing launches publish nothing

Both backends

ovclash.intersection_direction.test

Directed triangle-intersection arithmetic

Both backends

ovclash.sentinel_records.test

Sentinel record bytes, allocation bounds and payload streaming

Both backends

ovclash.parallel_for.test

Parallel workers, both schedulers including the real static tasking runtime, root selection, the scope-path registry and parallel collection; transform prefetch in ovstage builds

Both backends

ovclash.suite_writer.test

Suite bulk writes, numeric formatting and transaction recovery

Both backends

ovclash.suite_directory.test

Directory-store persistence, rollback, codecs and frame indexes

Both backends

ovclash.suite_directory_codec.test

Lossless directory JSON and prepared-frame text codecs

Both backends

ovclash.suite_directory_concurrency.test

Concurrent directory-store readers, writers and ownership

Both backends

ovclash.suite_store_lifetime.test

Store lifetime, callbacks and rollback ownership

Both backends

ovclash.suite_serializer_interface.test

The public serializer interface and data lifetimes

Both backends

ovclash.suite_guard.test

Guarded Suite API calls, exceptions and thread-local nesting

Both backends

ovclash.suite_report_lifetime.test

Report and async handle lifetimes, the runtime’s cached scope and engine failures

Both backends

ovclash.suite_report_failure_borrowed.test, ..._owned.test

Report creation failure, interruption and retained history

Both backends

ovclash.suite_guard_failure.test

Allocation-failure containment at Suite guard boundaries. Selectors: entry, exception-format, restore

Both backends

ovclash.suite_fetch_borrowed.test, ..._owned.test

Fetch failure, cancellation and retained-history recovery

ovstage validation

ovclash.suite_batching_borrowed.test, ..._owned.test

Fetch batching across group, frame-count and payload-size boundaries, payloads, schedulers and ownership

ovstage validation

ovclash.omni_client_retries.test

Retry-window configuration of the omni client and missing-client warnings

ovstage only

ovclash.usda_text_fallbacks.test

The USDA text fallback for invalid topology

ovstage only

ovclash.engine_observer_work.test

Sentinel observer work accounting and concurrency

ovstage only

ovclash.instancing_graph.test

Instancing graphs, source selection and transform validation

ovstage only

ovclash.dynamic_failure.test

Dynamic engine recovery after caller and worker allocation failures, injected inside the real C API

ovstage only

ovclash.suite_report_ownership_failure.test

Report ownership under isolated allocation failures. Selectors: one-shot, persistent, controlled, double-one-shot, double-persistent

ovstage only

ovclash.suite_serialization_failure.test

Serialization output under isolated allocation failures. Selectors: query, point-settings, frame, overlap, run-settings

ovstage only

ovclash.sentinel_engine.test

Private Sentinel engine controls, built into tests-sentinel/

Sentinel only; test_cpp does not run it

Notes:

  • borrowed programs compile SuiteFetch.cpp with OVCLASH_OVSTAGE_ONLY=1, the ovstage report mode. owned programs compile it with 0, the OpenUSD mode. Both backend builds produce both.

  • The allocation-failure programs replace new and delete inside the executable. In MSVC Debug, most of them build with _ITERATOR_DEBUG_LEVEL=0, because Debug iterator proxies allocate inside noexcept constructors and would terminate before the failure handler runs.

  • ovclash.dynamic_failure.test instead exits 77 when MSVC iterator debugging is enabled. test_cpp reports that as a skip.

  • On Linux, dynamic_failure, suite_report_ownership_failure and suite_serialization_failure link with a version script. It keeps the executable’s replacement allocators from preempting the allocators of shared dependencies.

Validation scheduling#

scripts/test_cpp.cmake turns the programs into independent groups:

  1. It writes one small CMake driver per group to <validation-dir>/native_test_tasks/ and the task list to <validation-dir>/test_cpp_tasks.json. <validation-dir> is _build/validation/<backend>/<generator>/<configuration>.

  2. scripts/run_parallel.py runs the groups as separate processes. It captures each group’s output and reports every group, even when another one fails.

  3. The first group of each program also runs --help and --version. The help must contain Usage: and the version output (ovclash <version>).

The groups:

Group

ovstage

OpenUSD

ovclash.native.test

Four groups, native/shard-K-of-4, each with --shard K/4

One group, native

Fresh-process tests

native/testParallelContextLifecycleOnBothBackends

The same

instancing_graph, dynamic_failure

One group each

Not built

parallel_for, owned_async_launch, intersection_direction, sentinel_records

One group each

The same

The other suite_* programs

One group each

The same

suite_fetch_borrowed, suite_fetch_owned

Two groups each, suite_fetch_<mode>/shard-K-of-2

Not run

suite_batching_borrowed, suite_batching_owned

One group each

Not run

suite_guard_failure

One group per selector

The same

omni_client_retries, usda_text_fallbacks, engine_observer_work

One group each

Not built

suite_report_ownership_failure, suite_serialization_failure

One group per selector

Not built

Why some groups differ:

  • testParallelContextLifecycleOnBothBackends races the first context creation of a process. It also runs inside its shard, but only a fresh process reaches that first creation.

  • The fetch and batching programs link no backend code. They compile only their test sources, SuiteFetch.cpp and the Suite storage objects, with the report mode fixed per program. Both backend builds therefore produce the same program, and the ovstage validation for the same platform and configuration qualifies it. Sentinel’s native controls still run them on both backends. Return a group to the OpenUSD inventory if it ever compiles or links backend code.

Ordering and limits:

  • Groups start in list order, so the long ones start before short groups fill the workers. The order is: the native shards and the fresh-process test, then instancing_graph and dynamic_failure, the other programs, the suite_* groups longest first, and the selectors last.

  • The suite_* program groups time out after 180 seconds. owned_async_launch and the three ovstage controls time out after 30 seconds. The other groups have no timeout, so a hang shows as a START line without a verdict.

  • By default, validate_all runs the groups in parallel and a direct test_cpp run runs them one at a time. Parallel tests and shard planning describes OVCLASH_PARALLEL_TESTS and OVCLASH_PARALLEL_JOBS.

Each group’s full output goes to <validation-dir>/run_parallel_logs/test_cpp/<group>.log, with / in the group name replaced by _. The console shows the start and verdict of each group, explicit skips and the full output of failed groups. For example, on ovstage (times are illustrative):

-- Running the packaged standalone native test: <install>/bin/ovclash.native.test.exe
--   working directory:   <install>/bin
--   USD plugin registry: <install>/plugins/usd
--   native group 1: native/shard-1-of-4 -- Clash engine public API tests
...
--   native group 5: native/testParallelContextLifecycleOnBothBackends -- Public API test alone in a fresh process
--   native group 6: instancing_graph -- Instancing graph, stage identity and matrix validation
...
Running 43 task(s) with 16 worker(s)
Full task logs: <validation-dir>/run_parallel_logs/test_cpp
START             native/shard-1-of-4
...
OK    <seconds>s  suite_writer  (suite_writer.log)  [SKIP: comma-decimal locale unavailable; invariant numeric-locale matrix checks passed]
OK    <seconds>s  native/shard-1-of-4  (native_shard-1-of-4.log)
...
All 43 task(s) passed in <seconds>s.
-- Native validation finished: 43/43 groups executed.

A failed group ends its line with the reason, for example (exit 1 in step 1 of 1), and test_cpp stops with Native validation failed; full diagnostics: <validation-dir>/run_parallel_logs/test_cpp.

Python test groups#

scripts/test_python_runtime.cmake discovers every test_*.py file directly in the suite directory. The search does not recurse, and a new module needs no registration. Shared helper modules use a name without the test_ prefix, such as _bounded_process.py.

scripts/python_test_inventory.py splits tests/python_tests/ into two disjoint groups. Its is_checker() function decides:

Group

Modules

Run by

runtime

Every module that is not a checker. They use the install tree’s library and its OpenUSD runtime environment

test_python_runtime

checkers

The process-tree supervisor tests (test_process_tree.py and test_process_tree_owners.py, listed in PROCESS_TREE_MODULES), and every test_sentinel_* module except the three SDK serialization modules in SDK_SERIALIZATION_MODULES

test_sentinel_checkers, through scripts/sentinel_ci.py

A product test must not start with test_sentinel_: that name moves it into the checkers group and out of --validate. Its is_publishing() function marks the modules that test the publishing of this tree (the test_publish_ prefix and test_public_references.py). They depend on neither the backend nor the build type, so a true OVCLASH_SKIP_PUBLISHING_TESTS leaves them out of the runtime group. The coverage run (test_python_coverage) discovers every module except the publishing modules, and the kpi_tests and sample_app_tests suites discover every module.

Modules that pin cross-layer contracts:

Module

Pins

test_native_api_forwarding.py

Each C export forwards to its own private operation, with the same return type and the same parameters in the same order

test_binding_abi.py

Every ctypes Structure in both binding modules matches its header layout byte for byte, and every bound function matches its prototype

test_suite_api.py and its test_suite_api_*.py siblings

test_suite_api.py: Python and native version parity and the default settings table. test_suite_api_python_binding.py: ABI-derived constants and defaults, and the C entry point behind each public method. test_suite_api_overlap_processing.py: model behavior, generic export and the compatibility imports. test_suite_api_store_migration.py: SQLite schema migration. The other siblings cover the SQLite store, files and legacy containers, and run settings and scope

test_suite_legacy_migration.py

Migration of a legacy .clashDetection container to .ovclashdb through the Suite API. It needs no pxr, so every build job runs it on both backends

test_runtime.py, test_runtime_lifetimes.py, test_core_runtime.py

The canonical ovclash runtime and the python -m ovclash command line; its async-pipeline and overlap-report lifetimes; the omni.physxclashdetectioncore compatibility bridge

test_canonical_api_source_contract.py

The canonical-API source contract: both backends define every declared entry point, every entry point returns a status and has an exception boundary, every settings setter is async-guarded and covered by the shared native test, and both backends own async cookies the same way

test_ovstage_backend_source_parity.py

The ovstage backend sources follow the OpenUSD implementation: pipeline, broad phase, point clouds, bounds, transforms, result order and settings

test_repo_structure.py

scripts/check_repo_structure.py on this checkout and on small trees that break one rule each: the public entry files (README.md, AGENTS.md, docs/README.md, examples/README.md, skills/README.md), the README section order and Start Here links, the skill catalog, the agent-context sections, the example index’s verified version, leftover starter-outline text, relative links and skill aliases

test_shipped_skills.py

Every shipped skill under skills/: frontmatter (name equals the folder, a description with “Use when” and “Not for”, compatibility, one shared metadata.version), its row in the catalog skills/README.md, links that resolve, the (SDK archive): label on every reference to a consumer page, and no source-checkout paths

test_benchmark_launchers.py

The benchmarks/*/run_*.{bat,sh} launchers: exact argument forwarding, exit status, isolated -P imports, interpreter and library selection, a relative or bare-name OVCLASH_BENCHMARK_PYTHON through every Python launcher, an unknown OVCLASH_BENCHMARK_BACKEND, --help without a native library, every launcher’s real --help in the shared layout of benchmarks/launcher_help.py (one sentence of what is measured, the launcher in the usage line, every option and an example), every C++ launcher’s --help without a compiler, on Windows every Python launcher’s --help without a venv past a python.bat shim on PATH, that every benchmark folder has its README and both launchers, that every .sh launcher names bash on its first line, that launchers copied from the fetch_batch template still match it, and that a missing --read-existing path is a usage error. It also compiles the matrix_decomposition program from header copies with a static and with a thread_local call counter and checks that its untimed check pass stops each run with status 1; that test skips without an install tree, the PhysX headers of the host platform or a compiler

test_fetch_batch.py

The fetch_batch benchmark compares each phase only with that phase’s first result, hashes a fixed record set to a pinned digest and reports the Suite’s own error text for a failed native call, with a stand-in Suite module and, when the native runtime is configured, on generated fixtures

test_viewer_launch_and_python_runtime.py

The Python runtime discovery and the module entry point, the buffer view without the viewer extra, Python OpenUSD from Packman with its test overlay, and the viewer launchers

test_ovrtx_viewer_scripts.py

The viewer setup script, its public package sources and its ovUI runtime discovery

tests/sample_app_tests/test_ovrtx_clash_sample_app.py and its test_ovrtx_clash_sample_app_*.py siblings

The ovRTX clash sample app’s stage, session, query and packaging behavior. A test whose dependency is missing, such as Python pxr on ovstage, skips with a reason

Python coverage#

The test_python_coverage target reruns the product Python suite (tests/python_tests) under coverage.py. It runs scripts/test_python_runtime.cmake with PYTHON_TEST_COVERAGE=ON (a -D value or the environment; off by default). --validate never runs it, because instrumenting every frame makes the suite measurably slower.

The coverage run differs from normal validation:

  • It keeps the full module inventory, including the Sentinel controller tests, so the shipped code that they exercise is measured. The ovRTX clash sample app suite is not included.

  • The coverage sources are the shipped package directories under python/ and the top-level ovclash_suite module. A shipped module that no test imports reports 0% instead of disappearing.

  • It writes coverage.json, coverage.xml and html/ to _build/coverage/python_tests/ before the pass/fail check, so a failing suite still leaves a report.

  • Its ordinary test shards have no timeout, as in normal validation.

The target depends on install_sdk, so it rebuilds and reinstalls first. To measure an existing install without that step, run scripts/test_python_runtime.cmake directly with BUILD_TYPE, BUILD_DIR, INSTALL_DIR, OVCLASH_OVSTAGE_ONLY and -DPYTHON_TEST_COVERAGE=ON.

The target only measures. scripts/parse_coverage.py is the gate. From ovclash/, after an ovstage build:

./_build/deps/target-deps/cmake/bin/cmake -DBUILD_DIR=_build/compile/ovstage/ninja -DTARGET=test_python_coverage -DCONFIG=Release -P scripts/build_target.cmake
python3 scripts/parse_coverage.py _build/coverage/python_tests/coverage.json
.\_build\deps\target-deps\cmake\bin\cmake.exe -DBUILD_DIR=_build/compile/ovstage/vs -DTARGET=test_python_coverage -DCONFIG=Release -P scripts/build_target.cmake
python scripts\parse_coverage.py _build/coverage/python_tests/coverage.json

parse_coverage.py prints one row per shipped package, ranked by coverage, then a total and a minimum line. The top-level ovclash_suite module reports as its own ovclash_suite.py row. The last line names the HTML report. The output looks like this (values illustrative):

Coverage for shipped ovclash Python packages:

Name                         Lines Tested    Coverage
ovclash_suite.py             11/11           100.00%
ovclash                      26/29           89.66%
ovclash.python.suite         3172/3765       84.25%
ovclash.python.api           2310/2876       80.32%
omni.physxclashdetectioncore 402/620         64.84%

Total coverage: 81.10% (5921/7301 lines tested)

Minimum coverage: 64.84% (omni.physxclashdetectioncore, floor 60%) (SUCCESS)

Coverage report: <checkout>/_build/coverage/python_tests/html/index.html

The gate rules:

  • It exits 1 when any single package is below the floor, so a weak package cannot hide behind a large one. A dashed line separates the packages below the floor.

  • It exits 1 on every unusable report, including a shipped package missing from the report. A run without a coverage signal never passes.

  • The floor is 60%, set in DEFAULT_MIN_COVERAGE. --min-coverage or OVCLASH_MIN_COVERAGE overrides it with a finite percentage from 0 to 100.

  • The floor is a ratchet toward the 85% of the clash-detection gate of Kit, not a target. Raise it as coverage grows. Never lower the default to turn a failing gate green.

The coverage run reads these settings:

Variable

Values

Required

Default

Effect

PYTHON_TEST_COVERAGE

A CMake boolean, as a -D value or from the environment; the -D value wins

No

OFF

ON runs scripts/test_python_runtime.cmake under coverage.py

--min-coverage

A percentage from 0 to 100

No

OVCLASH_MIN_COVERAGE, else DEFAULT_MIN_COVERAGE

The floor of scripts/parse_coverage.py

OVCLASH_MIN_COVERAGE

A percentage from 0 to 100

No

DEFAULT_MIN_COVERAGE (60)

The floor when --min-coverage is not given. A value that is not a number exits with 1.

Coverage is measured on Linux x86-64 only. The shipped packages have no architecture-specific code. Their Windows-only branches, in native-library loading and one utility function, run without instrumentation in the Windows test_python_runtime step. A Windows measurement would need coverage combine with a [paths] remap; add one only if those branches grow.

C compatibility tests#

scripts/test_c_compat.cmake configures tests/c_compat/ as a separate consumer project. The project finds the ovclash CMake package with find_package(ovclash CONFIG REQUIRED). test_c_compat points it at the install tree and builds in _build/c_compat_install. test_c_compat_sdk_archive points it at the extracted SDK archive and builds in _build/c_compat_sdk_archive.

  • ovclash.capi.compile.smoke (OvclashCSmoke.c, C11) runs in order: the version and DLPack checks, a base-runtime query, the Suite runtime, Suite export, the named constants, model validation, a directory-store round trip and a SQLite round trip that includes a legacy .clashDetection container. A Windows Debug build first checks that the Debug CRT modules load from the expected directories.

  • tests/c_compat/extract_doc_snippet.py extracts the largest c fence of docs/consumer/c_quickstart.md. The consumer compiles it against the install tree, or the SDK archive, with warnings as errors. ovclash.capi.doc.stubtest runs the same source against the stubs in DocQuickstartStubTest.c, which drive its error paths and context lifetime.

  • CTest in the consumer project checks the --help and --version output of each program.

Source and package scans#

Kit clash-tree independence#

scripts/test_no_clash_dependency.cmake scans the top-level CMakeLists.txt and the deps/, scripts/, python/, samples/, source/ and tests/ trees. It also scans the four launch_rtx_viewer_* launchers. It reads .bat, .cmake, .cpp, .h, .py, .ps1, .sh, .xml and CMakeLists.txt files, and skips the generated source/usdclash/ view.

A line fails the scan when it names CLASH_ROOT_DIR or CLASH_SOURCE_DIR, or reaches into the repository’s clash/ tree: ../../clash, clash/extensions, clash/deps or clash/cmake, with either slash. To allow one reviewed line, end it with a comment that holds the marker and a reason. This existing line of the top-level CMakeLists.txt is an allowed line; add the same comment form at the end of the line you allow:

set(CLASH_ROOT_DIR "${OVCLASH_ROOT_DIR}/../clash") # ovclash-no-clash-allow: shared-engine-source-root

The scanner matches the comment in three parts:

Field

Type

Required

Default or values

Description

Comment start

text

Yes

#, // or ::, then optional spaces or tabs; or rem in any case, then at least one space or tab

Opens the comment

Marker

text

Yes

ovclash-no-clash-allow:

Marks the line as reviewed

Reason

text

Yes

Optional spaces or tabs, then any text that starts with a non-blank character

Why the line may reach the clash tree. A marker without a reason exempts nothing.

The scan lists every file that has an allowed line.

ovx package coherence#

scripts/test_ovx_package_coherence.cmake runs the validation of the ovx headers in scripts/ovx_package_validation.cmake against synthetic include trees under <validation-dir>/ovx_package_coherence. The path_dictionary/ set means path_dictionary.h, path_dictionary_types.h and path_dictionary_utils.h:

Case

Headers under ovx/

Expected

Exact string-only layout

string_types.h

Rejected: requires a complete OVX path-dictionary header set

Partial path-dictionary header set

string_types.h, path_dictionary/path_dictionary.h

Rejected: requires a complete OVX path-dictionary header set

Legacy types without path-dictionary headers

types.h

Rejected: requires a complete OVX path-dictionary header set

Dual string headers without path-dictionary headers

string_types.h, types.h

Rejected: requires a complete OVX path-dictionary header set

Legacy string header with new ovstage SDK

types.h and the path_dictionary/ set

Rejected: uses legacy ovx/types.h

Coherent producer header set

string_types.h and the path_dictionary/ set

Accepted

ovx include-tree checks describes the validation itself.

Native Suite test build and sample gate#

Shared Suite storage objects#

The Suite storage test programs share the storage sources through the ovclash.suite_storage OBJECT library in tests/native/CMakeLists.txt. Storage therefore compiles once, not once per program.

  • MSVC builds a second variant, ovclash.suite_storage_allocation, with _ITERATOR_DEBUG_LEVEL=0 in Debug. The allocation-failure programs (suite_writer, suite_directory, suite_fetch_* and suite_report_failure_*) link it in Debug and the normal variant otherwise.

  • The objects link into each program, so each program’s replacement allocators and stubs still apply to the storage code.

  • The object libraries set VS_GLOBAL_OvClashPreserveIntermediateDirectory and VS_GLOBAL_OvClashPreserveOutputDirectory. cmake/Directory.Build.targets.in then leaves their intermediate and output directories where CMake put them. CMake embeds those object paths in the consumers’ link commands, so relocated objects would break the link.

Persistence cases of the sample gate#

test_samples runs scripts/test_samples_default_clashdb.cmake once per language, python and cpp, after the clash_suite_api launcher check of How the samples are tested. The script runs the persistence-output cases of the clash_suite_api sample one after another, on a copy of tests/data/time_sampled.usda:

  • The first case runs through the sample launcher. That covers argument forwarding and builds the C++ sample against the install tree under test, in the requested configuration. The other cases call the built executable or clash_suite_api_python.py directly.

  • The passing cases cover:

    • SQLite with JSON and HTML exports, and an exact --clashdb path;

    • the directory store alone and with HTML;

    • the directory store with SQLite: first run, append and overwrite, including nested paths;

    • synchronous and asynchronous runs, and count-only runs that write no store.

  • The rejection cases are an invalid --async value, conflicting destinations, reserved outputs inside a directory store, a nonempty folder without a store manifest and stray positional arguments.

  • A passing case must exit 0. A rejection must exit with its expected code and print its expected diagnostic. Argument errors exit 2 from the Python sample (argparse) and 1 from the C++ sample.

  • On ovstage, a duplicate UsdShade behavior registration diagnostic (RegisterBehaviorForPrimTypeId) fails any case.

Each case writes sample.log to <validation-dir>/sample_validation/clash_suite_api_<language>_<backend>_default_<n>_<case>/, and its stores under <validation-dir>/sample_validation/<language>/. The console names each case, echoes its command and prints its result (the echoed commands are left out here):

-- Running clash_suite_api cpp serializer case count_only for ovstage
-- clash_suite_api cpp count_only: passed
-- Running clash_suite_api cpp serializer case invalid_async for ovstage
-- clash_suite_api cpp invalid_async: expected rejection verified (exit 1; true or false)
...
-- clash_suite_api cpp persistence output tests passed for ovstage

Run focused tests#

Before you begin, build the backend with --release, so that a build has assembled the install tree _build/install/<backend>. For the Python modules, run --validate once: it creates the test virtual environment _build/deps/venv/python_tests. Run the commands from ovclash/.

One native test, or one shard, from the install tree. The runner sets the OpenUSD plugin paths from its own location.

Windows:

cd _build\install\ovstage\bin
.\ovclash.native.test.exe --test testMeshVsMesh
.\ovclash.native.test.exe --shard 2/4

Linux:

cd _build/install/ovstage/bin
LD_LIBRARY_PATH="$PWD/../lib:$LD_LIBRARY_PATH" ./ovclash.native.test --test testMeshVsMesh

A passing run ends with Finished ovclash standalone native tests: <n> passed and exits with 0; a failing test prints [<i>/<n>] <name> FAILED: <message> and exits with 1.

A private program runs from the compile tree. --help names its selectors.

Linux (Ninja tree):

_build/compile/ovstage/ninja/linux-x86_64/release/tests/ovclash.suite_guard_failure.test entry

Windows (Visual Studio tree):

_build\compile\ovstage\vs\windows-x86_64\release\tests\ovclash.suite_guard_failure.test.exe entry

A private program exits with 0 when its checks pass.

Python modules that need neither the native library nor ovclash_suite run with the test virtual environment that validation creates.

Linux:

PY=_build/deps/venv/python_tests/bin/python3
"$PY" -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_native_api_forwarding.py

Windows:

set PY=_build\deps\venv\python_tests\Scripts\python.exe
%PY% -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_native_api_forwarding.py

unittest exits with 0 when every test of the module passes, and with a nonzero status otherwise.

Other modules need the environment that scripts/test_python_runtime.cmake sets for each task. <install> is the install tree, _build/install/<backend>:

Variable

Values

Required

Default

Effect

PYTHONPATH

python/. On ovstage also the staged ovstage wheel, _build/deps/pip-deps/ovstage; on OpenUSD the Python-enabled OpenUSD under _build/deps/target-deps/usd-py-tests/<configuration>/lib/python

Yes

–

Imports the checkout’s Python packages, and the staged ovstage or the Python-enabled OpenUSD

OVCLASH_LIB

<install>/bin/ovclash.dll on Windows, <install>/lib/libovclash.so on Linux

Yes

–

Loads the install tree’s native library

OVCLASH_TEST_DATA_DIR

tests/data

For the modules that read fixtures; some fall back to tests/data

–

Locates the test stages

OVCLASH_OVSTAGE_ONLY

1 on ovstage, 0 on OpenUSD

Yes on ovstage

Unset, read as OpenUSD

Enables the ovstage-only cases, which modules skip unless it is 1

PATH (Windows) or LD_LIBRARY_PATH (Linux)

The OpenUSD runtime libraries, <install>/plugins and the install tree’s library directory

Yes

–

Lets the native library find its runtime dependencies

OVCLASH_DLL_DIRS

<install>/bin, <install>/plugins and the bin and lib of the OpenUSD root that ovstage uses (OVCLASH_OVSTAGE_USD_ROOT)

Windows ovstage only

–

Adds the DLL search directories

OPENBLAS_NUM_THREADS

A thread count

No

1, unless you set it

Limits the OpenBLAS threads of NumPy

PYTHONUNBUFFERED

1

No

1

Writes test output unbuffered, so logs keep their order

On OpenUSD, the driver also puts the Python-enabled OpenUSD library in place of the packaged one for the duration of the run (scripts/python_usd_test_overlay.cmake).

KPI harness code map#

benchmarks/kpi/ measures the nine frozen KPI workloads. The KPI maintainer guide lists the page that owns each KPI topic, and the source map gives the role of every module. Sentinel owns product correctness: the KPI workload-consistency check verifies only the frozen work, never geometry or payload correctness.

These modules hold the boundaries that a code change must keep:

Module

Boundary

representative_workloads.py

Never runs the product to learn expectations. Preparation generates the fixtures before any timing and checks each bundle against its pin

benchmark_execution.py

Runs no geometry predicate or payload digest. Each requested report buffer is copied once, and the report cardinalities come from the same pass

benchmark_session.py

A session ticket is no proof of the fixture bytes. A failed content check at the explicit session close invalidates the session

execution.py

Derives every verdict itself, never from a label that the child supplies

attempt.py

Rejects a child result that differs from its bound execution

child.py

Runs with an explicit interpreter in isolated mode (-I) and explicit bindings, so it ignores PYTHONPATH. It records the runtime it actually loaded

environment.py

Never supervises processes. The memory observation covers the operation process only; descendants are not measured

runner.py

Imports no ovclash runtime

noise_sampling.py

Decides sampling; a stable decision never approves a baseline

startup_settings.py

The settings block is console output only. It never enters reports, logs, JSON or evidence and never changes a decision

budgets.py

Proposes limits from admitted calibration observations; never approves them

publication.py

Copies only controller-held numbers and fixed public vocabulary into the public record; physical locators and execution captures stay private

scripts/kpi_preflight.py

Claims no CPUs, generates no fixtures and runs no workload

Every edit to a Python file under benchmarks/kpi/ or tooling/ starts a new measurement identity, even an edit to a comment. The benchmark helpers that KPI shares with benchmarks.backend_timings live in benchmarks/kpi/, so an edit to a standalone benchmark package leaves the identity unchanged.

KPI baseline collection files and selection#

These rules implement the collection that Collect a baseline describes.

Output ownership#

baseline_files.output_lock(output) makes one thread of one process the owner of an output directory. generate_series() holds it on the generated series while it writes and publishes it.

  • The lock is a nonblocking OS lock on a sibling file, .<name>.controller.lock: msvcrt.locking on Windows, flock elsewhere. A second owner fails at once with baseline_output_busy.

  • The lock key is the resolved, case-normalized path, so two spellings of one directory take the same lock. The lexical path is checked first: a symbolic link or Windows reparse point in it fails with baseline_output_invalid_path. The checkout’s own _build link is the only exception.

  • Ownership is reentrant within one thread and ends when the process exits.

  • Lock files stay in place, so two processes can never lock different files for one output. The collector removes only the released lock of its one-shot staging directory.

  • Only the acquiring process unlocks. A forked POSIX child that unlocked its inherited file description would release the parent’s lock (flock semantics).

<parent>/<name>/                     the output directory
<parent>/.<name>.controller.lock     its lock file, kept after release

Outputs lists the staging directories and lock files that a stopped collection can leave.

Status and renames#

  • baseline_files.atomic_write() publishes status.json (collection status and exit codes gives its fields). It writes a temporary sibling and replaces the file with os.replace, so readers see the old or the new file, never a partial one. This protects against interrupted writes, not against power loss.

  • Windows refuses to replace a file, or to rename a directory, while another process holds a handle in it, such as a polling reader or a scanner. The replace retries for at most 0.75 seconds. The rename of the generated tree retries for at most 7.85 seconds, inside the 30-second publication reserve, and never starts a retry after the deadline. POSIX never retries.

Bounded receipt reads#

Reader

Accepts

Byte bound

baseline_files.read_receipt()

Regular files with no link in their path

16 MiB for series.json; the reproduced length for review.txt

_read() in benchmark_workloads.py

Regular files with one hard link and no symbolic link or reparse point

64 MiB for benchmark receipts

  • Both readers size each request to the bytes still expected, at most 64 KiB, and then read one more byte to detect growth.

  • read_receipt() also compares the device, inode, size and modification time of the path and the open file before and after the read.

  • Requesting the whole bound on every read would make even a tiny receipt allocate tens of MiB.

Selection cost#

scan_campaigns() in baseline_selection.py selects exactly. It ranks every sorted group of N whole campaigns, C(candidate_count, N) groups, as Campaign selection defines.

  • It validates each campaign’s observations and computes its metric medians once, before the enumeration.

  • It first checks that each metric’s widest possible score is a valid number, so pruning cannot hide an invalid score.

  • A group is abandoned as soon as one metric’s score exceeds the worst score of the best eligible group so far.

  • The pooled noise gate tries the most recently rejecting metric first.

  • An eligible group with a zero score ends the search. Sorted campaign IDs already break ties.

  • When any observation is 1e300 or more, the gate evaluates every metric in key order instead, so overflow errors surface unchanged.

  • The worst case stays O(C(candidate_count, N) × metrics), notably when no group qualifies. No candidate cap, approximation or weakened noise gate is used, so a larger N can need more collection and selection time.

  • The collection deadline is checked between every step.

Baseline collection tests#

The file, campaign, selection, publication, review and CLI tests are pure Python and need no native build. Before you begin, run --validate once, which creates the Python test venv _build/deps/venv/python_tests. Run them from ovclash/, so that benchmarks imports. $TEST_PY is that test venv, not the KPI input Python $PY; tests and goldens lists the other KPI tests.

Linux:

TEST_PY=_build/deps/venv/python_tests/bin/python3
"$TEST_PY" -B -m unittest discover -s tests/python_tests -t tests/python_tests -p "test_kpi_baseline_*.py"
"$TEST_PY" -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_generated_baseline.py
"$TEST_PY" -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_archive_bounds.py
"$TEST_PY" -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_benchmark_receipt_reads.py

Windows:

set TEST_PY=_build\deps\venv\python_tests\Scripts\python.exe
%TEST_PY% -B -m unittest discover -s tests/python_tests -t tests/python_tests -p "test_kpi_baseline_*.py"
%TEST_PY% -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_generated_baseline.py
%TEST_PY% -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_archive_bounds.py
%TEST_PY% -B -m unittest discover -s tests/python_tests -t tests/python_tests -p test_kpi_benchmark_receipt_reads.py

Each command exits with 0 when every test it discovered passes.

They cover thread and process exclusion with recovery after an abrupt exit; malformed, growing and oversized files; changes to unselected inputs; equivalence with an exhaustive ranking; and rejection of retired acquisition policies and package schemas. The fork cases run only where os.fork exists, and the Windows retry cases only on Windows.