Skip to content

Commit e2a72c0

Browse files
committed
Fix unit tests on Apple/BSD/Haiku platforms
1 parent 4654786 commit e2a72c0

16 files changed

Lines changed: 58 additions & 32 deletions

.github/workflows/c-cpp.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
name: C/C++ CI
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
build:
7-
87
runs-on: ${{ matrix.os }}
98
strategy:
109
matrix:
1110
os: [ macos-latest, ubuntu-24.04-arm, ubuntu-latest ]
12-
1311
steps:
14-
- uses: actions/checkout@v6
15-
- run: make
16-
- name: Unit tests
12+
- name: Set up build environment (Linux)
1713
run: |
1814
sudo apt-get update
1915
sudo apt-get install check
16+
if: runner.os == 'Linux'
17+
- name: Set up build environment (macOS)
18+
run: |
19+
brew update
20+
brew install check
21+
if: runner.os == 'macOS'
22+
- uses: actions/checkout@v6
23+
- name: Build
24+
run: make
25+
- name: Unit tests
26+
run: |
2027
make clean
2128
make units UNITS=1
2229
./test/units.sh
23-
if: runner.os == 'Linux'
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: BSD, Haiku CI
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
build:
@@ -12,23 +12,21 @@ jobs:
1212
include:
1313
- operating_system: freebsd
1414
version: '15.0'
15-
pkginstall: sudo pkg update && sudo pkg install -y gmake && export MAKE=gmake
15+
pkginstall: sudo pkg update && sudo pkg install -y check gmake && export MAKE=gmake
1616
- operating_system: haiku
1717
version: 'r1beta5'
18-
pkginstall: pkgman refresh
18+
pkginstall: pkgman refresh && pkgman install -y check_devel
1919
- operating_system: netbsd
2020
version: '10.1'
21-
pkginstall: sudo pkgin update && sudo pkgin -y install clang gmake && export MAKE=gmake
21+
pkginstall: sudo pkgin update && sudo pkgin -y install check clang gmake && export MAKE=gmake
2222
- operating_system: openbsd
2323
version: '7.8'
24-
pkginstall: sudo pkg_add -u && sudo pkg_add gmake && export MAKE=gmake
24+
pkginstall: sudo pkg_add -u && sudo pkg_add check gmake && export MAKE=gmake
2525
exclude:
2626
- operating_system: haiku
2727
architecture: arm64
28-
2928
steps:
3029
- uses: actions/checkout@v6
31-
3230
- uses: cross-platform-actions/action@v0.32.0
3331
with:
3432
operating_system: ${{ matrix.operating_system }}
@@ -37,3 +35,6 @@ jobs:
3735
run: |
3836
${{ matrix.pkginstall }}
3937
${MAKE:-make} CC=cc
38+
${MAKE:-make} clean
39+
${MAKE:-make} CC=cc units UNITS=1
40+
./test/units.sh

.github/workflows/msys2.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: MSYS2 CI
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
build:
7-
87
runs-on: ${{ matrix.os }}
98
strategy:
109
matrix:
@@ -17,7 +16,6 @@ jobs:
1716
defaults:
1817
run:
1918
shell: msys2 {0}
20-
2119
steps:
2220
- uses: actions/checkout@v6
2321
- uses: msys2/setup-msys2@v2
@@ -26,5 +24,5 @@ jobs:
2624
update: true
2725
install: make
2826
pacboy: toolchain:p
29-
- run: |
30-
[[ ${{matrix.sys}} == clang* ]] && make CC=clang || make
27+
- name: Build
28+
run: make CC=cc

Makefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ ifeq ($(OS),Darwin)
2222
BREW_PREFIX_CHECK:=$(shell brew --prefix check)
2323
UNIT_CFLAGS+=-I$(BREW_PREFIX_CHECK)/include
2424
UNIT_LDFLAGS+=-L$(BREW_PREFIX_CHECK)/lib
25+
else ifeq ($(OS),FreeBSD)
26+
UNIT_CFLAGS+=-I/usr/local/include
27+
UNIT_LDFLAGS+=-L/usr/local/lib
28+
else ifeq ($(OS),Haiku)
29+
UNIT_CFLAGS+=-I/system/develop/headers
30+
UNIT_LDFLAGS+=-L/system/lib -lnetwork
31+
else ifeq ($(OS),NetBSD)
32+
UNIT_CFLAGS+=-I/usr/pkg/include
33+
UNIT_LDFLAGS+=-L/usr/pkg/lib -Wl,-R/usr/pkg/lib
34+
else ifeq ($(OS),OpenBSD)
35+
UNIT_CFLAGS+=-I/usr/local/include
36+
UNIT_LDFLAGS+=-L/usr/local/lib
2537
else ifeq ($(OS),Linux)
2638
UNIT_LDFLAGS+=-lsubunit
2739
endif
@@ -37,9 +49,18 @@ STRIP?=0
3749
RTOS?=0
3850
GENERIC?=0
3951
PTHREAD?=0
40-
ADDRESS_SANITIZER?=1
4152
GCOV?=0
4253

54+
ifeq ($(OS),Haiku)
55+
ADDRESS_SANITIZER=0
56+
else ifeq ($(OS),NetBSD)
57+
ADDRESS_SANITIZER=0
58+
else ifeq ($(OS),OpenBSD)
59+
ADDRESS_SANITIZER=0
60+
else
61+
ADDRESS_SANITIZER?=1
62+
endif
63+
4364
# Default compiled-in protocols
4465
#
4566
TCP?=1

docs/user_manual/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
pdflatex user_doc.tex && pdflatex user_doc.tex && pdflatex user_doc.tex

make-gnu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
make PTHREAD=1 TCP=1 UDP=1 VDE=1 \
44
RTOS=0 \

mkdeps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
if [ "$#" -eq 0 ]; then
44
echo "Supply PREFIX for building pico_defines.h"

modules/pico_dev_ppp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ static void ipcp_send_req(struct pico_device_ppp *ppp)
12331233

12341234
static void ipcp_reject_vj(struct pico_device_ppp *ppp, uint8_t *comp_req)
12351235
{
1236-
uint8_t ipcp_req[PPP_HDR_SIZE + PPP_PROTO_SLOT_SIZE + sizeof(struct pico_ipcp_hdr) + IPCP_VJ_LEN + PPP_FCS_SIZE + 1];
1236+
uint8_t ipcp_req[PPP_HDR_SIZE + PPP_PROTO_SLOT_SIZE + sizeof(struct pico_ipcp_hdr) + IPCP_VJ_LEN + PPP_FCS_SIZE + 1] = { 0 };
12371237
uint32_t prefix = PPP_HDR_SIZE + PPP_PROTO_SLOT_SIZE;
12381238
struct pico_ipcp_hdr *ih = (struct pico_ipcp_hdr *) (ipcp_req + prefix);
12391239
uint8_t *p = ipcp_req + prefix + sizeof(struct pico_ipcp_hdr);

test/autotest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
set -x
44
TFTP_EXEC_DIR="$(pwd)/build/test"

test/coverage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
./test/units.sh || exit 1
33
./test/autotest.sh || exit 2
44
exit 0

0 commit comments

Comments
 (0)