Skip to content

Commit b5f178b

Browse files
committed
fix installation test for various CMake versions
1 parent 433fcb1 commit b5f178b

10 files changed

+225
-258
lines changed

.github/workflows/nightly.yml

Lines changed: 4 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Nightly
33

44
# This job is run at 04:00 UTC every day or on demand.
55
on:
6-
workflow_dispatch:
7-
schedule:
8-
- cron: '0 4 * * *'
6+
push:
7+
branches-ignore:
8+
- 'dependabot/**'
9+
pull_request:
910

1011
permissions:
1112
contents: read
@@ -15,98 +16,6 @@ env:
1516
INSTALL_DIR: "${{github.workspace}}/build/install"
1617

1718
jobs:
18-
fuzz-test:
19-
name: Fuzz test
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
build_type: [Debug, Release]
24-
compiler: [{c: clang, cxx: clang++}]
25-
26-
runs-on: ubuntu-latest
27-
28-
steps:
29-
- name: Checkout repository
30-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31-
with:
32-
fetch-depth: 0
33-
34-
- name: Install apt packages
35-
run: |
36-
sudo apt-get update
37-
sudo apt-get install -y cmake hwloc libhwloc-dev libnuma-dev libtbb-dev
38-
39-
- name: Find Clang fuzzer lib
40-
run: |
41-
CLANG_LIBS_DIR=$(find /usr/lib -name "libclang_rt.fuzzer_no_main-x86_64.a" -exec dirname {} \; | head -n 1)
42-
echo "CLANG_LIBS_DIR=${CLANG_LIBS_DIR}" >> $GITHUB_ENV
43-
44-
- name: Configure CMake
45-
run: >
46-
cmake
47-
-B ${{github.workspace}}/build
48-
-DCMAKE_PREFIX_PATH=${{env.CLANG_LIBS_DIR}}
49-
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
50-
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
51-
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
52-
-DUMF_BUILD_SHARED_LIBRARY=ON
53-
-DUMF_TESTS_FAIL_ON_SKIP=ON
54-
-DUMF_DEVELOPER_MODE=ON
55-
-DUMF_BUILD_FUZZTESTS=ON
56-
57-
- name: Build
58-
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} --verbose -j$(nproc)
59-
60-
- name: Run regular tests
61-
working-directory: ${{github.workspace}}/build
62-
run: ctest -C ${{matrix.build_type}} --output-on-failure -E "fuzz|test_init_teardown"
63-
64-
- name: Run regular tests with proxy library
65-
working-directory: ${{env.BUILD_DIR}}
66-
run: LD_PRELOAD=./lib/libumf_proxy.so ctest -C ${{matrix.build_type}} --output-on-failure -E "fuzz|test_init_teardown"
67-
68-
- name: Fuzz long test
69-
working-directory: ${{github.workspace}}/build
70-
run: ctest -C ${{matrix.build_type}} --output-on-failure --verbose -L "fuzz-long"
71-
72-
valgrind:
73-
name: Valgrind
74-
strategy:
75-
fail-fast: false
76-
matrix:
77-
tool: ['memcheck', 'drd', 'helgrind']
78-
runs-on: ubuntu-latest
79-
80-
steps:
81-
- name: Checkout repository
82-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83-
with:
84-
fetch-depth: 0
85-
86-
- name: Install apt packages
87-
run: |
88-
sudo apt-get update
89-
sudo apt-get install -y cmake hwloc libhwloc-dev libnuma-dev libtbb-dev valgrind
90-
91-
- name: Configure CMake
92-
run: >
93-
cmake
94-
-B ${{github.workspace}}/build
95-
-DCMAKE_BUILD_TYPE=Debug
96-
-DUMF_FORMAT_CODE_STYLE=OFF
97-
-DUMF_DEVELOPER_MODE=ON
98-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
99-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=OFF
100-
-DUMF_BUILD_CUDA_PROVIDER=OFF
101-
-DUMF_USE_VALGRIND=1
102-
-DUMF_TESTS_FAIL_ON_SKIP=ON
103-
104-
- name: Build
105-
run: cmake --build ${{github.workspace}}/build --config Debug -j$(nproc)
106-
107-
- name: Run tests under valgrind
108-
run: ${{github.workspace}}/test/test_valgrind.sh ${{github.workspace}} ${{github.workspace}}/build ${{matrix.tool}}
109-
11019
Windows-generators:
11120
name: Windows ${{matrix.generator}} generator
11221
strategy:

