Skip to content

Commit d7dfb36

Browse files
committed
Add test for make uninstall target
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent b436b42 commit d7dfb36

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

.github/workflows/basic.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ jobs:
7575
run: ${{github.workspace}}/test/test_make_install.sh \
7676
${{github.workspace}} ${{env.BUILD_DIR}} ${{env.INSTL_DIR}} ${{matrix.build_type}} ${{matrix.shared_library}}
7777

78+
- name: Test make uninstall
79+
working-directory: ${{env.BUILD_DIR}}
80+
run: ${{github.workspace}}/test/test_make_uninstall.sh ${{github.workspace}} ${{env.BUILD_DIR}} ${{env.INSTL_DIR}}
81+
7882
windows-build:
7983
name: Build - Windows
8084
strategy:

test/test_make_uninstall.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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>"
9+
10+
if [ "$3" == "" ]; 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+
19+
if [ ! -f $WORKSPACE/README.md ]; then
20+
echo "Incorrect <workspace_dir>: $WORKSPACE"
21+
echo $USAGE_STR
22+
exit 1
23+
fi
24+
25+
if [ "$BUILD_DIR" == "$WORKSPACE" ]; then
26+
echo "Incorrect <build_dir>: $BUILD_DIR"
27+
echo $USAGE_STR
28+
exit 1
29+
fi
30+
31+
if [ ! -d $INSTALL_DIR ]; then
32+
echo "Incorrect <install_dir> (it must exist): $INSTALL_DIR"
33+
echo $USAGE_STR
34+
exit 1
35+
fi
36+
37+
echo "WORKSPACE=$WORKSPACE"
38+
echo "BUILD_DIR=$BUILD_DIR"
39+
echo "INSTALL_DIR=$INSTALL_DIR"
40+
41+
set -x
42+
43+
MATCH_UNINSTALLED_FILES="${WORKSPACE}/test/test_make_uninstall.txt"
44+
UNINSTALLED_FILES="${BUILD_DIR}/uninstall-files.txt"
45+
46+
cd ${BUILD_DIR}
47+
make uninstall
48+
49+
# check what files are left, there should be only empty directories left after 'make uninstall'
50+
cd ${INSTALL_DIR}
51+
find | sort > ${UNINSTALLED_FILES}
52+
53+
# check if 'make uninstall' left only empty directories
54+
diff ${UNINSTALLED_FILES} ${MATCH_UNINSTALLED_FILES} || exit 1
55+
set +x
56+
57+
echo "Success"

test/test_make_uninstall.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.
2+
./include
3+
./include/umf
4+
./include/umf/pools
5+
./include/umf/providers
6+
./lib
7+
./lib/cmake
8+
./lib/cmake/unified-memory-framework
9+
./share
10+
./share/doc
11+
./share/doc/unified-memory-framework

0 commit comments

Comments
 (0)