Skip to content

Commit 9f721e8

Browse files
committed
Add test that verifies all SDL3 symbols are available
1 parent 4718000 commit 9f721e8

File tree

3 files changed

+1382
-0
lines changed

3 files changed

+1382
-0
lines changed

src/dynapi/gendynapi.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
SDL_DYNAPI_PROCS_H = SDL_ROOT / "src/dynapi/SDL_dynapi_procs.h"
4646
SDL_DYNAPI_OVERRIDES_H = SDL_ROOT / "src/dynapi/SDL_dynapi_overrides.h"
4747
SDL_DYNAPI_SYM = SDL_ROOT / "src/dynapi/SDL_dynapi.sym"
48+
TESTSYMBOLS = SDL_ROOT / "test/testsymbols.c"
4849

4950
RE_EXTERN_C = re.compile(r'.*extern[ "]*C[ "].*')
5051
RE_COMMENT_REMOVE_CONTENT = re.compile(r'\/\*.*\*/')
@@ -511,6 +512,20 @@ def add_dyn_api(proc: SdlProcedure) -> None:
511512
for line in new_input:
512513
f.write(line)
513514

515+
# File: test/testsymbols.c
516+
#
517+
# Add before "extra symbols go here" line
518+
with TESTSYMBOLS.open() as f:
519+
new_input = []
520+
for line in f:
521+
if "extra symbols go here" in line:
522+
new_input.append(f" SDL_SYMBOL_ITEM({proc.name}),\n")
523+
new_input.append(line)
524+
525+
with TESTSYMBOLS.open("w", newline="") as f:
526+
for line in new_input:
527+
f.write(line)
528+
514529

515530
def main():
516531
parser = argparse.ArgumentParser()

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ add_sdl_test_executable(testdraw SOURCES testdraw.c)
319319
add_sdl_test_executable(testdrawchessboard SOURCES testdrawchessboard.c)
320320
add_sdl_test_executable(testdropfile MAIN_CALLBACKS SOURCES testdropfile.c)
321321
add_sdl_test_executable(testerror NONINTERACTIVE DISABLE_THREADS_ARGS "--no-threads" SOURCES testerror.c)
322+
add_sdl_test_executable(testsymbols NONINTERACTIVE NOTRACKMEM NONINTERACTIVE_ARGS 0 10 20 40 80 160 320 640 SOURCES testsymbols.c)
322323

323324
set(build_options_dependent_tests )
324325

0 commit comments

Comments
 (0)