Skip to content

Commit f16886c

Browse files
authored
Small tidy-ups and extension to the CI testing
1 parent 93215ed commit f16886c

File tree

3 files changed

+80
-23
lines changed

3 files changed

+80
-23
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,31 @@ jobs:
125125
run: |
126126
INSTALL_PREFIX=`pwd`/build/install-dir
127127
cd maint/cmake-tests/install-interface
128-
cmake -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -B build
129-
cd build
130-
make
131-
./test_executable
128+
129+
for useStaticLibs in ON OFF; do
130+
echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
131+
rm -rf build
132+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
133+
(cd build; make)
134+
./build/test_executable
135+
done
132136
133137
- name: Test CMake build interface
134138
run: |
135139
BUILD_DIR=`pwd`
136140
cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
137141
cd ../cmake-tests-build-interface
138142
ln -s "$BUILD_DIR" pcre2
139-
cmake -B build
140-
cd build
141-
make
142-
./test_executable
143+
144+
for buildLibs in "ON;OFF" "OFF;ON"; do
145+
static=$(echo $buildLibs | cut -d';' -f1)
146+
shared=$(echo $buildLibs | cut -d';' -f2)
147+
echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
148+
rm -rf build
149+
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
150+
(cd build; make)
151+
./build/test_executable
152+
done
143153
144154
windows:
145155
name: Windows
@@ -174,19 +184,29 @@ jobs:
174184
run: |
175185
$INSTALL_PREFIX = (pwd).Path + "\build\install-dir"
176186
cd maint/cmake-tests/install-interface
177-
cmake -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -B build -A ${{ matrix.arch }}
178-
cmake --build build --config Release
179-
./build/Release/test_executable.exe
187+
188+
foreach ($useStaticLibs in @("ON", "OFF")) {
189+
echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
190+
rm -Recurse -Force build
191+
cmake -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build -A ${{ matrix.arch }}
192+
cmake --build build --config Release
193+
./build/Release/test_executable.exe
194+
}
180195
181196
- name: Test CMake build interface
182197
run: |
183198
$BUILD_DIR = (pwd).Path
184199
cp -Recurse -Path maint/cmake-tests/build-interface ../cmake-tests-build-interface
185200
cd ../cmake-tests-build-interface
186201
New-Item -ItemType SymbolicLink -Path "pcre2" -Target "$BUILD_DIR"
187-
cmake -B build -A ${{ matrix.arch }}
188-
cmake --build build --config Debug
189-
./build/Debug/test_executable.exe
202+
203+
foreach ($buildLibs in @(@{static="ON"; shared="OFF"}, @{static="OFF"; shared="ON"})) {
204+
echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$($buildLibs.static) =="
205+
rm -Recurse -Force build
206+
cmake -DBUILD_STATIC_LIBS=$($buildLibs.static) -DBUILD_SHARED_LIBS=$($buildLibs.shared) -B build -A ${{ matrix.arch }}
207+
cmake --build build --config Debug
208+
./build/Debug/test_executable.exe
209+
}
190210
191211
freebsd:
192212
name: FreeBSD

.github/workflows/dev.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,39 @@ jobs:
200200
run: |
201201
cd build
202202
cmake --install . --prefix install-dir
203-
# Slight hack to trick RunManifestTest to pass with MinSizeRel.
204-
mv install-dir/lib/cmake/pcre2/pcre2-targets-minsizerel.cmake install-dir/lib/cmake/pcre2/pcre2-targets-release.cmake
205-
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux
203+
../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux minsizerel
206204
../maint/RunSymbolTest install-dir/lib/ ../maint/
207205
206+
- name: Test CMake install interface
207+
run: |
208+
INSTALL_PREFIX=`pwd`/build/install-dir
209+
cd maint/cmake-tests/install-interface
210+
211+
for useStaticLibs in ON OFF; do
212+
echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
213+
rm -rf build
214+
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
215+
(cd build; make)
216+
./build/test_executable
217+
done
218+
219+
- name: Test CMake build interface
220+
run: |
221+
BUILD_DIR=`pwd`
222+
cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
223+
cd ../cmake-tests-build-interface
224+
ln -s "$BUILD_DIR" pcre2
225+
226+
for buildLibs in "ON;OFF" "OFF;ON"; do
227+
static=$(echo $buildLibs | cut -d';' -f1)
228+
shared=$(echo $buildLibs | cut -d';' -f2)
229+
echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
230+
rm -rf build
231+
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
232+
(cd build; make)
233+
./build/test_executable
234+
done
235+
208236
bat:
209237
# Tests with: MSVC 32-bit, and a variety of CMake options
210238
name: Windows (Win32)

maint/RunManifestTest

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ LANG=C # Ensure stable ordering of `sort` output
99
export LANG
1010

1111
if [ "$1" = "" -o "$2" = "" ] ; then
12-
echo "Usage: $0 <dir> <manifest name>" >&2
12+
echo "Usage: $0 <dir> <manifest name> [<build type>]" >&2
1313
exit 1
1414
fi
1515

1616
input_dir="$1"
1717
expected_manifest="$2"
18+
build_type="${3:-release}"
1819

19-
base=`basename $expected_manifest`
20+
actual_file=`basename $expected_manifest`.actual
21+
expected_file=`basename $expected_manifest`.expected
2022

2123
sed=sed
2224
# Helper for Solaris
@@ -29,17 +31,24 @@ find "$input_dir" -print | \
2931
xargs -n1 -- ls -l -d -n | \
3032
$sed -E -e 's/ {2,}/ /g' | \
3133
cut -d' ' -f '1,9-' \
32-
> "$base"
34+
> "$actual_file"
3335

34-
if ! diff -u "$expected_manifest" "$base"; then
36+
# The CMake install is a bit annoying now. Its installed files are actually
37+
# dependent on the build type. So, if the build type is not "release", we need
38+
# to modify the expected manifest to match the actual one.
39+
cat "$expected_manifest" | \
40+
sed -E -e "s/pcre2-targets-release.cmake/pcre2-targets-$build_type.cmake/" \
41+
> "$expected_file"
42+
43+
if ! diff -u "$expected_file" "$actual_file"; then
3544
echo "Installed files differ from expected"
3645

3746
echo "===Actual==="
38-
cat "$base"
47+
cat "$actual_file"
3948
echo "===End==="
4049

4150
exit 1
4251
fi
4352

4453
echo "Installed files match expected"
45-
rm -f "$base"
54+
rm -f "$actual_file" "$expected_file"

0 commit comments

Comments
 (0)