Skip to content

Commit

Permalink
make: pass SANITIZEOPTS last (#138)
Browse files Browse the repository at this point in the history
As things are, user-passed flags override the sanitizer options
that are used for tests. The UBSan sanitizer has a minimal runtime
option, which can be used in production due to minimal overhead
while still printing reasonable messages. However, this minimal
runtime is not compatible with ASan, which is used for tests by
default, therefore it is necessary to disable this minimal
runtime for those files.

Unless SANITIZEOPTS are passed last, the potential minimal-runtime
option passed from flags used for the rest of the build may result
in failed test builds when SANITIZEOPTS contain ASan. Even if
passed last, one still gotta disable the minimal runtime inside
of SANITIZEOPTS, but that is something the user can control.
  • Loading branch information
q66 authored and davmac314 committed Jan 8, 2023
1 parent 376dac2 commit a2669ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ prepare-incdir:
cd includes; ln -f ../test-includes/*.h .

tests: $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o
$(CXX) $(SANITIZEOPTS) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS)
$(CXX) -o tests $(parent_objs) tests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS) $(SANITIZEOPTS)

proctests: $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o
$(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS)
$(CXX) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS) $(SANITIZEOPTS)

loadtests: $(parent_objs) loadtests.o test-dinit.o test-bpsys.o test-run-child-proc.o
$(CXX) $(SANITIZEOPTS) -o loadtests $(parent_objs) loadtests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS)
$(CXX) -o loadtests $(parent_objs) loadtests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS) $(SANITIZEOPTS)

envtests: $(parent_objs) envtests.o test-dinit.o test-bpsys.o test-run-child-proc.o
$(CXX) $(SANITIZEOPTS) -o envtests $(parent_objs) envtests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS)
$(CXX) -o envtests $(parent_objs) envtests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(CXXOPTS) $(LDFLAGS) $(SANITIZEOPTS)

$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../../dasynq/include -I../../build/includes -c $< -o $@
Expand Down
2 changes: 1 addition & 1 deletion src/tests/cptests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ prepare-incdir:
cd includes; ln -f ../../test-includes/baseproc-sys.h .

cptests: cptests.o $(parent_objs) $(parent_test_objs)
$(CXX) $(SANITIZEOPTS) -o cptests cptests.o $(parent_test_objects) $(parent_objs) $(CXXOPTS) $(LDFLAGS)
$(CXX) -o cptests cptests.o $(parent_test_objects) $(parent_objs) $(CXXOPTS) $(LDFLAGS) $(SANITIZEOPTS)

$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../../../dasynq/include -I../../../build/includes -c $< -o $@
Expand Down

0 comments on commit a2669ad

Please sign in to comment.