Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tests/unix-tty/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tests/unix-tty/tester.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int>(state.c_line) << '\n';
#endif
for (size_t i = 0; i < NCCS; ++i) {
s << " c_cc[" << std::dec << i << "]=0x" << std::hex << static_cast<unsigned int>(state.c_cc[i]) << '\n';
}
Expand All @@ -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;
Expand Down