Skip to content

Commit 5248452

Browse files
committed
Run internal tests in FreeBSD
1 parent e561f63 commit 5248452

File tree

5 files changed

+48
-11
lines changed

5 files changed

+48
-11
lines changed

.github/workflows/testing.yml

+25-2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,29 @@ jobs:
354354
make install -j Q=
355355
- name: Run tests
356356
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -o igncr '{0}'
357-
run: | # Allow asm/test.sh to run `git describe` for the version test
358-
git config --global --add safe.directory '*'
357+
run: |
359358
test/run-tests.sh --only-internal
359+
360+
freebsd:
361+
runs-on: ubuntu-latest
362+
timeout-minutes: 30
363+
steps:
364+
- name: Checkout repo
365+
uses: actions/checkout@v4
366+
- name: Build & test on FreeBSD
367+
uses: vmactions/freebsd-vm@v1
368+
with:
369+
release: "15.0"
370+
usesh: true
371+
prepare: | # FreeBSD `c++` compiler does not support `make develop` sanitizers ASan or UBSan
372+
pkg install -y \
373+
bash \
374+
bison \
375+
cmake \
376+
git \
377+
png
378+
run: |
379+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=c++ -DUSE_EXTERNAL_TESTS=OFF
380+
cmake --build build -j4 --verbose
381+
cmake --install build --verbose
382+
cmake --build build --target test

test/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
# SPDX-License-Identifier: MIT
22

3-
OPTION(USE_NONFREE_TESTS "run tests that build nonfree codebases" ON)
3+
option(USE_NONFREE_TESTS "run tests that build nonfree codebases" ON)
4+
option(USE_EXTERNAL_TESTS "run tests that build external codebases" ON)
45

56
if(NOT USE_NONFREE_TESTS)
67
set(ONLY_FREE "--only-free")
78
endif()
9+
if(NOT USE_EXTERNAL_TESTS)
10+
set(ONLY_INTERNAL "--only-internal")
11+
endif()
812

913
add_executable(randtilegen gfx/randtilegen.cpp)
1014
add_executable(rgbgfx_test gfx/rgbgfx_test.cpp)
@@ -27,6 +31,6 @@ foreach(TARGET randtilegen rgbgfx_test)
2731
endforeach()
2832

2933
add_test(NAME all
30-
COMMAND ./run-tests.sh ${ONLY_FREE}
34+
COMMAND ./run-tests.sh ${ONLY_FREE} ${ONLY_INTERNAL}
3135
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
3236
)

test/CTestCustom.cmake.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
set(CTEST_CUSTOM_PRE_TEST "bash -c 'cd @CMAKE_CURRENT_SOURCE_DIR@\; ./fetch-test-deps.sh @ONLY_FREE@'")
1+
set(CTEST_CUSTOM_PRE_TEST "bash -c 'cd @CMAKE_CURRENT_SOURCE_DIR@\; ./fetch-test-deps.sh @ONLY_FREE@ @ONLY_INTERNAL@'")

test/fetch-test-deps.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ cd "$(dirname "$0")"
66
usage() {
77
echo "Downloads source code of Game Boy programs used as RGBDS test cases."
88
echo "Options:"
9-
echo " -h, --help show this help message"
10-
echo " --only-free download only freely licensed codebases"
11-
echo " --get-deps install programs' own dependencies instead of themselves"
12-
echo " --get-hash print programs' commit hashes instead of downloading them"
13-
echo " --get-paths print programs' GitHub paths instead of downloading them"
9+
echo " -h, --help show this help message"
10+
echo " --only-free download only freely licensed codebases"
11+
echo " --only-internal do not download any codebases"
12+
echo " --get-deps install programs' own dependencies instead of themselves"
13+
echo " --get-hash print programs' commit hashes instead of downloading them"
14+
echo " --get-paths print programs' GitHub paths instead of downloading them"
1415
}
1516

1617
# Parse options in pure Bash because macOS `getopt` is stuck
1718
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
1819
nonfree=true
20+
external=true
1921
actionname=
2022
osname=
2123
while [[ $# -gt 0 ]]; do
@@ -27,6 +29,9 @@ while [[ $# -gt 0 ]]; do
2729
--only-free)
2830
nonfree=false
2931
;;
32+
--only-internal)
33+
external=false
34+
;;
3035
--get-deps)
3136
actionname="$1"
3237
shift
@@ -97,6 +102,10 @@ case "$actionname" in
97102
}
98103
esac
99104

105+
if ! "$external"; then
106+
exit
107+
fi
108+
100109
if "$nonfree"; then
101110
action pret pokecrystal 2024-12-28 86a87a355e6805663cfecf150a3af71c66441a3e
102111
action pret pokered 2024-12-26 f023c68417ff0b14db1ab28ecff67f8d123ede44

test/run-tests.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ while [[ $# -gt 0 ]]; do
2424
;;
2525
--only-free)
2626
nonfree=false
27-
FETCH_TEST_DEPS="fetch-test-deps.sh --only-free"
27+
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-free"
2828
;;
2929
--only-internal)
3030
external=false
31+
FETCH_TEST_DEPS="$FETCH_TEST_DEPS --only-internal"
3132
;;
3233
--)
3334
break

0 commit comments

Comments
 (0)