-
Notifications
You must be signed in to change notification settings - Fork 11
Contributing: Running Tests
rocCV has two parallel test suites: C++ for the core library, Python for rocpycv bindings. Build with -DTESTS=ON first (see Contributing: Building).
From the build/ directory:
ctest # run all
ctest -VV # verbose output
ctest -R test_op_resize # filter by name (regex)
ctest -j$(nproc) # parallelRun a single test binary directly for fastest iteration:
./bin/tests/operators/test_op_resizeEach operator has its own executable under build/bin/tests/.
Point PYTHONPATH at the build's lib directory, then use pytest:
export PYTHONPATH=$PWD/lib:$PYTHONPATH
python3 -m pytest tests/roccv/python/ # all
python3 -m pytest tests/roccv/python/test_op_resize.py # one file
python3 -m pytest -v -k "resize" # filter by keywordrocCV uses a custom test framework — not Google Test or Catch2. Each test binary has its own main(). Two macros do the work:
EXPECT_TEST_STATUS(call, expected_status); // assert a call returns expected eTestStatusType
EXPECT_EXCEPTION(call, expected_status); // assert a call throws with expected eStatusTypeBoth are defined in tests/roccv/cpp/include/test_helpers.hpp.
The standard correctness check: run the operator on CPU (eDeviceType::CPU), run it on GPU (eDeviceType::GPU), compare results.
op(stream, input, gpu_output, ..., eDeviceType::GPU);
op(stream, input, cpu_output, ..., eDeviceType::CPU);
EXPECT_TEST_STATUS(compareArray(gpu_output, cpu_output, threshold), TEST_SUCCESS);Helpers like compareArray and compareImage live in test_helpers.hpp.
- C++: add
tests/roccv/cpp/src/tests/operators/test_op_<name>.cpp— CMakeGLOB_RECURSEpicks it up automatically. - Python: add
tests/roccv/python/test_op_<name>.py— pytest discovers it.
The Contributing: Writing a New Operator page covers both end-to-end.
- Operator scaffolding → Contributing: Writing a New Operator
- Performance work → Contributing: Benchmarks
- Home
- Contributing
-
Architecture
- Overview
- Containers
- Kernel Wrappers
- Operator Flow