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 |
|
Worker limits, Python shard planning and task logs |
|
Temporary directories, thread limits and fixture rules |
|
What each CMake test target does |
|
The sample checks of |
|
The steps of a |
|
Engine and serialization correctness |
|
Performance budgets |
|
The evidence a change needs before handoff |
Required validation in Contributing, and the “Validation matrix” section of |
ovRTX clash sample app tests and diagnostics |
The “Developer checks” section of |
Testing and validation strategy#
Validation tests the product as it ships:
test_cpp,test_c_compatandtest_python_runtimeload 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_archiverepeats the C consumer check against the extracted SDK archive.test_python_wheelchecks 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.
--validateandtest_all.*run it. A passingovclash.native.test --testrun 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 |
|---|---|---|
|
Native C++ test programs |
|
|
A pure C11 consumer of the installed CMake package, and a stub test for the C example in |
|
|
Python tests in two groups; see Python test groups |
|
|
Full KPI reference-fixture generation only; the other KPI tests are in |
|
|
The Sentinel controller, its native consumer and its goldens |
|
|
|
The test programs |
|
Test stages and other fixtures |
Every suite |
|
Validation drivers, source scans and packaging checks |
The matching step |
|
ovRTX clash sample app tests |
|
|
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.testalso installs into_build/install/<backend>/bin.test_cppruns 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 |
|---|---|
|
The runner: the test registry, |
|
Test declarations and the shared check helpers |
|
Mesh-vs-mesh queries and the query setters |
|
Point-vs-mesh queries, static and dynamic |
|
The Suite runtime, Suite data, the SQLite round trip and the export helpers |
|
The remaining cases, one file per behavior area |
|
Matrix decomposition. Builds of the OpenUSD backend compare it with the live |
|
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 |
|
One test |
|
Shard |
--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 |
OpenUSD only |
The existing |
Write the test in the source file of its behavior area.
Declare it in
TestNativeClash.h.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:
kSlowTestCostsinTestNativeClash.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_TESTSinscripts/test_cpp.cmake: a test that needs a process in which no other test has run gets an entry, andtest_cppthen runs it alone with--test <name>. Any other test gets none.
Field |
Type |
Required |
Default or values |
Description |
|---|---|---|---|---|
|
|
Yes |
The name registered with |
The test that the estimate weights |
|
|
Yes |
Milliseconds; a test without an entry weighs |
The approximate duration, written as |
|
CMake list item |
No |
A registered test name |
A test that runs in its own process |
Rebuild and reinstall the backend, for example with
build_ovstage.* --release --target test_cpp, which runs the packaged native tests.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 |
|---|---|---|
|
The ownership rule of |
Both backends |
|
Directed triangle-intersection arithmetic |
Both backends |
|
Sentinel record bytes, allocation bounds and payload streaming |
Both backends |
|
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 |
|
Suite bulk writes, numeric formatting and transaction recovery |
Both backends |
|
Directory-store persistence, rollback, codecs and frame indexes |
Both backends |
|
Lossless directory JSON and prepared-frame text codecs |
Both backends |
|
Concurrent directory-store readers, writers and ownership |
Both backends |
|
Store lifetime, callbacks and rollback ownership |
Both backends |
|
The public serializer interface and data lifetimes |
Both backends |
|
Guarded Suite API calls, exceptions and thread-local nesting |
Both backends |
|
Report and async handle lifetimes, the runtime’s cached scope and engine failures |
Both backends |
|
Report creation failure, interruption and retained history |
Both backends |
|
Allocation-failure containment at Suite guard boundaries. Selectors: |
Both backends |
|
Fetch failure, cancellation and retained-history recovery |
ovstage validation |
|
Fetch batching across group, frame-count and payload-size boundaries, payloads, schedulers and ownership |
ovstage validation |
|
Retry-window configuration of the omni client and missing-client warnings |
ovstage only |
|
The USDA text fallback for invalid topology |
ovstage only |
|
Sentinel observer work accounting and concurrency |
ovstage only |
|
Instancing graphs, source selection and transform validation |
ovstage only |
|
Dynamic engine recovery after caller and worker allocation failures, injected inside the real C API |
ovstage only |
|
Report ownership under isolated allocation failures. Selectors: |
ovstage only |
|
Serialization output under isolated allocation failures. Selectors: |
ovstage only |
|
Private Sentinel engine controls, built into |
Sentinel only; |
Notes:
borrowedprograms compileSuiteFetch.cppwithOVCLASH_OVSTAGE_ONLY=1, the ovstage report mode.ownedprograms compile it with0, the OpenUSD mode. Both backend builds produce both.The allocation-failure programs replace
newanddeleteinside the executable. In MSVC Debug, most of them build with_ITERATOR_DEBUG_LEVEL=0, because Debug iterator proxies allocate insidenoexceptconstructors and would terminate before the failure handler runs.ovclash.dynamic_failure.testinstead exits 77 when MSVC iterator debugging is enabled.test_cppreports that as a skip.On Linux,
dynamic_failure,suite_report_ownership_failureandsuite_serialization_failurelink 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:
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>.scripts/run_parallel.pyruns the groups as separate processes. It captures each group’s output and reports every group, even when another one fails.The first group of each program also runs
--helpand--version. The help must containUsage:and the version output(ovclash <version>).
The groups:
Group |
ovstage |
OpenUSD |
|---|---|---|
|
Four groups, |
One group, |
Fresh-process tests |
|
The same |
|
One group each |
Not built |
|
One group each |
The same |
The other |
One group each |
The same |
|
Two groups each, |
Not run |
|
One group each |
Not run |
|
One group per selector |
The same |
|
One group each |
Not built |
|
One group per selector |
Not built |
Why some groups differ:
testParallelContextLifecycleOnBothBackendsraces 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.cppand 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_graphanddynamic_failure, the other programs, thesuite_*groups longest first, and the selectors last.The
suite_*program groups time out after 180 seconds.owned_async_launchand the three ovstage controls time out after 30 seconds. The other groups have no timeout, so a hang shows as aSTARTline without a verdict.By default,
validate_allruns the groups in parallel and a directtest_cpprun runs them one at a time. Parallel tests and shard planning describesOVCLASH_PARALLEL_TESTSandOVCLASH_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 |
|---|---|---|
|
Every module that is not a checker. They use the install tree’s library and its OpenUSD runtime environment |
|
|
The process-tree supervisor tests ( |
|
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 |
|---|---|
|
Each C export forwards to its own private operation, with the same return type and the same parameters in the same order |
|
Every ctypes |
|
|
|
Migration of a legacy |
|
The canonical |
|
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 |
|
The ovstage backend sources follow the OpenUSD implementation: pipeline, broad phase, point clouds, bounds, transforms, result order and settings |
|
|
|
Every shipped skill under |
|
The |
|
The |
|
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 |
|
The viewer setup script, its public package sources and its ovUI runtime discovery |
|
The ovRTX clash sample app’s stage, session, query and packaging behavior. A test whose dependency is missing, such as Python |
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-levelovclash_suitemodule. A shipped module that no test imports reports 0% instead of disappearing.It writes
coverage.json,coverage.xmlandhtml/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-coverageorOVCLASH_MIN_COVERAGEoverrides 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 |
|---|---|---|---|---|
|
A CMake boolean, as a |
No |
|
|
|
A percentage from 0 to 100 |
No |
|
The floor of |
|
A percentage from 0 to 100 |
No |
|
The floor when |
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.clashDetectioncontainer. A Windows Debug build first checks that the Debug CRT modules load from the expected directories.tests/c_compat/extract_doc_snippet.pyextracts the largestcfence ofdocs/consumer/c_quickstart.md. The consumer compiles it against the install tree, or the SDK archive, with warnings as errors.ovclash.capi.doc.stubtestruns the same source against the stubs inDocQuickstartStubTest.c, which drive its error paths and context lifetime.CTest in the consumer project checks the
--helpand--versionoutput 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 |
|
Opens the comment |
Marker |
text |
Yes |
|
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 |
Expected |
|---|---|---|
Exact string-only layout |
|
Rejected: requires a complete OVX path-dictionary header set |
Partial path-dictionary header set |
|
Rejected: requires a complete OVX path-dictionary header set |
Legacy types without path-dictionary headers |
|
Rejected: requires a complete OVX path-dictionary header set |
Dual string headers without path-dictionary headers |
|
Rejected: requires a complete OVX path-dictionary header set |
Legacy string header with new ovstage SDK |
|
Rejected: uses legacy |
Coherent producer header set |
|
Accepted |
ovx include-tree checks describes the validation itself.
Native Suite test build and sample gate#
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.pydirectly.The passing cases cover:
SQLite with JSON and HTML exports, and an exact
--clashdbpath;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
--asyncvalue, 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 |
|---|---|---|---|---|
|
|
Yes |
– |
Imports the checkout’s Python packages, and the staged ovstage or the Python-enabled OpenUSD |
|
|
Yes |
– |
Loads the install tree’s native library |
|
|
For the modules that read fixtures; some fall back to |
– |
Locates the test stages |
|
|
Yes on ovstage |
Unset, read as OpenUSD |
Enables the ovstage-only cases, which modules skip unless it is |
|
The OpenUSD runtime libraries, |
Yes |
– |
Lets the native library find its runtime dependencies |
|
|
Windows ovstage only |
– |
Adds the DLL search directories |
|
A thread count |
No |
|
Limits the OpenBLAS threads of NumPy |
|
|
No |
|
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 |
|---|---|
|
Never runs the product to learn expectations. Preparation generates the fixtures before any timing and checks each bundle against its pin |
|
Runs no geometry predicate or payload digest. Each requested report buffer is copied once, and the report cardinalities come from the same pass |
|
A session ticket is no proof of the fixture bytes. A failed content check at the explicit session close invalidates the session |
|
Derives every verdict itself, never from a label that the child supplies |
|
Rejects a child result that differs from its bound execution |
|
Runs with an explicit interpreter in isolated mode ( |
|
Never supervises processes. The memory observation covers the operation process only; descendants are not measured |
|
Imports no ovclash runtime |
|
Decides sampling; a stable decision never approves a baseline |
|
The settings block is console output only. It never enters reports, logs, JSON or evidence and never changes a decision |
|
Proposes limits from admitted calibration observations; never approves them |
|
Copies only controller-held numbers and fixed public vocabulary into the public record; physical locators and execution captures stay private |
|
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.lockingon Windows,flockelsewhere. A second owner fails at once withbaseline_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_buildlink 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()publishesstatus.json(collection status and exit codes gives its fields). It writes a temporary sibling and replaces the file withos.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 |
|---|---|---|
|
Regular files with no link in their path |
16 MiB for |
|
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.