Skip to content

Commit 74caca9

Browse files
Update installation test
1 parent 568a456 commit 74caca9

File tree

3 files changed

+57
-5
lines changed

3 files changed

+57
-5
lines changed

.github/workflows/basic.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on: workflow_call
66
permissions:
77
contents: read
88

9+
env:
10+
# for installation testing - it should match with version set in CMake
11+
UMF_VERSION: 0.1.0
12+
913
jobs:
1014
icx-build:
1115
# TODO: we could merge ICX build with gcc/clang (using our dockers) Issue: #259
@@ -34,7 +38,10 @@ jobs:
3438
- name: Install apt packages
3539
run: |
3640
apt-get update
37-
apt-get install -y libnuma-dev libjemalloc-dev libtbb-dev libhwloc-dev sudo
41+
apt-get install -y libnuma-dev libjemalloc-dev libtbb-dev libhwloc-dev python3-pip sudo
42+
43+
- name: Install Python requirements
44+
run: python3 -m pip install -r third_party/requirements.txt
3845

3946
- name: Configure build
4047
run: >
@@ -71,6 +78,7 @@ jobs:
7178
--disjoint-pool
7279
--jemalloc-pool
7380
--scalable-pool
81+
--umf-version ${{env.UMF_VERSION}}
7482
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
7583
7684
ubuntu-build:
@@ -170,6 +178,7 @@ jobs:
170178
--disjoint-pool
171179
--jemalloc-pool
172180
--scalable-pool
181+
--umf-version ${{env.UMF_VERSION}}
173182
${{ matrix.shared_library == 'ON' && '--shared-library' || '' }}
174183
175184
windows-build:
@@ -258,6 +267,7 @@ jobs:
258267
--disjoint-pool
259268
--jemalloc-pool
260269
--scalable-pool
270+
--umf-version ${{env.UMF_VERSION}}
261271
${{ matrix.shared_library == 'ON' && '--shared-library' || ''}}
262272
263273
macos-build:
@@ -304,7 +314,8 @@ jobs:
304314
--build-dir ${{env.BUILD_DIR}}
305315
--install-dir ${{env.INSTL_DIR}}
306316
--build-type ${{env.BUILD_TYPE}}
307-
--shared-library
308317
--disjoint-pool
309318
--jemalloc-pool
310319
--scalable-pool
320+
--umf-version ${{env.UMF_VERSION}}
321+
--shared-library

test/test_installation.py

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import argparse
99
import difflib
10+
from packaging.version import Version
1011
from pathlib import Path
1112
import platform
1213
import subprocess # nosec B404
@@ -25,6 +26,7 @@ class UmfInstaller:
2526
build_type (str): Debug or Release build type passed to the script
2627
shared_library (bool): Determines if the UMF was built as a shared library
2728
pools (List[str]): A list of enabled pools during the UMF compilation
29+
umf_version (Version): UMF version currently being built and installed
2830
match_list (List[str]): A list of relative paths of files that should be installed
2931
"""
3032

@@ -36,13 +38,15 @@ def __init__(
3638
build_type: str,
3739
shared_library: bool,
3840
pools: List[str],
41+
umf_version: Version,
3942
):
4043
self.workspace_dir = workspace_dir
4144
self.build_dir = build_dir
4245
self.install_dir = install_dir
4346
self.build_type = build_type
4447
self.shared_library = shared_library
4548
self.pools = pools
49+
self.umf_version = umf_version
4650
self.match_list = self._create_match_list()
4751

4852
def _create_match_list(self) -> List[str]:
@@ -95,11 +99,34 @@ def _create_match_list(self) -> List[str]:
9599
]
96100
for pool in self.pools:
97101
lib.append(f"lib/{lib_prefix}{pool}.{lib_ext_static}")
98-
lib_ext = lib_ext_shared if self.shared_library else lib_ext_static
99-
lib.append(f"lib/{lib_prefix}umf.{lib_ext}")
102+
if self.shared_library:
103+
lib.append(f"lib/{lib_prefix}umf.{lib_ext_shared}")
104+
105+
if platform.system() == "Linux":
106+
lib.append(
107+
f"lib/{lib_prefix}umf.{lib_ext_shared}.{self.umf_version.major}"
108+
)
109+
lib.append(f"lib/{lib_prefix}umf.{lib_ext_shared}.{self.umf_version}")
110+
elif platform.system() == "Darwin": # MacOS
111+
lib.append(
112+
f"lib/{lib_prefix}umf.{self.umf_version.major}.{lib_ext_shared}"
113+
)
114+
lib.append(f"lib/{lib_prefix}umf.{self.umf_version}.{lib_ext_shared}")
115+
else:
116+
lib.append(f"lib/{lib_prefix}umf.{lib_ext_static}")
117+
100118
if is_umf_proxy:
101119
lib.append(f"lib/{lib_prefix}umf_proxy.{lib_ext_shared}")
102120

121+
if platform.system() == "Linux":
122+
lib.append(
123+
f"lib/{lib_prefix}umf_proxy.{lib_ext_shared}.{self.umf_version.major}"
124+
)
125+
elif platform.system() == "Darwin": # MacOS
126+
lib.append(
127+
f"lib/{lib_prefix}umf_proxy.{self.umf_version.major}.{lib_ext_shared}"
128+
)
129+
103130
share = []
104131
share = [
105132
"share",
@@ -155,9 +182,14 @@ def validate_installed_files(self) -> None:
155182
)
156183
]
157184

185+
expected_files = [
186+
str(entry)
187+
for entry in sorted(self.match_list, key=lambda x: str(x).casefold())
188+
]
189+
158190
diff = list(
159191
difflib.unified_diff(
160-
self.match_list,
192+
expected_files,
161193
installed_files,
162194
fromfile="Expected files",
163195
tofile="Installed files",
@@ -252,6 +284,11 @@ def parse_arguments(self) -> argparse.Namespace:
252284
action="store_true",
253285
help="Add this argument if the UMF was built with Scalable Pool enabled",
254286
)
287+
self.parser.add_argument(
288+
"--umf-version",
289+
action="store",
290+
help="Current version of the UMF, e.g. 1.0.0",
291+
)
255292
return self.parser.parse_args()
256293

257294
def run(self) -> None:
@@ -269,6 +306,7 @@ def run(self) -> None:
269306
pools.append("jemalloc_pool")
270307
if self.args.scalable_pool:
271308
pools.append("scalable_pool")
309+
umf_version = Version(self.args.umf_version)
272310

273311
umf_installer = UmfInstaller(
274312
workspace_dir,
@@ -277,6 +315,7 @@ def run(self) -> None:
277315
self.args.build_type,
278316
self.args.shared_library,
279317
pools,
318+
umf_version,
280319
)
281320

282321
print("Installation test - BEGIN", flush=True)

third_party/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
clang-format==15.0.7
44
cmake-format==0.6.13
55
black==24.3.0
6+
# Tests
7+
packaging==24.0
68
# Generating HTML documentation
79
pygments==2.15.1
810
sphinxcontrib_applehelp==1.0.4

0 commit comments

Comments
 (0)