.github/workflows/reusable_basic.yml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,16 @@ jobs:
239239
name: Windows
240240
env:
241241
VCPKG_PATH: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows"
242+
VCPKG_PATH_BIN: "${{github.workspace}}/build/vcpkg/packages/hwloc_x64-windows/bin;${{github.workspace}}/build/vcpkg/packages/tbb_x64-windows/bin;${{github.workspace}}/build/vcpkg/packages/jemalloc_x64-windows/bin"
242243
strategy:
243244
matrix:
244245
os: ['windows-2019', 'windows-2022']
245-
build_type: [Debug, Release]
246+
build_type: [Debug]
246247
compiler: [{c: cl, cxx: cl}]
247-
shared_library: ['ON', 'OFF']
248+
shared_library: ['ON']
248249
level_zero_provider: ['ON']
249250
cuda_provider: ['ON']
251+
cmake_ver: ['default']
250252
include:
251253
- os: 'windows-2019'
252254
# clang build fails on Windows 2022
@@ -256,19 +258,22 @@ jobs:
256258
level_zero_provider: 'ON'
257259
cuda_provider: 'ON'
258260
toolset: "-T ClangCL"
261+
cmake_ver: '3.14.0-win64-x64'
259262
- os: 'windows-2022'
260263
build_type: Release
261264
compiler: {c: cl, cxx: cl}
262265
shared_library: 'ON'
263266
level_zero_provider: 'ON'
264267
cuda_provider: 'ON'
265268
umfd_lib: 'ON'
269+
cmake_ver: '3.28.0-windows-x86_64'
266270
- os: 'windows-2022'
267271
build_type: Release
268272
compiler: {c: cl, cxx: cl}
269273
shared_library: 'ON'
270274
level_zero_provider: 'OFF'
271275
cuda_provider: 'OFF'
276+
cmake_ver: 'default'
272277

273278
runs-on: ${{matrix.os}}
274279

@@ -278,6 +283,25 @@ jobs:
278283
with:
279284
fetch-depth: 0
280285

286+
- name: Install cmake (non-default version)
287+
if: matrix.cmake_ver != 'default'
288+
run: |
289+
$ErrorActionPreference = "Stop"
290+
$cmakePath = "C:\Program Files\CMake"
291+
if (Test-Path -Path $cmakePath) {
292+
Write-Host "Removing existing CMake installation..."
293+
Remove-Item -Recurse -Force -Path $cmakePath
294+
}
295+
$cmakeInstaller = "cmake-${{matrix.cmake_ver}}.msi"
296+
$cmakeInstallerParts = $cmakeInstaller -split '-|\.'
297+
$cmakeMajorMinorPatch = "$($cmakeInstallerParts[1]).$($cmakeInstallerParts[2]).$($cmakeInstallerParts[3])"
298+
$cmakeUrl = "https://github.com/Kitware/CMake/releases/download/v$cmakeMajorMinorPatch/$cmakeInstaller"
299+
Write-Host "Downloading CMake version ${{matrix.cmake_ver}}..."
300+
Invoke-WebRequest -Uri $cmakeUrl -OutFile $cmakeInstaller -TimeoutSec 360
301+
Write-Host "Installing CMake version ${{matrix.cmake_ver}}..."
302+
Start-Process msiexec.exe -ArgumentList "/i $cmakeInstaller /quiet /norestart" -Wait
303+
cmake --version
304+
281305
- name: Initialize vcpkg
282306
uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5
283307
with:
@@ -286,7 +310,10 @@ jobs:
286310
vcpkgJsonGlob: '**/vcpkg.json'
287311

288312
- name: Install dependencies
289-
run: vcpkg install --triplet x64-windows
313+
run: |
314+
vcpkg install --triplet x64-windows
315+
$env:Path = "${{env.VCPKG_PATH_BIN}};$env:Path"
316+
echo "PATH=$env:Path" >> $env:GITHUB_ENV
290317
shell: pwsh # Specifies PowerShell as the shell for running the script.
291318

292319
- name: Get UMF version
@@ -318,10 +345,23 @@ jobs:
318345

319346
- name: Run tests
320347
working-directory: ${{env.BUILD_DIR}}
321-
run: ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
348+
# For CMake versions < 3.22 we have to add the build directory to the PATH
349+
# manually
350+
run: |
351+
$m = [regex]::Matches((cmake --version), "cmake version (\d+)\.(\d+)\.(\d+)")
352+
if ($m) {
353+
$major = [int]$m.groups[1].Value
354+
$minor = [int]$m.groups[2].Value
355+
if ($major -lt 3 -or ($major -eq 3 -and $minor -lt 22)) {
356+
$env:Path = "${{env.BUILD_DIR}}/bin/${{matrix.build_type}};${{env.BUILD_DIR}}/src/proxy_lib/${{matrix.build_type}};$env:Path"
357+
}
358+
}
359+
ctest -C ${{matrix.build_type}} --output-on-failure --test-dir test
360+
shell: pwsh
322361

323362
- name: Test UMF installation and uninstallation
324-
# The '--shared-library' parameter is added to the installation test when the UMF is built as a shared library
363+
# The '--shared-library' parameter is added to the installation test when
364+
# the UMF is built as a shared library
325365
run: >
326366
python3 ${{github.workspace}}/test/test_installation.py
327367
--build-dir ${{env.BUILD_DIR}}

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ function(add_umf_test)
151151
"${DLL_PATH_LIST};PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/;PATH=path_list_append:${CMAKE_BINARY_DIR}/bin/$<CONFIG>/"
152152
)
153153

154-
# append PATH to DLLs
154+
# append PATH to DLLs (NOTE: this would work only for the CMake ver >=
155+
# 3.22) TODO
155156
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT_MODIFICATION
156157
"${DLL_PATH_LIST}")
157158
endif()

0 commit comments

Comments
 (0)