Have the tests installed separately from pyverbs as they're not a part of the package. They will now be placed under /usr/share/doc/rdma-core-{version}/tests. The tests can be executed as follows: python3 /usr/share/doc/rdma-core-{version}/run_tests.py Signed-off-by: Noa Osherovich <noaos@xxxxxxxxxxxx> --- CMakeLists.txt | 11 +++++++++++ buildlib/pyverbs_functions.cmake | 7 +++++++ debian/python3-pyverbs.install | 2 ++ pyverbs/CMakeLists.txt | 17 ----------------- redhat/rdma-core.spec | 2 ++ pyverbs/run_tests.py => run_tests.py | 0 suse/rdma-core.spec | 2 ++ 7 files changed, 24 insertions(+), 17 deletions(-) rename pyverbs/run_tests.py => run_tests.py (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc17ef36cf24..d076ab2c9d3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -648,6 +648,7 @@ add_subdirectory(infiniband-diags/man) if (CYTHON_EXECUTABLE) add_subdirectory(pyverbs) + add_subdirectory(tests) endif() # Binaries @@ -666,6 +667,16 @@ if (UDEV_FOUND) endif() add_subdirectory(srp_daemon) +if (CYTHON_EXECUTABLE) +rdma_python_test("" + run_tests.py + ) + +rdma_internal_binary( + run_tests.py + ) +endif() + ibverbs_finalize() rdma_finalize_libs() diff --git a/buildlib/pyverbs_functions.cmake b/buildlib/pyverbs_functions.cmake index 9d5258617035..8ea5dc0df7de 100644 --- a/buildlib/pyverbs_functions.cmake +++ b/buildlib/pyverbs_functions.cmake @@ -35,6 +35,13 @@ function(rdma_python_module PY_MODULE) endforeach() endfunction() +function(rdma_python_test PY_MODULE) + foreach(PY_FILE ${ARGN}) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PY_FILE} + DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PY_MODULE}) + endforeach() +endfunction() + # Make a python script runnable from the build/bin directory with all the # correct paths filled in function(rdma_internal_binary) diff --git a/debian/python3-pyverbs.install b/debian/python3-pyverbs.install index 20130d8a9a03..10efb97232fd 100644 --- a/debian/python3-pyverbs.install +++ b/debian/python3-pyverbs.install @@ -1 +1,3 @@ usr/lib/python3/dist-packages/pyverbs +usr/share/doc/rdma-core/run_tests.py +usr/share/doc/rdma-core/tests diff --git a/pyverbs/CMakeLists.txt b/pyverbs/CMakeLists.txt index 328263fcc739..da49093c2cf0 100644 --- a/pyverbs/CMakeLists.txt +++ b/pyverbs/CMakeLists.txt @@ -16,22 +16,5 @@ rdma_cython_module(pyverbs rdma_python_module(pyverbs __init__.py pyverbs_error.py - run_tests.py utils.py ) - -rdma_python_module(pyverbs/tests - tests/__init__.py - tests/addr.py - tests/base.py - tests/cq.py - tests/device.py - tests/mr.py - tests/pd.py - tests/qp.py - tests/utils.py - ) - -rdma_internal_binary( - run_tests.py - ) diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec index f07919ccecd5..239c56b581e8 100644 --- a/redhat/rdma-core.spec +++ b/redhat/rdma-core.spec @@ -650,4 +650,6 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh %if %{with_pyverbs} %files -n python3-pyverbs %{python3_sitearch}/pyverbs +%{_docdir}/%{name}-%{version}/tests/*.py +%{_docdir}/%{name}-%{version}/run_tests.py %endif diff --git a/pyverbs/run_tests.py b/run_tests.py similarity index 100% rename from pyverbs/run_tests.py rename to run_tests.py diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec index 5a01327c4852..cdb6793e4f75 100644 --- a/suse/rdma-core.spec +++ b/suse/rdma-core.spec @@ -852,6 +852,8 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh %if %{with_pyverbs} %files -n python3-pyverbs %{python3_sitearch}/pyverbs +%{_docdir}/%{name}-%{version}/tests/*.py +%{_docdir}/%{name}-%{version}/run_tests.py %endif %changelog -- 2.21.0