fix Makefile rules for 'unittests'. Fix a crash in the Logger during unittest shutdown (and possibly also in JSON adapter's shutdown, too).

pull/2/head^2
roker 2021-06-01 21:53:13 +02:00
parent 5f53c63cdc
commit 3d7f977e37
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,7 @@ else
endif
ALL_SOURCE=$(filter-out parse_mail.cc unittest_%.cc, $(wildcard *.cc))
ALL_SOURCE=$(filter-out parse_mail.cc unittest_%.cc servertest.cc, $(wildcard *.cc))
MA_SOURCE=$(wildcard mini-adapter-*.cc)
LIB_SOURCE=$(filter-out $(MA_SOURCE) $(OMIT_NFC_SOURCE), $(ALL_SOURCE))
@ -124,7 +124,7 @@ $(TARGET): $(LIB_TARGET) $(MA_OBJECTS) $(SPIRIT_OBJECTS)
unittests: $(TEST_OBJECTS) $(LIB_TARGET) $(SPIRIT_OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) -lgtest -lgtest_main
parse_mail: parse_mail.o nfc.o $(LIB_TARGET) $(SPIRIT_OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)

View File

@ -110,9 +110,10 @@ namespace LoggerS // namespace containing all data for the Logger singleton. HA
{
~LogfileCloser()
{
Lock LCK(LoggerS::mut);
if(LoggerS::logfile)
{
LoggerS::log(Logger::Debug, "Shutdown.");
// LoggerS::log(Logger::Debug, "Shutdown.");
fputs("---<shutdown>---\n", LoggerS::logfile);
fclose(LoggerS::logfile);
LoggerS::logfile = nullptr;