diff --git a/tests/unix-tty/makefile b/tests/unix-tty/makefile index eb3509840..70f45f130 100644 --- a/tests/unix-tty/makefile +++ b/tests/unix-tty/makefile @@ -2,7 +2,9 @@ FBC := fbc CXX := g++ FBFLAGS := -CXXFLAGS := -O2 -g +# tester.cxx uses std::optional, which needs C++17; Apple clang does not +# default to it, and this suite is where -dylib is exercised on Darwin. +CXXFLAGS := -O2 -g -std=c++17 LDFLAGS := ALLFBFLAGS := $(FBFLAGS) @@ -12,7 +14,15 @@ ALLLDFLAGS := $(LDFLAGS) TESTEE_SOURCES := $(sort $(wildcard testee-*.bas)) TESTEE_BINARIES := $(patsubst %.bas,%,$(TESTEE_SOURCES)) -ALL_BINARIES := tester $(TESTEE_BINARIES) libexamplelib.so examplebin +# Mach-O uses .dylib for shared libraries, ELF targets use .so +ifeq ($(shell uname -s),Darwin) +LIBEXT := .dylib +else +LIBEXT := .so +endif +LIBEXAMPLELIB := libexamplelib$(LIBEXT) + +ALL_BINARIES := tester $(TESTEE_BINARIES) $(LIBEXAMPLELIB) examplebin all: $(ALL_BINARIES) @@ -25,7 +35,7 @@ $(TESTEE_BINARIES): %: %.bas # #include dependency testee-dylibload-dylibfree-examplelib: testee-dylibload-only-examplelib.bas -libexamplelib.so: examplelib.bas +$(LIBEXAMPLELIB): examplelib.bas $(FBC) $(ALLFBFLAGS) $< -dylib examplebin: examplebin.bas diff --git a/tests/unix-tty/tester.cxx b/tests/unix-tty/tester.cxx index cde19040c..aac8056c8 100644 --- a/tests/unix-tty/tester.cxx +++ b/tests/unix-tty/tester.cxx @@ -57,7 +57,10 @@ std::string dump_tty_state(const struct termios &state) { s << " c_oflag=0x" << std::hex << state.c_oflag << '\n'; s << " c_cflag=0x" << std::hex << state.c_cflag << '\n'; s << " c_lflag=0x" << std::hex << state.c_lflag << '\n'; +#ifdef __linux__ + // c_line is a Linux extension; the BSDs, Darwin included, have no such field s << " c_line=0x" << std::hex << static_cast(state.c_line) << '\n'; +#endif for (size_t i = 0; i < NCCS; ++i) { s << " c_cc[" << std::dec << i << "]=0x" << std::hex << static_cast(state.c_cc[i]) << '\n'; } @@ -80,7 +83,9 @@ void check_tty_state_is_equal(const struct termios &a, const struct termios &b) CHECK(c_oflag); CHECK(c_cflag); CHECK(c_lflag); +#ifdef __linux__ CHECK(c_line); +#endif for (size_t i = 0; i < NCCS; ++i) { if (a.c_cc[i] != b.c_cc[i]) { std::ostringstream s;