Skip to content

Commit e83c6a0

Browse files
authored
Merge pull request #108 from ldorau/Add_test_for_make_install_target
Add test for make install target
2 parents 018acdf + 801b2f5 commit e83c6a0

File tree

3 files changed

+135
-10
lines changed

3 files changed

+135
-10
lines changed

.github/workflows/basic.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ name: BasicBuilds
22

33
on: [push, pull_request]
44

5+
env:
6+
BUILD_DIR : "${{github.workspace}}/build/"
7+
INSTL_DIR : "${{github.workspace}}/build/install-dir"
8+
59
jobs:
610
ubuntu-build:
711
name: Build - Ubuntu
8-
912
strategy:
1013
matrix:
1114
os: ['ubuntu-20.04', 'ubuntu-22.04']
@@ -17,9 +20,11 @@ jobs:
1720
- os: 'ubuntu-20.04'
1821
build_type: Release
1922
compiler: {c: gcc-7, cxx: g++-7}
23+
shared_library: 'OFF'
2024
- os: 'ubuntu-22.04'
2125
build_type: Release
2226
compiler: {c: clang, cxx: clang++}
27+
shared_library: 'OFF'
2328
- os: 'ubuntu-22.04'
2429
build_type: Release
2530
compiler: {c: gcc, cxx: g++}
@@ -43,7 +48,8 @@ jobs:
4348
- name: Configure build
4449
run: >
4550
cmake
46-
-B ${{github.workspace}}/build
51+
-B ${{env.BUILD_DIR}}
52+
-DCMAKE_INSTALL_PREFIX="${{env.INSTL_DIR}}"
4753
-DCMAKE_BUILD_TYPE=${{matrix.build_type}}
4854
-DUMF_BUILD_SHARED_LIBRARY=${{matrix.shared_library}}
4955
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
@@ -57,13 +63,18 @@ jobs:
5763
5864
- name: Build UMF
5965
run: |
60-
cmake --build ${{github.workspace}}/build -j $(nproc)
66+
cmake --build ${{env.BUILD_DIR}} -j $(nproc)
6167
6268
- name: Run tests
63-
working-directory: ${{github.workspace}}/build
69+
working-directory: ${{env.BUILD_DIR}}
6470
run: |
6571
ctest --output-on-failure
6672
73+
- name: Test make install
74+
working-directory: ${{env.BUILD_DIR}}
75+
run: ${{github.workspace}}/test/test_make_install.sh \
76+
${{github.workspace}} ${{env.BUILD_DIR}} ${{env.INSTL_DIR}} ${{matrix.build_type}} ${{matrix.shared_library}}
77+
6778
windows-build:
6879
name: Build - Windows
6980
strategy:
@@ -92,7 +103,7 @@ jobs:
92103
- name: Configure build
93104
run: >
94105
cmake
95-
-B ${{github.workspace}}/build
106+
-B ${{env.BUILD_DIR}}
96107
${{matrix.toolset}}
97108
-DCMAKE_C_COMPILER=${{matrix.compiler.c}}
98109
-DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
@@ -103,10 +114,10 @@ jobs:
103114
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
104115
105116
- name: Build UMF
106-
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
117+
run: cmake --build ${{env.BUILD_DIR}} --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS
107118

108119
- name: Test
109-
working-directory: ${{github.workspace}}/build
120+
working-directory: ${{env.BUILD_DIR}}
110121
run: ctest -C ${{matrix.build_type}} --output-on-failure
111122

112123
macos-build:
@@ -125,16 +136,16 @@ jobs:
125136
- name: Configure build
126137
run: >
127138
cmake
128-
-B ${{github.workspace}}/build
139+
-B ${{env.BUILD_DIR}}
129140
-DCMAKE_BUILD_TYPE=Release
130141
-DUMF_FORMAT_CODE_STYLE=ON
131142
-DUMF_DEVELOPER_MODE=ON
132143
-DUMF_ENABLE_POOL_TRACKING=ON
133144
134145
- name: Run code-style check
135146
run: |
136-
cmake --build ${{github.workspace}}/build --target clang-format-check
147+
cmake --build ${{env.BUILD_DIR}} --target clang-format-check
137148
138149
- name: Build UMF
139150
run: |
140-
cmake --build ${{github.workspace}}/build -j $(sysctl -n hw.logicalcpu)
151+
cmake --build ${{env.BUILD_DIR}} -j $(sysctl -n hw.logicalcpu)

