diff --git a/intel-qpl.spec b/intel-qpl.spec index eb96f0d..960bdd2 100644 --- a/intel-qpl.spec +++ b/intel-qpl.spec @@ -9,12 +9,14 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: googletest-1.14.0.tar.gz Patch0: qpl-accel.patch -Patch1: qpl-tests.patch -Patch2: qpl-werror.patch +Patch1: qpl-werror.patch +Patch2: qpl-tests.patch +Patch3: qpl-intel-cet.patch BuildRequires: cmake >= 3.1 BuildRequires: gcc-c++ -# BuildRequires: gtest-devel # Gtest is missing in c9s/rhel9 +# gtest is missing in CentOS/RHEL 9/10 +# BuildRequires: gtest-devel BuildRequires: libuuid-devel BuildRequires: libtsan BuildRequires: nasm @@ -44,6 +46,8 @@ applications that use %{name}. %package tests Summary: Test applications that use %{name} Requires: %{name}%{?_isa} = %{version}-%{release} +# gtest is missing in CentOS/RHEL 9/10 +# Requires: gtest %description tests The %{name}-tests package contains test datasets, functional @@ -51,11 +55,11 @@ and cross-test applications that use and test %{name}. %prep %autosetup -p1 -n qpl-%{version} -# Build Gtest 1.14.0 from sources as it is missing in c9s/rhel9 +# Build gtest 1.14.0 from sources as it is missing in CentOS/RHEL 9/10 tar xf %{SOURCE1} mv googletest-1.14.0 google-test mv google-test tools/third-party/ -# Continue to use Gtest 1.14.0 instead of 1.15.2 +# Continue to use gtest 1.14.0 instead of 1.15.2 sed -i -e 's|GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED|GTEST_ATTRIBUTE_UNUSED_|g' tools/tests/common/test_cases.hpp %build @@ -63,7 +67,6 @@ sed -i -e 's|GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED|GTEST_ATTRIBUTE_UNUSED_|g' to -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DDYNAMIC_LOADING_LIBACCEL_CONFIG=ON \ -DQPL_LIBRARY_TYPE=SHARED \ - -DSANITIZE_THREADS=ON \ -DQPL_BUILD_TESTS=ON \ -DQPL_BUILD_EXAMPLES=OFF %cmake_build @@ -92,8 +95,6 @@ sed -i -e 's|GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED|GTEST_ATTRIBUTE_UNUSED_|g' to %files tests %doc doc/source/documentation/get_started_docs/testing.rst %{_datadir}/intel-qpl/testdata -%{_libdir}/libgtest.so -%{_libdir}/libgtest.so.1.14.0 %{_bindir}/qpl-func-tests %{_bindir}/qpl-cross-tests diff --git a/qpl-intel-cet.patch b/qpl-intel-cet.patch new file mode 100644 index 0000000..6b26324 --- /dev/null +++ b/qpl-intel-cet.patch @@ -0,0 +1,45 @@ +--- a/sources/isal/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 ++++ b/sources/isal/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 +@@ -103,3 +103,18 @@ + # Setting POSIX compliance level for Linux builds (to use strnlen() function on Linux) + target_compile_definitions(isal PRIVATE _POSIX_C_SOURCE=200809L) + endif() ++ ++# Enable Intel CET support in assembler sources ++check_c_source_compiles(" ++ #if !defined(__CET__) || (__CET__ & 1) == 0 ++ #error CET_BIT_0_NOT_SET ++ #endif ++ int main() { return 0; } ++" INTEL_CET_ENABLED) ++ ++if(INTEL_CET_ENABLED) ++ target_compile_options(isal_asm PUBLIC "-DINTEL_CET_ENABLED") ++ message(STATUS "Intel CET protection is ENABLED") ++else() ++ message(STATUS "Intel CET protection is NOT enabled") ++endif() +--- a/sources/isal/include/reg_sizes.asm 2025-12-02 14:42:56.000000000 +0100 ++++ b/sources/isal/include/reg_sizes.asm 2025-12-02 14:42:56.000000000 +0100 +@@ -182,6 +182,21 @@ + + %define XWORD(reg) reg %+ x + ++%ifdef INTEL_CET_ENABLED ++ %ifdef __NASM_VER__ ++ %ifidn __OUTPUT_FORMAT__,elf32 ++section .note.gnu.property note alloc noexec align=4 ++DD 0x00000004,0x0000000c,0x00000005,0x00554e47 ++DD 0xc0000002,0x00000004,0x00000003 ++ %endif ++ %ifidn __OUTPUT_FORMAT__,elf64 ++section .note.gnu.property note alloc noexec align=8 ++DD 0x00000004,0x00000010,0x00000005,0x00554e47 ++DD 0xc0000002,0x00000004,0x00000003,0x00000000 ++ %endif ++ %endif ++%endif ++ + %ifidn __OUTPUT_FORMAT__,elf32 + section .note.GNU-stack noalloc noexec nowrite progbits + section .text diff --git a/qpl-tests.patch b/qpl-tests.patch index f92203a..8ebc57c 100644 --- a/qpl-tests.patch +++ b/qpl-tests.patch @@ -1,6 +1,35 @@ --- a/tools/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 +++ b/tools/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 -@@ -27,18 +27,23 @@ if (QPL_BUILD_TESTS) +@@ -17,11 +17,28 @@ endif() + if (QPL_BUILD_TESTS) + add_subdirectory(ref) + add_subdirectory(utils) ++ ++ # Build third-party google-test library required for tests ++ # Build it without clang-tidy checks + set(TEMP_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY}) + set(CMAKE_CXX_CLANG_TIDY "") ++ # Save the main project's current shared/static preference ++ set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) ++ # Force google-test library to build as STATIC ++ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE) ++ # Disable google-test's internal tests to speed up the build ++ set(gtest_build_tests OFF CACHE BOOL "Build gtest tests" FORCE) ++ # Add the subdirectory creating the 'gtest' and 'gtest_main' targets + add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL) ++ # Restore the original shared/static preference for the rest of the project ++ set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libraries" FORCE) ++ # Restore the original clang-tidy preference + set(CMAKE_CXX_CLANG_TIDY ${TEMP_CMAKE_CXX_CLANG_TIDY}) ++ + add_subdirectory(tests) ++ install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/testdata ++ DESTINATION share/intel-qpl ++ COMPONENT RUNTIME) + if (UNIX) + # Disable building google-benchmarks tests + SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) +@@ -27,18 +27,18 @@ if (QPL_BUILD_TESTS) SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) set(TEMP_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY "") @@ -23,11 +52,6 @@ + DESTINATION share/intel-qpl COMPONENT RUNTIME FILE_PERMISSIONS USE_SOURCE_PERMISSIONS) -+install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/testdata -+ DESTINATION share/intel-qpl -+ COMPONENT RUNTIME) -+install(IMPORTED_RUNTIME_ARTIFACTS gtest -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) --- a/tools/tests/functional/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 +++ b/tools/tests/functional/CMakeLists.txt 2025-12-02 14:42:56.000000000 +0100 @@ -22,6 +22,8 @@ add_executable(tests main.cpp diff --git a/tests/functest.sh b/tests/functest.sh index 71c2cfb..797f0ae 100755 --- a/tests/functest.sh +++ b/tests/functest.sh @@ -1,5 +1,5 @@ #!/bin/bash -# This is a software path test, it can be run on a machine without IAA hardware -rpm -qa gtest\* intel-qpl\* +# This is a software path test, it can be run on a machine without any IAA hardware +rpm -qa intel-qpl\* qpl-func-tests --dataset=/usr/share/intel-qpl/testdata/ --gtest_filter=ta_unit\*