Hi all,
I wanted to let everyone know about some upcoming changes we are planning to make in CMake to test registration, specifically in relation to test asset directories.
In an effort to simplify the test registration process, and additionally give us a little more flexibility, we are planning to deprecate the pxr_install_test_dir method and instead specify the test dir via the TESTENV arg to pxr_register_test.
TESTENV was an existing arg, to pxr_register_test, however its behavior is changing a bit. With this new approach TESTENV should receive the value of the test assets directory the registered test requires. This is the equivalent SRC path that pxr_install_test_dir would take. There is no problem passing the same TESTENV path to multiple unique invocations of pxr_register_test.
This change is not 100% backward compatible, however. Existing calls to pxr_register_test which specify a TESTENV should ensure that this value refers to the actual source directory containing the SRC test assets as opposed to the DEST testdir, which would have been the likely case.
As an example, the registration code before this change:
pxr_install_test_dir(
SRC testenv/testUsdGeomMyFeature
DEST testUsdGeomMyFeature
)
pxr_register_test(testUsdGeomMyFeature
PYTHON
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdGeomMyFeature"
EXPECTED_RETURN_CODE 0
)
becomes a single call:
pxr_register_test(testUsdGeomMyFeature
PYTHON
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdGeomMyFeature"
TESTENV testenv/testUsdGeomMyFeature
EXPECTED_RETURN_CODE 0
)
We hope that this change will make adding tests a bit easier for everyone. I am interested in any thoughts or concerns the community may have with this change.
Thanks!