diff --git a/dnn-providers/hip-kernel-provider/CMakeLists.txt b/dnn-providers/hip-kernel-provider/CMakeLists.txt index 3ef73b8ecb42..9ee1ba06707d 100644 --- a/dnn-providers/hip-kernel-provider/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/CMakeLists.txt @@ -148,11 +148,7 @@ if(HIPKERNELPROVIDER_ENABLE_ROCKE) # must precede src/ below, which emits bin/hip_kernel_provider/CTestTestfile.cmake. set(ROCKE_INSTALL_PROVIDER_CTEST_SUBDIR "hip_kernel_provider") set(ROCKE_INSTALL_STANDALONE_CTEST OFF) - # Defer the Python rocKE CI tests (import smoke + golden): their test-artifact - # packaging (rocke package + scripts + golden JSON) is not yet wired into - # TheRock's hipkernelprovider artifact includes, so staging them here would - # fail CI. The C++ smoke tests stay enabled; re-enable once packaging lands. - set(ROCKE_INSTALL_PYTHON_TESTS OFF) + # Route rocke-client test targets into hip-kernel-provider's test bucket so # they appear in install_provider_ctest_files("hip_kernel_provider") output. # Without this, _add_test_target_internal uses rocke-client's own PROJECT_NAME diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/CMakeLists.txt b/dnn-providers/hip-kernel-provider/rocke/platform/CMakeLists.txt index fbacd6cc3f9f..70e94d0eb41b 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/CMakeLists.txt +++ b/dnn-providers/hip-kernel-provider/rocke/platform/CMakeLists.txt @@ -252,6 +252,21 @@ if(ROCKE_INSTALL_TESTS) DESTINATION ${ROCKE_TEST_INSTALL_DIR}) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/tests/golden/rocke_representative_ir_sha256.json" DESTINATION ${ROCKE_TEST_INSTALL_DIR}/golden) + + # Install the full pytest suite for installed/artifact test execution. + # Excludes: C/C++ parity emitters (compiled against rocke_core at build time), + # the differential harness (needs compiler + source), and run_all.py (dev runner). + # cmake-lint: disable=E1122 + block() + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests/" + DESTINATION "${ROCKE_TEST_INSTALL_DIR}/tests" + PATTERN "__pycache__" EXCLUDE + PATTERN "*.pyc" EXCLUDE + PATTERN "*.c" EXCLUDE + PATTERN "*.cpp" EXCLUDE + PATTERN "differential" EXCLUDE + PATTERN "run_all.py" EXCLUDE) + endblock() endif() set(_ROCKE_INSTALLED_CTEST_ENTRIES "") @@ -265,21 +280,30 @@ if(ROCKE_INSTALL_TESTS) endforeach() if(ROCKE_INSTALL_PYTHON_TESTS) - # Stage the Python import smoke in both modes. It sits next to the - # CTestTestfile (provider: bin//, standalone: bin/rocke/ -> "../"), so - # the same "${ROCKE_TEST_CTEST_REL}" prefix reaches it. The co-located rocke - # package is captured by TheRock's test-artifact includes in provider mode. + # Python test entries invoke via "python" (resolved from PATH at test time) + # rather than executing the .py directly, so they work on Windows where + # shebangs are not supported. The CI test environment activates a venv with + # requirements-test.txt before running ctest. string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES - "add_test(rocke_python_import_smoke \"${ROCKE_TEST_CTEST_REL}rocke_installed_smoke.py\")\n") + "add_test(rocke_python_import_smoke python \"${ROCKE_TEST_CTEST_REL}rocke_installed_smoke.py\")\n") string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES "set_tests_properties(rocke_python_import_smoke PROPERTIES LABELS \"ckc;python;quick\")\n") - # Golden IR byte-stability gate (host-only, no GPU). Reached via the same - # relative prefix as the smoke; imports the co-located rocke package + harness. string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES - "add_test(rocke_golden_static \"${ROCKE_TEST_CTEST_REL}rocke_installed_golden_test.py\")\n") + "add_test(rocke_golden_static python \"${ROCKE_TEST_CTEST_REL}rocke_installed_golden_test.py\")\n") string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES "set_tests_properties(rocke_golden_static PROPERTIES LABELS \"ckc;python;golden;host;quick\")\n") + + # Full pytest suite. PYTHONPATH points at the CTestTestfile's working + # directory (which contains the installed rocke package) so `import rocke` + # resolves without the source-tree sys.path shims. + string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES + "add_test(rocke_pytest python -m pytest \"${ROCKE_TEST_CTEST_REL}tests\" -v --timeout=60)\n") + string(APPEND _ROCKE_INSTALLED_CTEST_ENTRIES + "set_tests_properties(rocke_pytest PROPERTIES\n" + " LABELS \"ckc\\;python\\;quick\"\n" + " ENVIRONMENT \"PYTHONPATH=.\"\n" + " TIMEOUT 300)\n") endif() if(ROCKE_INSTALL_PROVIDER_CTEST_SUBDIR) diff --git a/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke_ci_static.py b/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke_ci_static.py index 24547286b144..1f8fc5c6c41f 100644 --- a/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke_ci_static.py +++ b/dnn-providers/hip-kernel-provider/rocke/platform/tests/test_rocke_ci_static.py @@ -35,8 +35,15 @@ current_flavor, ) +_HERE = Path(__file__).resolve().parents[0] _PY_ROOT = Path(__file__).resolve().parents[1] / "python" -_EXAMPLES = _PY_ROOT / "rocke" / "examples" +_EXAMPLES = ( + # Installed layout: tests/ is a sibling of rocke/ (no Python/ wrapper) + _HERE.parent / "rocke" / "examples" + if (_HERE.parent / "rocke" / "examples").is_dir() + # Source-tree layout: tests/ is under rocke/platform/, package at python/rocke/ + else _PY_ROOT / "rocke" / "examples" +) _GOLDEN = ( Path(__file__).resolve().parents[0] / "golden"