mirror of
https://github.com/brazilofmux/tinymux
synced 2026-08-13 00:23:11 -04:00
Editing a header a tests/ harness compiles against rebuilt nothing, so the suite reported green against objects built from the previous version of the header. This is the failure mode that let #1949's negative control come back 59 passed with the #1930 defect present in alloc.h. -MMD -MP on every compile, -include of the generated .d files, and *.d in each clean rule. tests/libmux already got this in #1949; this is the remaining eight. The hand-written header prerequisite lists in color_ops, db and dbt stay. They are what makes the FIRST build correct, before any .d exists; what they cannot do is notice an #include nobody remembers to add, which is the drift -MMD removes. tests/hir takes the flags via CPPFLAGS rather than CXXFLAGS: that harness declares CXXFLAGS with ?=, so a caller overriding it would silently drop the dependency tracking -- the same shape as the bug being fixed. tests/slave and tests/stubslave compile nothing (both are shell drivers) and are unchanged. Verified per harness rather than by inspection: build, read a header out of the generated .d, touch it, require a rebuild -- 9 of 9 live. Then checked that the check itself has power by restoring master's tests/table/Makefile and running both in the same tree against the same header: master prints "Nothing to be done for 'all'", this branch recompiles and relinks. make test: 30 targets, 29 passed, 1 skipped, 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
33 lines
975 B
Makefile
33 lines
975 B
Makefile
# Makefile — unit tests for mux_table_* (#1667 Phase 3).
|
|
#
|
|
# Needs a built tree: make install from repo root (libmux.so in mux/lib).
|
|
|
|
CXX = g++
|
|
# -MMD -MP: emit header prerequisites next to each object (#1952). Without
|
|
# them the .o depends only on the .cpp, so editing a header this harness
|
|
# compiles against rebuilds nothing and the suite reports green against the
|
|
# previous header.
|
|
CXXFLAGS = -std=c++17 -g -O2 -Wall -Wextra -fPIC -MMD -MP
|
|
INCDIR = ../../mux/include
|
|
LIBDIR = ../../mux/lib
|
|
|
|
TARGET = test_table
|
|
|
|
all: $(TARGET)
|
|
|
|
test_table.o: test_table.cpp
|
|
$(CXX) $(CXXFLAGS) -DHAVE_CONFIG_H -I$(INCDIR) -c -o $@ $<
|
|
|
|
$(TARGET): test_table.o
|
|
$(CXX) $(CXXFLAGS) -o $@ $^ -L$(LIBDIR) -lmux -Wl,-rpath,$(LIBDIR)
|
|
|
|
test: $(TARGET)
|
|
LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH ./$(TARGET)
|
|
|
|
clean:
|
|
rm -f $(TARGET) test_table.o test_table.d
|
|
|
|
# Generated by -MMD; absent on the first build, hence the leading '-'.
|
|
-include $(wildcard *.d)
|
|
|
|
.PHONY: all test clean
|