Files
RetroArch/libretro-common/Makefile.test
libretroadmin 48d0aa5227 rxml: a writer
rxml_writer_new builds a document in memory, elements opened, given
attributes and text and closed in order, indented or on one line, and
rxml_write_node writes back a parsed tree or part of one. Text and
attribute values are escaped so that rxml parses them back unchanged,
control characters and line breaks in attributes included. A call that
cannot give well-formed output, or a failed allocation, stops the
writer, and rxml_writer_data then returns NULL.

test/formats/rxml_write_test checks the exact output, the round trip
through the parser, misuse, a 100000-deep document and every allocation
failing in turn, in unit-tests and as a Windows binary under Wine.
2026-11-09 04:53:46 +01:00

777 lines
41 KiB
Makefile

OBJDIR = ../obj-unix
# libcheck's link line is more than -lcheck on most distributions --
# Debian and Ubuntu need -lcheck_pic -lsubunit -lrt -lm -pthread -- so
# ask pkg-config and fall back to the bare flag only if it cannot
# answer. Overridable for platforms without pkg-config.
LIBCHECK_CFLAGS ?= $(shell pkg-config --cflags check 2>/dev/null)
LIBCHECK_LIBS ?= $(shell pkg-config --libs check 2>/dev/null || echo -lcheck)
# Each suite's coverage, collected with lcov. COVERAGE=0 builds and runs
# the suites without it, for a run where nothing reads it, which saves
# instrumenting every compile and an lcov pass over the tree per suite.
COVERAGE ?= 1
ifeq ($(COVERAGE),1)
COVERAGE_CFLAGS = -ftest-coverage -fprofile-arcs
LCOV = lcov
GENHTML = genhtml
else
COVERAGE_CFLAGS =
LCOV = :
GENHTML = :
endif
TEST_UNIT_CFLAGS = $(CFLAGS) -Iinclude $(LDFLAGS) $(LIBCHECK_CFLAGS) -Werror -Wdeclaration-after-statement -fsanitize=address -fsanitize=undefined $(COVERAGE_CFLAGS) -ggdb
TEST_GENERIC_QUEUE = test/queues/test_generic_queue
TEST_GENERIC_QUEUE_SRC = test/queues/test_generic_queue.c queues/generic_queue.c
TEST_LINKED_LIST = test/lists/test_linked_list
TEST_LINKED_LIST_SRC = test/lists/test_linked_list.c lists/linked_list.c
TEST_STRL = test/compat/test_strl
TEST_STRL_SRC = test/compat/test_strl.c compat/compat_strl.c
TEST_MENU_STR = test/menu/test_menu_str
TEST_MENU_STR_SRC = test/menu/test_menu_str.c ../menu/menu_str.c \
string/stdstring.c encodings/encoding_utf.c compat/compat_strl.c
TEST_MEMPOOL = test/memory/test_mempool
TEST_MEMPOOL_SRC = test/memory/test_mempool.c memory/mempool.c
TEST_FILE_LIST = test/lists/test_file_list
TEST_FILE_LIST_SRC = test/lists/test_file_list.c lists/file_list.c \
compat/compat_strcasestr.c
TEST_STDSTRING = test/string/test_stdstring
TEST_STDSTRING_SRC = test/string/test_stdstring.c string/stdstring.c encodings/encoding_utf.c \
compat/compat_strl.c compat/compat_strldup.c
TEST_UTILS = test/utils/test_utils
TEST_UTILS_SRC = test/utils/test_utils.c utils/md5.c encodings/encoding_crc32.c \
features/features_cpu.c \
streams/file_stream.c vfs/vfs_implementation.c file/file_path.c \
string/rstrtod.c \
file/file_path_io.c \
compat/compat_strl.c time/rtime.c string/stdstring.c encodings/encoding_utf.c
TEST_HASH = test/hash/test_hash
TEST_HASH_SRC = test/hash/test_hash.c hash/lrc_hash.c \
streams/file_stream.c vfs/vfs_implementation.c file/file_path.c \
string/rstrtod.c \
file/file_path_io.c features/features_cpu.c \
compat/compat_strl.c time/rtime.c string/stdstring.c encodings/encoding_utf.c
# net_krb5.c is the Kerberos client; its enctype vectors are in the
# crypto suite, so the socket layer it talks to the KDC with comes too.
TEST_CRYPTO_LRC_SRC = crypto/crypto.c crypto/kdf.c crypto/pk.c crypto/x509.c utils/md5.c \
net/net_krb5.c net/net_socket.c net/net_compat.c
# Known-answer tests for every primitive (FIPS 197, RFC 4493, the GCM
# spec vectors, RFC 8439, RFC 4231, RFC 5869, PBKDF2, FIPS 180-4), the
# DRBG and the platform entropy source, and the public-key side (bignum,
# RSA PKCS#1 v1.5 sign and verify, P-256 ECDH / ECDSA, B-233 against
# RFC 6979) against reference vectors.
TEST_CRYPTO = test/crypto/test_crypto
TEST_CRYPTO_SRC = test/crypto/test_crypto.c $(TEST_CRYPTO_LRC_SRC) \
hash/lrc_hash.c encodings/encoding_base64.c \
streams/file_stream.c vfs/vfs_implementation.c file/file_path.c \
string/rstrtod.c \
file/file_path_io.c features/features_cpu.c \
compat/compat_strl.c time/rtime.c string/stdstring.c encodings/encoding_utf.c
TEST_KEYCHAIN = test/file/test_keychain
TEST_KEYCHAIN_SRC = test/file/test_keychain.c file/keychain.c \
$(TEST_CRYPTO_LRC_SRC) hash/lrc_hash.c encodings/encoding_base64.c \
streams/file_stream.c vfs/vfs_implementation.c file/file_path.c \
string/rstrtod.c \
file/file_path_io.c features/features_cpu.c \
compat/compat_strl.c compat/compat_strldup.c time/rtime.c \
string/stdstring.c encodings/encoding_utf.c
TEST_RWAV = test/formats/test_rwav
TEST_RWAV_SRC = test/formats/test_rwav.c formats/wav/rwav.c
TEST_RJPEG = test/formats/test_rjpeg
TEST_RJPEG_SRC = test/formats/test_rjpeg.c formats/jpeg/rjpeg.c \
streams/file_stream.c vfs/vfs_implementation.c file/file_path.c \
string/rstrtod.c \
file/file_path_io.c features/features_cpu.c \
compat/compat_strl.c time/rtime.c string/stdstring.c encodings/encoding_utf.c
# Not a libcheck suite: a plain main() that prints its own verdict and
# returns non-zero on failure.
TEST_RWEBM_AUDIO = test/formats/test_rwebm_audio
TEST_RWEBM_AUDIO_SRC = test/formats/test_rwebm_audio.c \
encodings/encoding_crc32.c features/features_cpu.c
TEST_RWEBM_AUDIO_LIBS = -lm
TEST_RPNG = test/formats/test_rpng
TEST_RPNG_SRC = test/formats/test_rpng.c formats/png/rpng.c \
streams/trans_stream.c streams/trans_stream_deflate.c \
encodings/encoding_deflate.c encodings/encoding_crc32.c \
features/features_cpu.c \
streams/trans_stream_pipe.c
TEST_RPNG_LIBS = -lz
# --- Windows A/W selection matrix -------------------------------------
#
# libretro-common picks between the ANSI and the wide Win32 entry points
# three different ways (compile-time wide, compile-time ANSI via
# LEGACY_WIN32, and per-call via HAVE_WIN9X_RUNTIME), and no
# Linux-hosted target builds two of them. That is how the ANSI branch
# rots: nothing compiles it, so nothing notices when it stops
# compiling, and the report comes from someone on a Windows 98 box.
#
# Cross-compiling covers "still builds". wine covers rather more than
# that: an ANSI build under wine really does call CreateFileA,
# FindFirstFileA and _stat64 rather than their wide twins, so the
# branch is executed, not merely parsed. What wine cannot do is make
# the probe say ANSI - it implements the W entry points, so a
# HAVE_WIN9X_RUNTIME build correctly chooses wide there. Only real 9x
# exercises win32_needs_local_encoding() returning 1.
#
# Both tools are optional. Absent either one, the affected steps say
# so and pass; a contributor without a cross-compiler is not blocked.
WIN32_CC ?= x86_64-w64-mingw32-gcc
WIN32_CC_X86 ?= i686-w64-mingw32-gcc
WINE ?= wine
# Every file that selects between A and W.
WIN32_AW_SRC = compat/fopen_utf8.c dynamic/dylib.c file/file_path.c \
vfs/vfs_implementation.c
# What a runnable test needs linked in besides the file under test.
WIN32_AW_TEST = samples/file/vfs/vfs_seek_contract_test.c
WIN32_AW_TEST_SRC = compat/fopen_utf8.c compat/compat_strl.c \
encodings/encoding_utf.c file/file_path.c \
file/file_path_io.c streams/file_stream.c \
string/rstrtod.c \
time/rtime.c vfs/vfs_implementation.c
win32-configs:
@fails=0; \
for cc in $(WIN32_CC) $(WIN32_CC_X86); do \
if ! command -v $$cc >/dev/null 2>&1; then \
echo "skip: $$cc not installed"; continue; \
fi; \
for cfg in "" "-DLEGACY_WIN32" "-DHAVE_WIN9X_RUNTIME"; do \
for src in $(WIN32_AW_SRC); do \
if ! $$cc -c -Iinclude -Wall -Werror $$cfg \
-DLEGACY_WIN32_NO_MIGRATION_NOTE \
-o /dev/null $$src 2>/tmp/lrc_aw_err.$$$$; then \
echo "FAIL: $$cc [$${cfg:-default}] $$src"; \
cat /tmp/lrc_aw_err.$$$$; fails=`expr $$fails + 1`; \
fi; \
rm -f /tmp/lrc_aw_err.$$$$; \
done; \
echo "ok: $$cc [$${cfg:-default}] builds"; \
done; \
done; \
wine_ok=0; \
if command -v $(WIN32_CC) >/dev/null 2>&1 \
&& command -v $(WINE) >/dev/null 2>&1; then \
printf 'int main(void){return 0;}\n' > /tmp/lrc_aw_probe.c; \
if $(WIN32_CC) -o /tmp/lrc_aw_probe.exe /tmp/lrc_aw_probe.c 2>/dev/null \
&& (cd /tmp && WINEDEBUG=-all $(WINE) /tmp/lrc_aw_probe.exe \
>/dev/null 2>/tmp/lrc_aw_probe.log); then \
wine_ok=1; \
else \
echo "skip: wine is installed but cannot run a Windows binary here"; \
echo " (configurations were built; none were executed)"; \
sed 's/^/ /' /tmp/lrc_aw_probe.log 2>/dev/null | head -5; \
fi; \
rm -f /tmp/lrc_aw_probe.c /tmp/lrc_aw_probe.exe /tmp/lrc_aw_probe.log; \
fi; \
if [ $$wine_ok -eq 1 ]; then \
for cfg in "" "-DLEGACY_WIN32" "-DHAVE_WIN9X_RUNTIME"; do \
if ! $(WIN32_CC) -O2 -Iinclude $$cfg \
-DLEGACY_WIN32_NO_MIGRATION_NOTE \
-o /tmp/lrc_aw_test.exe \
$(WIN32_AW_TEST) $(WIN32_AW_TEST_SRC) 2>/dev/null; then \
echo "FAIL: [$${cfg:-default}] test would not build"; \
fails=`expr $$fails + 1`; continue; \
fi; \
if (cd /tmp && WINEDEBUG=-all $(WINE) /tmp/lrc_aw_test.exe \
>/tmp/lrc_aw_out.txt 2>/tmp/lrc_aw_err.txt); then \
echo "ok: [$${cfg:-default}] runs under wine"; \
else \
echo "FAIL: [$${cfg:-default}] failed under wine"; \
cat /tmp/lrc_aw_out.txt; \
sed 's/^/ /' /tmp/lrc_aw_err.txt | head -10; \
fails=`expr $$fails + 1`; \
fi; \
rm -f /tmp/lrc_aw_test.exe /tmp/lrc_aw_out.txt /tmp/lrc_aw_err.txt; \
done; \
elif ! command -v $(WINE) >/dev/null 2>&1; then \
echo "skip: wine not installed - configurations built, not run"; \
fi; \
if [ $$fails -ne 0 ]; then echo "$$fails Windows configuration check(s) failed"; exit 1; fi; \
echo "Windows A/W configuration matrix: all checks passed"
# --- VFS sample regression tests --------------------------------------
#
# Native runs of the samples that pin file-size, seek and EOF behaviour,
# in both mapping configurations because the mapped and unmapped paths
# implement those boundaries separately.
vfs-samples:
$(MAKE) -C samples/file/vfs clean
$(MAKE) -C samples/file/vfs SANITIZER=address,undefined
cd samples/file/vfs && ./vfs_seek_contract_test && ./vfs_large_file_test
# filestream_rbuf_fault_test drives filestream_rbuf_fill()'s two
# failure arms through its own VFS, which leaves it lane-independent
# - running it a second time under MMAP=0 would be the same run.
cd samples/file/vfs && ./filestream_rbuf_fault_test
$(MAKE) -C samples/file/vfs clean
$(MAKE) -C samples/file/vfs MMAP=0 SANITIZER=address,undefined
cd samples/file/vfs && ./vfs_seek_contract_test
$(MAKE) -C samples/file/vfs clean
# --- concurrency sample regression tests ------------------------------
#
# retro_atomic.h, retro_spsc.c, retro_eventcount.c, retro_procbarrier.c
# and tpool.c have no unit test under test/, and in the standalone
# libretro-common tree nothing else compiles them at all -- a break in
# any of them surfaces only once RetroArch is built. Each sample's own
# Makefile owns its build; this runs them.
#
# Spelled out rather than looped because they do not share an
# interface: three carry a check target and two are run directly.
#
# Two passes. The second is not redundant: the ordering these rest on
# is supplied for free by x86 TSO, so a weakened or deleted barrier
# still produces right answers here and shows up only as a race.
#
# retro_eventcount's wakeup handshake is a pair of sequentially
# consistent operations on each side rather than a standalone fence,
# so ThreadSanitizer does model it. It does not model a standalone
# atomic_thread_fence, which GCC warns about, so anything that grows
# one again gets a clean thread run for its loads and stores and no
# statement at all about the fence between them.
CONCURRENCY_SAN ?= address,undefined
threads-samples:
# retro_atomic_test reports a failure when no reader lands inside a
# write, which cannot happen on one processor, so it is skipped
# there rather than failing a machine that has nothing wrong with
# it. Every other sample here runs anywhere.
@if [ "`getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2`" -gt 1 ]; then \
$(MAKE) -C samples/atomic/retro_atomic_test clean && \
$(MAKE) -C samples/atomic/retro_atomic_test SANITIZER=$(CONCURRENCY_SAN) && \
$(MAKE) -C samples/atomic/retro_atomic_test check && \
$(MAKE) -C samples/atomic/retro_atomic_test clean; \
else \
echo "skipping retro_atomic_test: its seqlock lane needs more than one processor"; \
fi
$(MAKE) -C samples/queues/retro_spsc_test clean
$(MAKE) -C samples/queues/retro_spsc_test SANITIZER=$(CONCURRENCY_SAN)
cd samples/queues/retro_spsc_test && ./retro_spsc_test
$(MAKE) -C samples/queues/retro_spsc_test clean
$(MAKE) -C samples/rthreads/tpool_wait_test clean
$(MAKE) -C samples/rthreads/tpool_wait_test SANITIZER=$(CONCURRENCY_SAN)
cd samples/rthreads/tpool_wait_test && ./tpool_wait_test
$(MAKE) -C samples/rthreads/tpool_wait_test clean
# again as the pool that backends without lock-free atomics get,
# which nothing else here builds. Not under TSan, which rightly
# objects to a volatile int standing in for an atomic.
@if [ "$(CONCURRENCY_SAN)" != "thread" ]; then \
CFLAGS="-DRETRO_ATOMIC_FORCE_VOLATILE -DRETRO_ATOMIC_SUPPRESS_WARNING" \
$(MAKE) -C samples/rthreads/tpool_wait_test SANITIZER=$(CONCURRENCY_SAN) || exit 1; \
(cd samples/rthreads/tpool_wait_test && ./tpool_wait_test) || exit 1; \
$(MAKE) -C samples/rthreads/tpool_wait_test clean; \
else \
echo "skipping the fallback pool under TSan"; \
fi
# runs its own second pass against the condition-variable backend,
# which is what macOS, the BSDs and the console ports get
$(MAKE) -C samples/rthreads/retro_eventcount_test clean
$(MAKE) -C samples/rthreads/retro_eventcount_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/rthreads/retro_eventcount_test clean
# forces each tier the platform has in turn, so membarrier, the page
# flip and the signal tier all run on one machine; the fence check
# is only load-bearing on SMP and the test says so
$(MAKE) -C samples/rthreads/retro_procbarrier_test clean
$(MAKE) -C samples/rthreads/retro_procbarrier_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/rthreads/retro_procbarrier_test clean
# the eventcount built on the barrier, in both its modes, under each
# barrier tier the platform has
$(MAKE) -C samples/rthreads/retro_asym_eventcount_test clean
$(MAKE) -C samples/rthreads/retro_asym_eventcount_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/rthreads/retro_asym_eventcount_test clean
# stack size and affinity on sthread: a 16 MB stack used to 12 MB,
# and a pin read back from the kernel
$(MAKE) -C samples/rthreads/sthread_ex_test clean
$(MAKE) -C samples/rthreads/sthread_ex_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/rthreads/sthread_ex_test clean
# shared memory mapped twice is one memory: written through one
# address, read through the other
$(MAKE) -C samples/memmap/memshm_test clean
$(MAKE) -C samples/memmap/memshm_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/memmap/memshm_test clean
# and the reservation those mappings go into: three mappings of one
# region aliasing, the middle one unmapped with live neighbours
# either side, and the freed slot mapped again -- the placeholder
# split and coalesce, which is where Windows is easy to get wrong
$(MAKE) -C samples/memmap/memshm_area_test clean
$(MAKE) -C samples/memmap/memshm_area_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/memmap/memshm_area_test clean
# fastjmp: a jump from three frames down, eight values held across
# the set intact at -O2, a hundred thousand round trips; the ASan
# fake stack cannot follow a longjmp that is not libc's
$(MAKE) -C samples/fastjmp/fastjmp_test clean
ASAN_OPTIONS=detect_stack_use_after_return=0 $(MAKE) -C samples/fastjmp/fastjmp_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/fastjmp/fastjmp_test clean
# rdds block decoders: BC1 endpoints and the four-colour
# interpolation, BC2 explicit alpha, BC3 interpolated alpha, BC7
# writing every pixel, and the row pitch honoured
$(MAKE) -C samples/formats/dds clean
$(MAKE) -C samples/formats/dds check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/formats/dds clean
# faulthandler: a reserved page committed from the handler and the
# store completing, and the three faults the filter must not claim.
# The sanitizers install their own SEGV handler; handle_segv=0
# leaves ours in place, which is the configuration a fastmem core
# runs in. TSan additionally reports the thread trampoline's free
# as signal-unsafe -- the workers fault inside their entry function
# by design -- and reports no data race, which is the property.
$(MAKE) -C samples/faulthandler/faulthandler_test clean
ASAN_OPTIONS=handle_segv=0 UBSAN_OPTIONS=handle_segv=0 $(MAKE) -C samples/faulthandler/faulthandler_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/faulthandler/faulthandler_test clean
# same, and the only place the queue and the eventcount are
# exercised against each other
$(MAKE) -C samples/queues/retro_waitable_spsc_test clean
$(MAKE) -C samples/queues/retro_waitable_spsc_test check SANITIZER=$(CONCURRENCY_SAN)
$(MAKE) -C samples/queues/retro_waitable_spsc_test clean
threads-samples-tsan:
$(MAKE) -f Makefile.test threads-samples CONCURRENCY_SAN=thread
.PHONY: win32-waits-check win32-configs vfs-samples threads-samples threads-samples-tsan \
unit-tests all
# The libcheck suites on their own: bounded work, and what CI's unit
# test step runs. The samples below are concurrency and I/O stress
# with no fixed runtime - retro_spsc_test in particular is at the mercy
# of how many processors it is given - so they are not folded in here.
# --- console libc surface check ------------------------------------------
#
# The console ports build rthreads against newlib or a vendor libc that
# lacks pieces of POSIX, and nothing on a Linux runner notices when a
# rthreads source reaches for one: PSP's newlib defines
# _SC_NPROCESSORS_ONLN but has no sysconf, and retro_procbarrier keyed on
# the macro, compiled clean here, and broke the PSP link 30 minutes into
# that lane. This compiles each rthreads source with a console's platform
# define and with the symbols that console lacks renamed to something
# that cannot link, then asks the object file whether it still references
# any of them. Seconds on the Linux job, and it fails before the console
# lanes start.
#
# The host's architecture macros stay defined: glibc's own headers need
# them, so an x86 runner cannot pretend to be MIPS. What that means is
# the page-flip tier must be gated on the OS it needs, never on x86
# alone -- which is the shape the fix took. Only PLATFORM defines are
# set; the real console headers are not
# available here, so this catches "reaches for a libc symbol the port
# lacks", not "uses a vendor header wrongly". The console lanes remain
# the authority on the latter. PS2 is not in the list for that reason:
# its define makes retro_atomic.h include <kernel.h>, which only the PS2
# SDK has, so it cannot be compiled here at all and its lane is the only
# check it gets.
CONSOLE_LIBC_SOURCES := rthreads/retro_procbarrier.c rthreads/retro_eventcount.c rthreads/retro_asym_eventcount.c
# __PS3__ alone is how rthreads.c selects the PS3 backend; __PSL1GHT__ is
# the SDK. The lane sets both, as Makefile.psl1ght does. The PS4 entry
# also sets __FreeBSD__: the Orbis clang defines it, since the PS4 is a
# FreeBSD fork, and that is exactly what made retro_procbarrier reach for
# FreeBSD 14.1's <sys/membarrier.h> on a console that has none. A lane
# that sets only ORBIS cannot see that, and did not.
CONSOLE_LIBC_PLATFORMS := PSP GEKKO VITA WIIU _3DS __SWITCH__ ORBIS DJGPP __PS3__
console-libc-check:
@printf '#define sysconf __forbid_sysconf\n#define mmap __forbid_mmap\n#define mprotect __forbid_mprotect\n#define mlock __forbid_mlock\n#define sigaction __forbid_sigaction\n#define opendir __forbid_opendir\n#define syscall __forbid_syscall\n' > /tmp/console_forbid.h
@# newlib's trap, reproduced: it defines the sysconf constants without
@# providing sysconf, so code that keys on the macro compiles and then
@# fails to link. Define the constant here so that branch is taken and
@# the forbidden symbol shows up in nm rather than being skipped over.
@printf '#ifndef _SC_NPROCESSORS_ONLN\n#define _SC_NPROCESSORS_ONLN 84\n#endif\n#ifndef _SC_PAGESIZE\n#define _SC_PAGESIZE 8\n#endif\nlong __forbid_sysconf(int);\n' >> /tmp/console_forbid.h
@# The PS4 toolchain defines __FreeBSD__. It cannot be set with -D on
@# a Linux runner -- glibc's own headers then look for FreeBSD's -- so
@# it is set after every libc header the rthreads sources use has been
@# pulled in. Their include guards make the sources' own includes
@# no-ops, and only a header not in this list, one the console lacks,
@# still fails. <sys/membarrier.h> is the one that broke the PS4.
@printf '#include <stdlib.h>\n#include <string.h>\n#include <stdint.h>\n#include <stddef.h>\n#include <errno.h>\n#include <unistd.h>\n#include <signal.h>\n#include <pthread.h>\n#include <sys/mman.h>\n#include <sys/types.h>\n#include <sys/param.h>\n#include <sys/time.h>\n#include <time.h>\n#include <fcntl.h>\n#include <dirent.h>\n#include <sys/syscall.h>\n#define __FreeBSD__ 1\n' > /tmp/console_bsd.h
@fail=0; \
for plat in $(CONSOLE_LIBC_PLATFORMS); do \
for src in $(CONSOLE_LIBC_SOURCES); do \
obj=/tmp/console_libc_$$(basename $$src .c)_$$plat.o; \
extra=""; \
[ "$$plat" = "__PS3__" ] && extra="-D__PSL1GHT__"; \
[ "$$plat" = "ORBIS" ] && extra="-D__ORBIS__ -D__PS4__ -include /tmp/console_bsd.h"; \
if ! $(CC) -std=c89 -pedantic -DHAVE_THREADS -D$$plat $$extra -U__linux__ -U__unix__ -U__unix \
-include /tmp/console_forbid.h -Iinclude -c -o $$obj $$src 2>/tmp/console_libc.err; then \
echo "console-libc-check: $$src does not compile with -D$$plat"; \
head -5 /tmp/console_libc.err; fail=1; continue; \
fi; \
if nm -u $$obj | grep -q __forbid_; then \
echo "console-libc-check: $$src under -D$$plat references a libc symbol that port lacks:"; \
nm -u $$obj | grep __forbid_ | sed 's/^/ /'; fail=1; \
fi; \
done; \
done; \
rm -f /tmp/console_libc_*.o /tmp/console_forbid.h /tmp/console_bsd.h /tmp/console_libc.err; \
if [ $$fail -ne 0 ]; then exit 1; fi; \
echo "console-libc-check: $(CONSOLE_LIBC_SOURCES) reference nothing the console ports lack"
# --- Darwin import floor check --------------------------------------------
#
# RetroArch's PowerPC build targets 10.4, and the MacOS-PPC-Cross lane
# audits every import of the finished binary against the 10.4u SDK's
# libraries. That is thorough and it is also the last step of a
# cross-build; retro_procbarrier's first Darwin tier reached for
# pthread_from_mach_thread_np, a 10.6 symbol, and the lane said so an
# hour after the push.
#
# This is the cheap version. It strips each source's comments, pulls out
# every function *called* -- an identifier followed by a parenthesis --
# in the Darwin-only paths, and checks each name appears in the 10.4u
# SDK's libSystem export strings. Comments are stripped first because a
# note explaining why a symbol is not used must not read as a use of it. No cross-compiler: a Mach-O export table
# keeps its names as plain strings, which is enough to answer "is this
# symbol in 10.4". The SDK tarball is fetched once and cached.
#
# It cannot compile the Darwin path -- the Mach headers are Apple's --
# so it answers only whether the imports exist there, not whether the
# code is right. The PPC lane remains the authority on the build.
DARWIN_FLOOR_SDK_URL := https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.4u.sdk.tar.xz
DARWIN_FLOOR_LIB := /tmp/MacOSX10.4u.sdk/usr/lib/libSystem.B.dylib
DARWIN_FLOOR_SOURCES := rthreads/retro_procbarrier.c
darwin-floor-check:
@if [ ! -f $(DARWIN_FLOOR_LIB) ]; then \
( cd /tmp && wget -q $(DARWIN_FLOOR_SDK_URL) && tar xJf MacOSX10.4u.sdk.tar.xz MacOSX10.4u.sdk/usr/lib/libSystem.B.dylib && rm -f MacOSX10.4u.sdk.tar.xz ) \
|| { echo "darwin-floor-check: could not fetch the 10.4u SDK; skipping"; exit 0; }; \
fi
@strings $(DARWIN_FLOOR_LIB) | grep '^_' | sort -u > /tmp/darwin_floor_exports.txt
@fail=0; \
for src in $(DARWIN_FLOOR_SOURCES); do \
$(CC) -fpreprocessed -dD -E -P $$src 2>/dev/null \
| sed -n '/#if defined(PB_DARWIN)/,/#endif/p' \
| grep -oE '\b(task_threads|thread_[a-z_]+|mach_[a-z_]+|vm_[a-z_]+|pthread_[a-z_]+|sysconf|mmap|mprotect|mlock|sigaction)\(' \
| tr -d '(' | sort -u > /tmp/darwin_floor_calls.txt; \
while read -r fn; do \
if ! grep -qx "_$$fn" /tmp/darwin_floor_exports.txt; then \
echo "darwin-floor-check: $$src calls $$fn, which is not in the 10.4u SDK's libSystem"; fail=1; \
fi; \
done < /tmp/darwin_floor_calls.txt; \
done; \
rm -f /tmp/darwin_floor_calls.txt; \
if [ $$fail -ne 0 ]; then exit 1; fi; \
echo "darwin-floor-check: every Darwin-path call in $(DARWIN_FLOOR_SOURCES) exists in the 10.4u SDK"
unit-tests:
# Build and execute tests in order, to avoid coverage file collision
$(CC) $(TEST_UNIT_CFLAGS) test/formats/rxml_oom_test.c -o test/formats/rxml_oom_test
test/formats/rxml_oom_test
$(CC) $(TEST_UNIT_CFLAGS) test/formats/rxml_write_test.c -o test/formats/rxml_write_test
test/formats/rxml_write_test
# string
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_STDSTRING_SRC) $(LIBCHECK_LIBS) -o $(TEST_STDSTRING)
$(TEST_STDSTRING)
$(LCOV) -c -d . -o `dirname $(TEST_STDSTRING)`/coverage.info
# utils
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_UTILS_SRC) $(LIBCHECK_LIBS) -o $(TEST_UTILS)
$(TEST_UTILS)
$(LCOV) -c -d . -o `dirname $(TEST_UTILS)`/coverage.info
# utils
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_HASH_SRC) $(LIBCHECK_LIBS) -o $(TEST_HASH)
$(TEST_HASH)
$(LCOV) -c -d . -o `dirname $(TEST_HASH)`/coverage.info
# crypto
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_CRYPTO_SRC) $(LIBCHECK_LIBS) -o $(TEST_CRYPTO)
$(TEST_CRYPTO)
$(LCOV) -c -d . -o `dirname $(TEST_CRYPTO)`/coverage.info
# keychain
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_KEYCHAIN_SRC) $(LIBCHECK_LIBS) -o $(TEST_KEYCHAIN)
$(TEST_KEYCHAIN)
$(LCOV) -c -d . -o `dirname $(TEST_KEYCHAIN)`/coverage.info
# list
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_LINKED_LIST_SRC) $(LIBCHECK_LIBS) -o $(TEST_LINKED_LIST)
$(TEST_LINKED_LIST)
$(LCOV) -c -d . -o `dirname $(TEST_LINKED_LIST)`/coverage.info
# file list
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_FILE_LIST_SRC) $(LIBCHECK_LIBS) -o $(TEST_FILE_LIST)
$(TEST_FILE_LIST)
$(LCOV) -c -d . -o `dirname $(TEST_FILE_LIST)`/file_list_coverage.info
# strl
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_STRL_SRC) $(LIBCHECK_LIBS) -o $(TEST_STRL)
$(TEST_STRL)
$(LCOV) -c -d . -o `dirname $(TEST_STRL)`/coverage.info
# menu_str
$(CC) $(TEST_UNIT_CFLAGS) -I.. $(TEST_MENU_STR_SRC) $(LIBCHECK_LIBS) -o $(TEST_MENU_STR)
$(TEST_MENU_STR)
$(LCOV) -c -d . -o `dirname $(TEST_MENU_STR)`/coverage.info
# mempool
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_MEMPOOL_SRC) $(LIBCHECK_LIBS) -o $(TEST_MEMPOOL)
$(TEST_MEMPOOL)
$(LCOV) -c -d . -o `dirname $(TEST_MEMPOOL)`/coverage.info
# queue
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_GENERIC_QUEUE_SRC) $(LIBCHECK_LIBS) -o $(TEST_GENERIC_QUEUE)
$(TEST_GENERIC_QUEUE)
$(LCOV) -c -d . -o `dirname $(TEST_GENERIC_QUEUE)`/coverage.info
# rpng
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_RPNG_SRC) $(TEST_RPNG_LIBS) $(LIBCHECK_LIBS) -o $(TEST_RPNG)
$(TEST_RPNG)
$(LCOV) -c -d . -o `dirname $(TEST_RPNG)`/coverage.info
# rwav
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_RWAV_SRC) $(LIBCHECK_LIBS) -o $(TEST_RWAV)
$(TEST_RWAV)
# rjpeg
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_RJPEG_SRC) $(LIBCHECK_LIBS) -o $(TEST_RJPEG)
$(TEST_RJPEG)
# rwebm audio
$(CC) $(TEST_UNIT_CFLAGS) $(TEST_RWEBM_AUDIO_SRC) $(TEST_RWEBM_AUDIO_LIBS) $(LIBCHECK_LIBS) -o $(TEST_RWEBM_AUDIO)
$(TEST_RWEBM_AUDIO)
# --- aarch64 cross run ---------------------------------------------
#
# The ARMv8 AES + PMULL path in crypto/crypto.c (and lrc_hash's SHA
# path) only executes on ARM silicon; an x86 runner would build it and
# never run it. With an aarch64 cross gcc and qemu-user on PATH the
# crypto suite runs under emulation in two shapes: baseline armv8-a
# (runtime dispatch on the hwcap) and armv8-a+crypto (the intrinsics
# used unconditionally). libcheck is not installed for the target, so
# the suite is built against test/check_shim.h. Both tools are
# optional: absent, this says so and passes.
AARCH64_CC ?= aarch64-linux-gnu-gcc
QEMU_AARCH64 ?= qemu-aarch64
crypto-aarch64-check:
@if ! command -v $(AARCH64_CC) >/dev/null 2>&1; then echo "skip: $(AARCH64_CC) not installed"; exit 0; fi; \
if ! command -v $(QEMU_AARCH64) >/dev/null 2>&1; then echo "skip: $(QEMU_AARCH64) not installed"; exit 0; fi; \
for arch in "-march=armv8-a" "-march=armv8-a+crypto"; do \
$(AARCH64_CC) -static -O2 $$arch -DCHECK_SHIM -Iinclude -Wall \
$(TEST_CRYPTO_SRC) -o test/crypto/test_crypto_aarch64 || exit 1; \
$(QEMU_AARCH64) test/crypto/test_crypto_aarch64 || exit 1; \
echo "ok: crypto suite under qemu-aarch64 [$$arch]"; \
done
# A 32-bit, strict-alignment target: size_t is 32 bits and a shift by
# the word width is not the zero it silently is elsewhere (the AES-CCM
# length check failed here and nowhere else), and a misaligned load
# traps rather than costs a cycle. MIPS under qemu is the one such
# target a Linux host can run; it stands in for the 32-bit ARM and x86
# builds as well.
MIPSEL_CC ?= mipsel-linux-gnu-gcc
QEMU_MIPSEL ?= qemu-mipsel
# The crypto library first used from eight threads at once, under
# TSan: a table built on first use or a cached CPU-feature check is a
# reported race here on any runner, where a network test sees it only
# when two connections happen to start together on two cores. Then the
# x509 trust store, walked while it is replaced, the TLS session cache,
# read while it is rewritten, and the curve constants, first used from
# several threads, under TSan and ASan.
crypto-tsan-check:
$(CC) -O1 -g -fsanitize=thread -Iinclude test/crypto/crypto_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) -lpthread -lm \
-o test/crypto/crypto_threads_test
TSAN_OPTIONS="halt_on_error=1 exitcode=66" test/crypto/crypto_threads_test
rm -f test/crypto/crypto_threads_test
$(CC) -O1 -g -fsanitize=thread -DHAVE_THREADS -Iinclude test/crypto/x509_store_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/crypto/x509_store_threads_test
TSAN_OPTIONS="halt_on_error=1 exitcode=66" test/crypto/x509_store_threads_test
$(CC) -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all -DHAVE_THREADS -Iinclude \
test/crypto/x509_store_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/crypto/x509_store_threads_test
test/crypto/x509_store_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DX509_TEST_HOLD_LANE -Iinclude \
test/crypto/x509_store_threads_test.c \
$(filter-out test/crypto/test_crypto.c crypto/x509.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c \
-lpthread -lm -o test/crypto/x509_store_threads_test
test/crypto/x509_store_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DX509_TEST_HOLD_LANE -DX509_STORE_TEST_FLAG -Iinclude \
test/crypto/x509_store_threads_test.c \
$(filter-out test/crypto/test_crypto.c crypto/x509.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c \
-lpthread -lm -o test/crypto/x509_store_threads_test
test/crypto/x509_store_threads_test
rm -f test/crypto/x509_store_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -fsanitize=thread -DHAVE_THREADS -Iinclude test/net/tls_cache_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/net/tls_cache_threads_test
TSAN_OPTIONS="halt_on_error=1 exitcode=66" test/net/tls_cache_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -fsanitize=address,undefined -fno-sanitize-recover=all -DHAVE_THREADS \
-Iinclude test/net/tls_cache_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/net/tls_cache_threads_test
test/net/tls_cache_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DTLS_TEST_HOLD_LANE -Iinclude test/net/tls_cache_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/net/tls_cache_threads_test
test/net/tls_cache_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DTLS_TEST_HOLD_LANE -DTLS_CACHE_TEST_FLAG -Iinclude \
test/net/tls_cache_threads_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/net/tls_cache_threads_test
test/net/tls_cache_threads_test
rm -f test/net/tls_cache_threads_test
$(CC) -O1 -g -D_GNU_SOURCE -fsanitize=thread -DHAVE_THREADS -Iinclude test/crypto/ec_first_use_test.c \
$(filter-out test/crypto/test_crypto.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c -lpthread -lm \
-o test/crypto/ec_first_use_test
TSAN_OPTIONS="halt_on_error=1 exitcode=66" test/crypto/ec_first_use_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DEC_TEST_HOLD_LANE -Iinclude test/crypto/ec_first_use_test.c \
$(filter-out test/crypto/test_crypto.c crypto/pk.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c \
-lpthread -lm -o test/crypto/ec_first_use_test
test/crypto/ec_first_use_test
$(CC) -O1 -g -D_GNU_SOURCE -DHAVE_THREADS -DEC_TEST_HOLD_LANE -DEC_TEST_WAIT -Iinclude \
test/crypto/ec_first_use_test.c \
$(filter-out test/crypto/test_crypto.c crypto/pk.c,$(TEST_CRYPTO_SRC)) rthreads/rthreads.c \
-lpthread -lm -o test/crypto/ec_first_use_test
test/crypto/ec_first_use_test
rm -f test/crypto/ec_first_use_test
crypto-mips-check:
@if ! command -v $(MIPSEL_CC) >/dev/null 2>&1; then echo "skip: $(MIPSEL_CC) not installed"; exit 0; fi; \
if ! command -v $(QEMU_MIPSEL) >/dev/null 2>&1; then echo "skip: $(QEMU_MIPSEL) not installed"; exit 0; fi; \
$(MIPSEL_CC) -static -O2 -march=mips32r2 -DCHECK_SHIM -Iinclude -Wall \
$(TEST_CRYPTO_SRC) -o test/crypto/test_crypto_mipsel || exit 1; \
$(QEMU_MIPSEL) test/crypto/test_crypto_mipsel || exit 1; \
echo "ok: crypto suite under qemu-mipsel (32-bit, strict alignment)"
# 32-bit ARM in the two shapes the consoles take: ARMv7-A with NEON
# (the Vita, 32-bit Android: the NEON ChaCha20) and ARMv6K with VFP only
# (the 3DS: every portable path - software AES, the 32-bit X25519).
ARMHF_CC ?= arm-linux-gnueabihf-gcc
QEMU_ARM ?= qemu-arm
crypto-arm-check:
@if ! command -v $(ARMHF_CC) >/dev/null 2>&1; then echo "skip: $(ARMHF_CC) not installed"; exit 0; fi; \
if ! command -v $(QEMU_ARM) >/dev/null 2>&1; then echo "skip: $(QEMU_ARM) not installed"; exit 0; fi; \
for shape in "armv7-a+neon:-march=armv7-a -mfpu=neon -mfloat-abi=hard" \
"armv6k+vfp:-march=armv6k -mfpu=vfp -mfloat-abi=hard -marm"; do \
name=$${shape%%:*}; flags=$${shape#*:}; \
$(ARMHF_CC) -static -O2 $$flags -DCHECK_SHIM -Iinclude -Wall \
$(TEST_CRYPTO_SRC) -o test/crypto/test_crypto_arm || exit 1; \
$(QEMU_ARM) test/crypto/test_crypto_arm || exit 1; \
echo "ok: crypto suite under qemu-arm [$$name]"; \
done
# The Windows builds actually run: the crypto and keychain suites as
# MinGW binaries under Wine (RtlGenRandom, the MachineGuid identity, the
# AES-NI dispatch through the Win32 cpu features), then the three network
# matrices driving the MinGW tools against the local servers (Winsock,
# the Win32 thread backend). Skips when MinGW or Wine is not installed.
MINGW_CC ?= x86_64-w64-mingw32-gcc
WINE ?= wine
# Wine makes a prefix that is not there, but not under a directory that
# belongs to someone else: with WINEPREFIX=/tmp/wineprefix, as CI sets
# it, the first tool stops at "wine: '/tmp' is not owned by you, refusing
# to create a configuration directory there". A directory that exists
# and is ours it takes, so it is made before the first tool runs.
WINE_PREFIX_DIR = if [ -n "$${WINEPREFIX:-}" ]; then mkdir -p "$$WINEPREFIX" || exit 1; fi
win32-wine-check:
@if ! command -v $(MINGW_CC) >/dev/null 2>&1; then echo "skip: $(MINGW_CC) not installed"; exit 0; fi; \
if ! command -v $(WINE) >/dev/null 2>&1; then echo "skip: $(WINE) not installed"; exit 0; fi; \
export WINEDEBUG=-all; \
$(WINE_PREFIX_DIR); \
$(MINGW_CC) -static -O2 -DCHECK_SHIM -Iinclude -Wall $(TEST_CRYPTO_SRC) compat/fopen_utf8.c \
-lws2_32 -liphlpapi -o test/crypto/test_crypto_win32.exe || exit 1; \
$(WINE) test/crypto/test_crypto_win32.exe || exit 1; \
echo "ok: crypto suite as a Windows binary under Wine"; \
$(MINGW_CC) -static -O2 -DCHECK_SHIM -Iinclude -Wall $(TEST_KEYCHAIN_SRC) compat/fopen_utf8.c \
-lws2_32 -liphlpapi -ladvapi32 -o test/file/test_keychain_win32.exe || exit 1; \
$(WINE) test/file/test_keychain_win32.exe || exit 1; \
echo "ok: keychain suite as a Windows binary under Wine"; \
$(MINGW_CC) -static -O2 -Iinclude -Wall test/formats/rxml_write_test.c \
-o test/formats/rxml_write_test_win32.exe || exit 1; \
$(WINE) test/formats/rxml_write_test_win32.exe || exit 1; \
echo "ok: rxml writer as a Windows binary under Wine"; \
rm -f test/crypto/test_crypto_win32.exe test/file/test_keychain_win32.exe \
test/formats/rxml_write_test_win32.exe
# The Windows wait paths under Wine, which no Linux build takes: the
# eventcount on each of its sleep tiers, then the eventcount's condition
# variable tier, the asymmetric eventcount and the thread pool on each of
# the condition variable's tiers - every one with bounded waits on the
# high resolution timer and with the kernel timeout alone. Skips when
# MinGW or Wine is not installed.
WIN32_WAITS_SRC = rthreads/rthreads.c features/features_cpu.c time/rtime.c
win32-waits-check:
@if ! command -v $(MINGW_CC) >/dev/null 2>&1; then echo "skip: $(MINGW_CC) not installed"; exit 0; fi; \
if ! command -v $(WINE) >/dev/null 2>&1; then echo "skip: $(WINE) not installed"; exit 0; fi; \
export WINEDEBUG=-all; \
$(WINE_PREFIX_DIR); \
$(MINGW_CC) -static -O1 -DHAVE_THREADS -Iinclude -Wall \
samples/rthreads/retro_eventcount_test/retro_eventcount_test.c \
rthreads/retro_eventcount.c $(WIN32_WAITS_SRC) \
-o /tmp/lrc_ec_win32.exe || exit 1; \
$(MINGW_CC) -static -O1 -DHAVE_THREADS -Iinclude -Wall \
samples/rthreads/retro_eventcount_test/win32_spin_test.c \
$(WIN32_WAITS_SRC) -o /tmp/lrc_spin_win32.exe || exit 1; \
$(MINGW_CC) -static -O1 -DHAVE_THREADS -Iinclude -Wall \
samples/rthreads/retro_asym_eventcount_test/retro_asym_eventcount_test.c \
rthreads/retro_asym_eventcount.c rthreads/retro_procbarrier.c \
rthreads/retro_eventcount.c $(WIN32_WAITS_SRC) \
-o /tmp/lrc_asym_win32.exe || exit 1; \
$(MINGW_CC) -static -O1 -DHAVE_THREADS -Iinclude -Wall \
samples/rthreads/tpool_wait_test/tpool_wait_test.c \
rthreads/tpool.c rthreads/retro_eventcount.c $(WIN32_WAITS_SRC) \
-o /tmp/lrc_tpool_win32.exe || exit 1; \
for h in 1 0; do \
for t in alert keyed event none; do \
RETRO_EVENTCOUNT_HIRES=$$h RETRO_EVENTCOUNT_WIN32=$$t \
$(WINE) /tmp/lrc_spin_win32.exe >/tmp/lrc_waits.log 2>&1 \
|| { echo "FAIL: eventcount spin, tier $$t, hires $$h"; cat /tmp/lrc_waits.log; exit 1; }; \
RETRO_EVENTCOUNT_HIRES=$$h RETRO_EVENTCOUNT_WIN32=$$t \
$(WINE) /tmp/lrc_ec_win32.exe >/tmp/lrc_waits.log 2>&1 \
|| { echo "FAIL: eventcount, tier $$t, hires $$h"; cat /tmp/lrc_waits.log; exit 1; }; \
done; \
for t in alert keyed event; do \
for exe in lrc_ec_win32 lrc_asym_win32 lrc_tpool_win32; do \
RTHREADS_SCOND_HIRES=$$h RTHREADS_SCOND=$$t RETRO_EVENTCOUNT_WIN32=none \
$(WINE) /tmp/$$exe.exe >/tmp/lrc_waits.log 2>&1 \
|| { echo "FAIL: $$exe, scond tier $$t, hires $$h"; cat /tmp/lrc_waits.log; exit 1; }; \
done; \
done; \
echo "ok: Windows wait tiers under Wine, hires $$h"; \
done; \
rm -f /tmp/lrc_ec_win32.exe /tmp/lrc_spin_win32.exe /tmp/lrc_asym_win32.exe /tmp/lrc_tpool_win32.exe /tmp/lrc_waits.log
all: unit-tests console-libc-check darwin-floor-check crypto-aarch64-check crypto-arm-check crypto-mips-check win32-wine-check win32-waits-check
# vfs samples: file size, seek and EOF boundaries, mapped and not
$(MAKE) -f Makefile.test vfs-samples
# concurrency samples: nothing else here compiles retro_spsc.c,
# retro_eventcount.c or tpool.c
$(MAKE) -f Makefile.test threads-samples
$(MAKE) -f Makefile.test threads-samples-tsan
# the three Windows A/W configurations, two of which nothing else builds
$(MAKE) -f Makefile.test win32-configs
$(LCOV) -o test/coverage.info \
-a test/utils/coverage.info \
-a test/crypto/coverage.info \
-a test/file/coverage.info \
-a test/string/coverage.info \
-a test/lists/coverage.info \
-a test/lists/file_list_coverage.info \
-a test/memory/coverage.info \
-a test/menu/coverage.info \
-a test/compat/coverage.info \
-a test/queues/coverage.info \
-a test/formats/coverage.info
$(GENHTML) -o test/coverage/ test/coverage.info
clean:
rm -f *.gcda *.gcno
rm -f $(TEST_STDSTRING) $(TEST_UTILS) $(TEST_HASH) \
$(TEST_CRYPTO) $(TEST_KEYCHAIN) test/crypto/test_crypto_aarch64 test/crypto/test_crypto_arm test/crypto/test_crypto_mipsel \
$(TEST_LINKED_LIST) $(TEST_FILE_LIST) $(TEST_MEMPOOL) \
$(TEST_MENU_STR) $(TEST_STRL) \
$(TEST_GENERIC_QUEUE) \
$(TEST_RPNG) $(TEST_RWAV) $(TEST_RJPEG) $(TEST_RWEBM_AUDIO)
rm -f test/*/*.gcda test/*/*.gcno test/*/coverage.info \
test/lists/file_list_coverage.info test/coverage.info
rm -rf test/coverage