Skip to content

Commit 9b11b6b

Browse files
authored
fixed #13979 - added macos-15 to CI / adjusted some tests (#6519)
1 parent 326a930 commit 9b11b6b

File tree

7 files changed

+46
-13
lines changed

7 files changed

+46
-13
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
os: [ubuntu-22.04, macos-13]
23+
os: [ubuntu-22.04, macos-13, macos-15]
2424
fail-fast: false # Prefer quick result
2525

2626
runs-on: ${{ matrix.os }}
@@ -75,7 +75,7 @@ jobs:
7575

7676
strategy:
7777
matrix:
78-
os: [ubuntu-22.04, macos-13]
78+
os: [ubuntu-22.04, macos-13, macos-15]
7979
fail-fast: false # Prefer quick result
8080

8181
runs-on: ${{ matrix.os }}
@@ -155,7 +155,7 @@ jobs:
155155

156156
strategy:
157157
matrix:
158-
os: [ubuntu-22.04, macos-13]
158+
os: [ubuntu-22.04, macos-13, macos-15]
159159
fail-fast: false # Prefer quick result
160160

161161
runs-on: ${{ matrix.os }}
@@ -189,7 +189,7 @@ jobs:
189189

190190
strategy:
191191
matrix:
192-
os: [ubuntu-22.04, macos-13]
192+
os: [ubuntu-22.04, macos-13, macos-15]
193193
fail-fast: false # Prefer quick result
194194

195195
runs-on: ${{ matrix.os }}
@@ -223,7 +223,7 @@ jobs:
223223

224224
strategy:
225225
matrix:
226-
os: [ubuntu-22.04, macos-13]
226+
os: [ubuntu-22.04, macos-13, macos-15]
227227
fail-fast: false # Prefer quick result
228228

229229
runs-on: ${{ matrix.os }}
@@ -247,7 +247,7 @@ jobs:
247247

248248
strategy:
249249
matrix:
250-
os: [ubuntu-22.04, macos-13]
250+
os: [ubuntu-22.04, macos-13, macos-15]
251251
include:
252252
- xdist_n: auto
253253
# FIXME: test_color_tty fails with xdist
@@ -284,16 +284,30 @@ jobs:
284284
if: contains(matrix.os, 'macos')
285285
run: |
286286
# pcre was removed from runner images in November 2022
287-
brew install coreutils python3 pcre gnu-sed
287+
brew install coreutils pcre gnu-sed
288288
289-
- name: Install missing Python packages
289+
- name: Install missing Python packages on ubuntu
290+
if: contains(matrix.os, 'ubuntu')
290291
run: |
291292
python3 -m pip install pip --upgrade
292293
python3 -m pip install pytest
293294
python3 -m pip install pytest-timeout
294295
python3 -m pip install pytest-xdist
295296
python3 -m pip install psutil
296297
298+
# we need to use -break-system-packages --user because the common approaches do not work.
299+
# using pip works but it appears to install the packages into a different Python installation so they are not found later on.
300+
# using python3 -m pip without the additional flags fails since the packages are being managed by a different tool (brew) and that lacks some of the packages.
301+
# using pipx also does not work.
302+
- name: Install missing Python packages on macos
303+
if: contains(matrix.os, 'macos')
304+
run: |
305+
python3 -m pip install --break-system-packages --user pip --upgrade
306+
python3 -m pip install --break-system-packages --user pytest
307+
python3 -m pip install --break-system-packages --user pytest-timeout
308+
python3 -m pip install --break-system-packages --user pytest-xdist
309+
python3 -m pip install --break-system-packages --user psutil
310+
297311
- name: Build cppcheck
298312
run: |
299313
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"

.github/workflows/scriptcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ jobs:
203203
dmake:
204204
strategy:
205205
matrix:
206-
os: [ubuntu-22.04, macos-13, windows-2025]
206+
os: [ubuntu-22.04, macos-13, macos-15, windows-2025]
207207
fail-fast: false
208208

209209
runs-on: ${{ matrix.os }}

test/cfg/gnu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ int deallocuse_backtrace(int size) {
5858
return numEntries;
5959
}
6060

61+
#if !defined(__APPLE__)
6162
void leakReturnValNotUsed_get_current_dir_name(void)
6263
{
6364
// cppcheck-suppress leakReturnValNotUsed
@@ -114,7 +115,6 @@ int nullPointer_gethostbyname_r(const char* name, struct hostent* ret, const cha
114115
return gethostbyname_r(name, ret, buf, buflen, result, h_errnop);
115116
}
116117

117-
118118
int nullPointer_gethostbyaddr_r(const void* addr, socklen_t len, int type, struct hostent* ret, const char* buf, size_t buflen, struct hostent** result, const int* h_errnop)
119119
{
120120
// cppcheck-suppress nullPointer
@@ -129,6 +129,7 @@ int nullPointer_gethostbyaddr_r(const void* addr, socklen_t len, int type, struc
129129
(void) gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, NULL);
130130
return gethostbyaddr_r(addr, len, type, ret, buf, buflen, result, h_errnop);
131131
}
132+
#endif
132133

133134
int nullPointer_getopt_long(int argc, char **argv, const char *optstring,
134135
const struct option *longopts, int *longindex)
@@ -154,6 +155,7 @@ int nullPointer_getopt_long_only(int argc, char* const* argv, const char* optstr
154155
return getopt_long_only(argc, argv, optstring, longopts, longindex);
155156
}
156157

158+
#if !defined(__APPLE__)
157159
int nullPointer_getservent_r(struct servent *restrict result_buf, const char *restrict buf, size_t buflen, struct servent **restrict result)
158160
{
159161
// cppcheck-suppress nullPointer
@@ -173,6 +175,7 @@ void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n)
173175
(void)memrchr(buf,c,43);
174176
return memrchr(s,c,n);
175177
}
178+
#endif
176179

