diff --git a/.gitignore b/.gitignore index 8284b6e..2a3d185 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /intel-qpl-*.tar.gz +/googletest-*.tar.gz diff --git a/intel-qpl.spec b/intel-qpl.spec index 9a9f989..960bdd2 100644 --- a/intel-qpl.spec +++ b/intel-qpl.spec @@ -6,14 +6,17 @@ Summary: Intel Query Processing Library License: MIT URL: https://github.com/intel/qpl 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 CentOS/RHEL 9/10 +# BuildRequires: gtest-devel BuildRequires: libuuid-devel BuildRequires: libtsan BuildRequires: nasm @@ -43,7 +46,8 @@ applications that use %{name}. %package tests Summary: Test applications that use %{name} Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: gtest +# gtest is missing in CentOS/RHEL 9/10 +# Requires: gtest %description tests The %{name}-tests package contains test datasets, functional @@ -51,7 +55,11 @@ and cross-test applications that use and test %{name}. %prep %autosetup -p1 -n qpl-%{version} -# Continue to use Gtest 1.14.0 instead of 1.15.2 +# 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 sed -i -e 's|GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED|GTEST_ATTRIBUTE_UNUSED_|g' tools/tests/common/test_cases.hpp %build @@ -59,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 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 4463974..8ebc57c 100644 --- a/qpl-tests.patch +++ b/qpl-tests.patch @@ -1,15 +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 -@@ -19,7 +19,7 @@ +@@ -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 "") -- add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL) -+ # add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL) ++ # 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) -@@ -27,18 +27,21 @@ if (QPL_BUILD_TESTS) + # 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 "") @@ -32,9 +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) --- 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/sources b/sources index 3380a15..2f67232 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (intel-qpl-1.9.0.tar.gz) = 4a9c51d6866a517cd6b75f2ec431b00a3b3292e3b15b2a128ccafd807c4b5212b55f05f37dee872ff35df1c0764aed694281145122e63c0918281ad17ce01754 +SHA512 (googletest-1.14.0.tar.gz) = 765c326ccc1b87a01027385e69238266e356361cd4ee3e18e3c9d137a5d11fa5d657c164d02dd1be8fe693c8e10f2b580588dbfa57d27f070e2750f50d3e662c 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\* diff --git a/tests/tests.yml b/tests/tests.yml index 518ddfb..f3e0c92 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -9,5 +9,4 @@ dir: . run: functest.sh required_packages: - - gtest - intel-qpl-tests