tests: stop SDL renaming the filesystem test entry point #948
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!948
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/948/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@theantipopau on GitHub · 2026-09-30 22:09 UTC · original
theantipopau:sdl-main-handled→main· +2 −0 · 1 files · 2 commits · closed without mergingSummary
tests/KernelFileSystemTests.cppdoes not build on Windows. This is a two-line fix.The test provides its own
main(), but it is the only test translation unit that includesSDL3/SDL_main.h. That header is SDL's "single-header library": unlessSDL_MAIN_HANDLEDisdefined, it
#definesmaintoSDL_mainand, on Windows, generates aWinMainshim.kernel_file_system_testsis built byadd_kyty_full_emulator_test, which linksSDL3::SDL3-staticbut notSDL3main, so the shim has nothing to bind to and the link fails:Defining
SDL_MAIN_HANDLEDbefore the SDL headers leaves the test's ownmain()alone. That iswhat the test has always meant; SDL's rename is only correct for the real emulator binary, which
goes through
SDL_main.No other test target includes
SDL_main.h, so this is the only affected file.Testing
Built
kernel_file_system_testson Windows with the net-enabled toolchain atb7a1fac8(upstream
main) plus this commit — links clean,BUILD_RC=0:Before the change the target fails at the link step with the error above.
Note
Running the binary on that same tree then exposes a separate pre-existing failure on upstream
main, in the network test:That is the
MSG_PEEK | MSG_WAITALLhandling inLibs::Network::Net::Recv, and it is alreadybeing fixed in #797. This PR is deliberately kept independent of #797 so it can be reviewed and
merged on its own.
@coderabbitai[bot] on GitHub · 2026-09-30 22:13 UTC · original · edited 2026-10-06 04:32 UTC
📝 Walkthrough
Walkthrough
The test file now defines
SDL_MAIN_HANDLEDand includes a comment that its ownmain()entry point must not be renamed toSDL_main.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: 🟡 Moderate · up to
92bd1The change should fix the Windows link error. However, the filesystem test may now abort at SDL initialization because SDL_SetMainReady() is never called. Add that call before merging.
Architecture Summary
Architecture risk: 🔵 Low · up to
92bd1The change affects 1 system.
Changed systems:
testsArchitecture concerns
No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
SDL_MAIN_HANDLEDdefinition and a comment documenting that the test provides its own entry point.🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -1,3 +1,5 @@// The test provides its own entry point, so SDL must not rename main() to SDL_main().#define SDL_MAIN_HANDLED@coderabbitai[bot] on GitHub · 2026-09-30 22:13 UTC · original · edited 2026-09-30 22:38 UTC
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5311
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 16196
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 20679
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 20550
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2110
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 1923
Call
SDL_SetMainReady()before SDL initialization.The bundled SDL3 revision uses the SDL 3.2+ startup contract. When
SDL_MAIN_HANDLEDis defined, callSDL_SetMainReady()beforeSDL_InitSubSystem(SDL_INIT_VIDEO). Otherwise, initialization can fail andCheckaborts the test.🐛 Suggested fix
@coderabbitai[bot] on GitHub · 2026-09-30 22:13 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
c982e38a-dc06-450f-b992-b8931ff78b45📥 Commits
Reviewing files that changed from the base of the PR and between
b7a1fac898and92bd15a009.📒 Files selected for processing (1)
tests/KernelFileSystemTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@ -1,3 +1,5 @@// The test provides its own entry point, so SDL must not rename main() to SDL_main().#define SDL_MAIN_HANDLED@theantipopau on GitHub · 2026-09-30 22:38 UTC · original
Thanks, but I don't think that applies to the platforms this target builds for.
SDL_InitSubSystem()only rejects a not-ready main when
SDL_MainIsReadyis false, andsrc/SDL.cseeds that fromSDL_MAIN_NEEDED:SDL_internal.hincludes<SDL3/SDL_main.h>, so that is decided when SDL itself is compiled.Walking the
#ifndef SDL_MAIN_HANDLEDchain inSDL_main.h,SDL_MAIN_NEEDEDis only defined forSDL_PLATFORM_GDK, iOS/tvOS, Android and Emscripten. Windows, Linux, macOS and the other desktoptargets take the
SDL_MAIN_AVAILABLEbranch only, soSDL_MainIsReadystarts out true andSDL_InitSubSystemsucceeds withoutSDL_SetMainReady(). The SDL header says as much: "This is100% optional, so if you don't want this to happen, you may define SDL_MAIN_HANDLED".
That is also what the run shows. The target builds and runs on Windows here:
Three consecutive clean runs, and
Check(SDL_InitSubSystem(SDL_INIT_VIDEO), ...)is the secondcheck in
main(), so a rejected init would have aborted immediately.Happy to add the call if you know of a desktop configuration where it matters — I would just
rather not put a no-op into a two-line fix. If it is easier to review as belt-and-braces I can
drop it in.
@ -1,3 +1,5 @@// The test provides its own entry point, so SDL must not rename main() to SDL_main().#define SDL_MAIN_HANDLED@coderabbitai[bot] on GitHub · 2026-09-30 22:38 UTC · original
@theantipopau, you are right. I incorrectly treatedSDL_MAIN_HANDLEDas requiringSDL_SetMainReady()on all platforms.SDL decides the initial
SDL_MainIsReadyvalue when SDL itself is compiled. For the desktop platforms this target supports,SDL_MAIN_NEEDEDis not defined, so readiness starts astrue. The missing call therefore does not cause the initialization failure I described.Thanks for the detailed explanation and Windows run results. I withdraw this finding. No additional call is needed for this fix.
✏️ Learnings added
✅ Review thread resolved.
You are interacting with an AI system.
Pull request closed