177180
void knownConditionTrueFalse_ffsl(long i)
178181
{
@@ -192,6 +195,7 @@ void knownConditionTrueFalse_ffsll(long long i)
192195
if (ffsll(i) == 0) {}
193196
}
194197

198+
#if !defined(__APPLE__)
195199
int nullPointer_semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout)
196200
{
197201
(void) semtimedop(semid, sops, nsops, NULL); // If the timeout argument is NULL, then semtimedop() behaves exactly like semop().
@@ -227,8 +231,10 @@ int uninitvar_getpw(uid_t uid, char *buf)
227231
// cppcheck-suppress uninitvar
228232
return getpw(someUid, buf);
229233
}
234+
#endif
230235

231236
// Declaration necessary because there is no specific / portable header.
237+
// https://www.eyrie.org/~eagle/software/rra-c-util/xmalloc.html
232238
extern void *xcalloc(size_t nmemb, size_t size);
233239
extern void *xmalloc(size_t size);
234240
extern void *xrealloc(void *block, size_t newsize);
@@ -294,8 +300,10 @@ void valid_code(int argInt1, va_list valist_arg, const int * parg)
294300

295301
if (__builtin_expect(argInt1, 0)) {}
296302
if (__builtin_expect_with_probability(argInt1 + 1, 2, 0.5)) {}
303+
#ifdef __GLIBC__
297304
if (__glibc_unlikely(argInt1 != 0)) {}
298305
if (__glibc_likely(parg != NULL)) {}
306+
#endif
299307
const void *ax1 = __builtin_assume_aligned(parg, 16);
300308
printf("%p", ax1);
301309
const void *ax2 = __builtin_assume_aligned(parg, 32, 8);
@@ -489,6 +497,7 @@ void bufferAccessOutOfBounds()
489497
free(pAlloc2);
490498
}
491499

500+
#if !defined(__APPLE__)
492501
void leakReturnValNotUsed()
493502
{
494503
// cppcheck-suppress [unreadVariable, constVariablePointer]
@@ -508,6 +517,7 @@ void leakReturnValNotUsed()
508517
if (42 == __builtin_expect(42, 0))
509518
return;
510519
}
520+
#endif
511521

512522
#if !defined(__CYGWIN__) && !defined(__APPLE__)
513523
int nullPointer_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)

test/cfg/posix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, s
225225
return getpwnam_r(name, pwd, buffer, bufsize, result);
226226
}
227227

228+
#if !defined(__APPLE__)
228229
int nullPointer_fgetpwent_r(FILE *restrict stream, const struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
229230
{
230231
// cppcheck-suppress nullPointer
@@ -248,6 +249,7 @@ int nullPointer_getpwent_r(const struct passwd *restrict pwbuf, char *restrict b
248249
(void) getpwent_r(pwbuf, buf, buflen, NULL);
249250
return getpwent_r(pwbuf, buf, buflen, pwbufp);
250251
}
252+
#endif
251253

252254
int nullPointer_getgrgid_r(gid_t gid, struct group *restrict grp, char *restrict buf, size_t buflen, struct group **restrict result)
253255
{

test/cfg/runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ CPPCHECK_OPT=(
4444
CXX=g++
4545
CXX_OPT=("-fsyntax-only" "-w" "-std=c++2a")
4646
CC=gcc
47-
CC_OPT=("-fsyntax-only" "-w" "-Wno-implicit-function-declaration" "-std=c11") # TODO: remove -Wno-implicit-function-declaration when warnings are fixed on MacOS
47+
CC_OPT=("-fsyntax-only" "-w" "-std=c11")
4848

4949
function get_pkg_config_cflags {
5050
# TODO: get rid of the error enabling/disabling?

test/signal/test-signalhandler.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
import os
33
import sys
44
import pytest
5+
import platform
6+
7+
from packaging.version import Version
58

69
def __lookup_cppcheck_exe(exe_name):
710
# path the script is located in
@@ -64,7 +67,10 @@ def test_segv():
6467
assert stderr == ''
6568
lines = stdout.splitlines()
6669
if sys.platform == "darwin":
67-
assert lines[0] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (at 0x0).'
70+
if Version(platform.mac_ver()[0]) >= Version('14'):
71+
assert lines[0] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_ACCERR (at 0x0).'
72+
else:
73+
assert lines[0] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (at 0x0).'
6874
else:
6975
assert lines[0] == 'Internal error: cppcheck received signal SIGSEGV - SEGV_MAPERR (reading at 0x0).'
7076
# no stacktrace on macOS

test/testmathlib.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ class TestMathLib : public TestFixture {
684684

685685
ASSERT_THROW_INTERNAL_EQUALS(MathLib::toDoubleNumber("invalid"), INTERNAL, "Internal Error. MathLib::toDoubleNumber: conversion failed: invalid");
686686

687-
#if defined(_LIBCPP_VERSION) && (defined(__APPLE__) && defined(__MACH__))
687+
// AppleClang before 18 reports a different error
688+
#if (defined(__APPLE__) && defined(__MACH__)) && (defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 180000))
688689
ASSERT_THROW_INTERNAL_EQUALS(MathLib::toDoubleNumber("1invalid"), INTERNAL, "Internal Error. MathLib::toDoubleNumber: conversion failed: 1invalid");
689690
ASSERT_THROW_INTERNAL_EQUALS(MathLib::toDoubleNumber("1.1invalid"), INTERNAL, "Internal Error. MathLib::toDoubleNumber: conversion failed: 1.1invalid");
690691
#else

0 commit comments

Comments
 (0)