tests/unix-tty: build on Darwin - #481
Open
agorangetek wants to merge 1 commit into
Open
agorangetek wants to merge 1 commit into
agorangetek wants to merge 1 commit into
Conversation
The suite that builds a library with -dylib and loads it back through fb_DylibLoad() could not be built on macOS at all, which is why nothing exercised that path on Apple silicon: - tester.cxx uses std::optional, which needs C++17. Apple clang does not default to it and the build stopped there; request it explicitly, which is a no-op for toolchains that already default to it. - check_tty_state_is_equal() and dump_tty_state() compare termios.c_line, a Linux extension; the BSDs, Darwin included, have no such field. Guard it. - the makefile hard-coded libexamplelib.so. Mach-O shared libraries are .dylib -- fbc names them that way on Darwin from freebasic#479 -- so pick the extension from the platform. With these, `make tests` builds on Darwin and the two dylibload testees pass on Apple silicon: testee-dylibload-only-examplelib 123 hello hello hello testee-dylibload-dylibfree-examplelib 123 hello hello hello The C++ tester itself still requires a real TTY to run, which is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Makes
tests/unix-ttybuild on macOS. That suite is where a library built with-dylibis loaded back throughfb_DylibLoad()and resolved withfb_DylibSymbol(), and it could not be built on Darwin at all — so nothing inthe tree exercised the dynamic-library path on Apple silicon.
Three things stopped it:
tester.cxxusesstd::optional, which needs C++17. Apple clang does notdefault to it, and compilation stopped there. The flag is now requested
explicitly, which is a no-op for toolchains that already default to it.
check_tty_state_is_equal()anddump_tty_state()comparetermios.c_line, which is a Linux extension — the BSDs, Darwin included,have no such field. It is now guarded.
libexamplelib.so. Mach-O shared libraries are.dylib, so the extension is now taken from the platform.Nothing is platform-specific in the other direction: on Linux
LIBEXTresolvesto
.soand thec_linecheck is still compiled in, so behaviour there isunchanged.
Relationship to #479
The
.dylibexpectation matches the output naming fixed in #479(
darwin: name shared libraries .dylib, and export their symbols), which iswhere
-dylibon Darwin was repaired. On Linux this part is a no-op, so the twocan land in either order without breaking Linux; on Darwin they belong together.
Verification
make testsbuilds on Darwin with these, and the two dylibload testees pass onApple silicon:
Hiding the built
libexamplelib.dylibmakes the first one fail withdylibload() failed, which is how I confirmed the loader is using the new namerather than falling back.
The C++
testeritself still requires a real TTY to run — unchanged, and why Iran the testees directly.