Skip to content

Commit 71a6552

Browse files
authored
Merge pull request #111 from thbeu/fix-diff-cmd
Let CTest succeed on Windows by ignoring CR
2 parents 5fecb1f + 7b01427 commit 71a6552

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8+
defaults:
9+
run:
10+
shell: bash
11+
812
jobs:
913
build-autoconf:
1014
name: linux-autoconf
@@ -41,7 +45,8 @@ jobs:
4145
toolchain:
4246
- linux-gcc
4347
- macos-clang
44-
- windows-msvc
48+
- windows-msvc-shared
49+
- windows-msvc-static
4550

4651
configuration:
4752
- Release
@@ -55,7 +60,11 @@ jobs:
5560
os: macos-latest
5661
compiler: clang
5762

58-
- toolchain: windows-msvc
63+
- toolchain: windows-msvc-shared
64+
os: windows-latest
65+
compiler: msvc
66+
67+
- toolchain: windows-msvc-static
5968
os: windows-latest
6069
compiler: msvc
6170

@@ -64,10 +73,22 @@ jobs:
6473
uses: actions/checkout@v4
6574

6675
- name: Configure (${{ matrix.configuration }})
67-
run: cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_UNITY_BUILD=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
76+
run: |
77+
if [ "${{ matrix.toolchain }}" == "windows-msvc-shared" ]; then
78+
cmake -S . -Bbuild -DCMAKE_UNITY_BUILD=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DBUILD_SHARED_LIBS=ON
79+
elif [ "${{ matrix.toolchain }}" == "windows-msvc-static" ]; then
80+
cmake -S . -Bbuild -DCMAKE_UNITY_BUILD=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DBUILD_TESTING=ON -DBASH_EXECUTABLE="C:/Program Files/Git/bin/bash.exe" -DBUILD_SHARED_LIBS=OFF
81+
else
82+
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DCMAKE_UNITY_BUILD=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DBUILD_TESTING=ON
83+
fi
6884
6985
- name: Build with ${{ matrix.compiler }}
70-
run: cmake --build build
86+
run: |
87+
if [ "${{ matrix.compiler }}" == "msvc" ]; then
88+
cmake --build build --config ${{ matrix.configuration }}
89+
else
90+
cmake --build build
91+
fi
7192
7293
- name: Test
73-
run: cd build && ctest -V .
94+
run: ctest --test-dir build --build-config ${{ matrix.configuration }} --verbose

contrib/tests/shpproj.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ readonly SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
2020
"${SHPDUMP:-$top_builddir/shpdump}" -precision 8 "test" > "test.out"
2121

2222

23-
if result=$(diff "$SCRIPTDIR/expect.out" "test.out"); then
23+
if result=$(diff --strip-trailing-cr "$SCRIPTDIR/expect.out" "test.out"); then
2424
echo "******* Test Succeeded *********"
2525
exit 0
2626
else

shputils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ double xshift = 0, yshift = 0; /* NO SHIFT */
107107
/* -------------------------------------------------------------------- */
108108
void setext(char *pt, const char *ext)
109109
{
110-
int i = strlen(pt) - 1;
110+
int i = (int)(strlen(pt) - 1);
111111
for (; i > 0 && pt[i] != '.' && pt[i] != '/' && pt[i] != '\\'; i--)
112112
{
113113
}
@@ -278,7 +278,7 @@ void mergefields()
278278
int strncasecmp2(char *s1, char *s2, int n)
279279
{
280280
if (n < 1)
281-
n = strlen(s1) + 1;
281+
n = (int)(strlen(s1) + 1);
282282

283283
for (int i = 0; i < n; i++)
284284
{

tests/test1.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ echo -------------------------------------------------------------------------
3434
} > s1.out
3535

3636

37-
if result=$(diff "$EXPECT" "s1.out"); then
37+
if result=$(diff --strip-trailing-cr "$EXPECT" "s1.out"); then
3838
echo "******* Stream 1 Succeeded *********"
3939
exit 0
4040
else

tests/test2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13; do
1212
"${SHPDUMP:-./shpdump}" test${i}.shp
1313
done > "s2.out"
1414

15-
if result=$(diff "$EXPECT" "s2.out"); then
15+
if result=$(diff --strip-trailing-cr "$EXPECT" "s2.out"); then
1616
echo "******* Stream 2 Succeeded *********"
1717
exit 0
1818
else

tests/test3.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ readonly EXPECT="${1:-$SCRIPTDIR/expect3.out}"
2727
"${DBFDUMP:-./dbfdump}" test.dbf
2828
} > s3.out
2929

30-
if result=$(diff "$EXPECT" "s3.out"); then
30+
if result=$(diff --strip-trailing-cr "$EXPECT" "s3.out"); then
3131
echo "******* Stream 3 Succeeded *********"
3232
exit 0
3333
else

0 commit comments

Comments
 (0)