test/test_make_install.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
# Copyright (C) 2024 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
set -e
7+
8+
USAGE_STR="Usage: $(basename $0) <workspace_dir> <build_dir> <install_dir> <build_type:Release|Debug> <shared_library:ON|OFF>"
9+
10+
if [ "$5" == "" ]; then
11+
echo $USAGE_STR
12+
exit 1
13+
fi
14+
15+
WORKSPACE=$(realpath $1)
16+
BUILD_DIR=$(realpath $2)
17+
INSTALL_DIR=$(realpath $3)
18+
BUILD_TYPE=$4
19+
SHARED_LIB=$5
20+
21+
if [ ! -f $WORKSPACE/README.md ]; then
22+
echo "Incorrect <workspace_dir>: $WORKSPACE"
23+
echo $USAGE_STR
24+
exit 1
25+
fi
26+
27+
if [ "$BUILD_DIR" == "$WORKSPACE" ]; then
28+
echo "Incorrect <build_dir>: $BUILD_DIR"
29+
echo $USAGE_STR
30+
exit 1
31+
fi
32+
33+
if [ -d $INSTALL_DIR ]; then
34+
echo "Incorrect <install_dir> (it should not exist): $INSTALL_DIR"
35+
echo $USAGE_STR
36+
exit 1
37+
fi
38+
39+
if [ "$BUILD_TYPE" != "Release" -a "$BUILD_TYPE" != "Debug" ]; then
40+
echo "Incorrect <build_type> argument: $BUILD_TYPE"
41+
echo $USAGE_STR
42+
exit 1
43+
fi
44+
45+
if [ "$SHARED_LIB" != "ON" -a "$SHARED_LIB" != "OFF" ]; then
46+
echo "Incorrect <shared_library> argument: $SHARED_LIB"
47+
echo $USAGE_STR
48+
exit 1
49+
fi
50+
51+
[ "$BUILD_TYPE" == "Release" ] && BUILD_TYPE_STR="release" || BUILD_TYPE_STR="debug"
52+
[ "$SHARED_LIB" == "ON" ] && LIB_EXT_STR="so" || LIB_EXT_STR="a"
53+
54+
echo "WORKSPACE=$WORKSPACE"
55+
echo "BUILD_DIR=$BUILD_DIR"
56+
echo "INSTALL_DIR=$INSTALL_DIR"
57+
echo "BUILD_TYPE=$BUILD_TYPE"
58+
echo "BUILD_TYPE_STR=$BUILD_TYPE_STR"
59+
echo "SHARED_LIB=$SHARED_LIB"
60+
echo "LIB_EXT_STR=$LIB_EXT_STR"
61+
62+
set -x
63+
64+
TEMPLATE_INSTALL_FILES="${WORKSPACE}/test/test_make_install.txt"
65+
INSTALLED_FILES="${BUILD_DIR}/install-files.txt"
66+
MATCH_INSTALLED_FILES="${BUILD_DIR}/install-files-match.txt"
67+
68+
cp -f ${TEMPLATE_INSTALL_FILES} ${MATCH_INSTALLED_FILES}
69+
sed -i "s/@BUILD_TYPE_STR@/$BUILD_TYPE_STR/g" ${MATCH_INSTALLED_FILES}
70+
sed -i "s/@LIB_EXT_STR@/$LIB_EXT_STR/g" ${MATCH_INSTALLED_FILES}
71+
72+
mkdir ${INSTALL_DIR}
73+
cd ${BUILD_DIR}
74+
make install prefix=${INSTALL_DIR}
75+
76+
cd ${INSTALL_DIR}
77+
find | sort > ${INSTALLED_FILES}
78+
79+
# check if 'make install' installed all and only required files
80+
diff ${INSTALLED_FILES} ${MATCH_INSTALLED_FILES} || exit 1
81+
set +x
82+
83+
echo "Success"

test/test_make_install.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.
2+
./include
3+
./include/umf
4+
./include/umf.h
5+
./include/umf/base.h
6+
./include/umf/memory_pool.h
7+
./include/umf/memory_pool_ops.h
8+
./include/umf/memory_provider.h
9+
./include/umf/memory_provider_ops.h
10+
./include/umf/pools
11+
./include/umf/pools/pool_disjoint.h
12+
./include/umf/pools/pool_jemalloc.h
13+
./include/umf/pools/pool_scalable.h
14+
./include/umf/providers
15+
./include/umf/providers/provider_os_memory.h
16+
./lib
17+
./lib/cmake
18+
./lib/cmake/unified-memory-framework
19+
./lib/cmake/unified-memory-framework/unified-memory-framework-config-version.cmake
20+
./lib/cmake/unified-memory-framework/unified-memory-framework-config.cmake
21+
./lib/cmake/unified-memory-framework/unified-memory-framework-targets-@[email protected]
22+
./lib/cmake/unified-memory-framework/unified-memory-framework-targets.cmake
23+
./lib/libdisjoint_pool.a
24+
./lib/libjemalloc_pool.a
25+
./lib/libscalable_pool.a
26+
./lib/libumf.@LIB_EXT_STR@
27+
./lib/libumf_utils.a
28+
./share
29+
./share/doc
30+
./share/doc/unified-memory-framework
31+
./share/doc/unified-memory-framework/LICENSE.TXT

0 commit comments

Comments
 (0)