Add test that verifies all SDL3 symbols are available

This commit is contained in:
Anonymous Maarten
2025-09-25 23:45:10 +02:00
committed by Anonymous Maarten
parent 4718000dba
commit 9f721e8a9c
3 changed files with 1382 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ SDL_INCLUDE_DIR = SDL_ROOT / "include/SDL3"
SDL_DYNAPI_PROCS_H = SDL_ROOT / "src/dynapi/SDL_dynapi_procs.h"
SDL_DYNAPI_OVERRIDES_H = SDL_ROOT / "src/dynapi/SDL_dynapi_overrides.h"
SDL_DYNAPI_SYM = SDL_ROOT / "src/dynapi/SDL_dynapi.sym"
TESTSYMBOLS = SDL_ROOT / "test/testsymbols.c"
RE_EXTERN_C = re.compile(r'.*extern[ "]*C[ "].*')
RE_COMMENT_REMOVE_CONTENT = re.compile(r'\/\*.*\*/')
@@ -511,6 +512,20 @@ def add_dyn_api(proc: SdlProcedure) -> None:
for line in new_input:
f.write(line)
# File: test/testsymbols.c
#
# Add before "extra symbols go here" line
with TESTSYMBOLS.open() as f:
new_input = []
for line in f:
if "extra symbols go here" in line:
new_input.append(f" SDL_SYMBOL_ITEM({proc.name}),\n")
new_input.append(line)
with TESTSYMBOLS.open("w", newline="") as f:
for line in new_input:
f.write(line)
def main():
parser = argparse.ArgumentParser()

View File

@@ -319,6 +319,7 @@ add_sdl_test_executable(testdraw SOURCES testdraw.c)
add_sdl_test_executable(testdrawchessboard SOURCES testdrawchessboard.c)
add_sdl_test_executable(testdropfile MAIN_CALLBACKS SOURCES testdropfile.c)
add_sdl_test_executable(testerror NONINTERACTIVE DISABLE_THREADS_ARGS "--no-threads" SOURCES testerror.c)
add_sdl_test_executable(testsymbols NONINTERACTIVE NOTRACKMEM NONINTERACTIVE_ARGS 0 10 20 40 80 160 320 640 SOURCES testsymbols.c)
set(build_options_dependent_tests )

1366
test/testsymbols.c Normal file

File diff suppressed because it is too large Load Diff