Skip to content

Commit

Permalink
CMK-450: Make unit tests for Livestatus & Microcore possible
Browse files Browse the repository at this point in the history
For now, this contains just a simple test for a header-only function, but
the rest of the machinery is there when you need it.

Fun fact: This test immediately uncovered a (harmless) bug, which will be
fixed in an upcoming commit.

Change-Id: I65686642e660e1aa15255fba8bc5f7de8caaf923
  • Loading branch information
Sven Panne committed Aug 1, 2018
1 parent 7f456d5 commit 9882057
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ FILES_TO_FORMAT := $(wildcard $(addprefix agents/,*.cc *.c *.h)) \
$(wildcard $(addprefix livestatus/src/,*.cc *.h)) \
$(wildcard $(addprefix bin/,*.cc *.c *.h)) \
$(wildcard $(addprefix enterprise/core/src/,*.cc *.h)) \
$(wildcard $(addprefix enterprise/core/src/checkhelper/,*.cc *.h))
$(wildcard $(addprefix enterprise/core/src/checkhelper/,*.cc *.h)) \
$(wildcard $(addprefix enterprise/core/src/test/,*.cc *.h))

WERKS := $(wildcard .werks/[0-9]*)

Expand Down
4 changes: 4 additions & 0 deletions livestatus/iwyu-mappings/check_mk.imp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
{ include: ["<pcap/bpf.h>", private, "<pcap.h>", public ] },
{ include: ["<pcap/dlt.h>", private, "<pcap.h>", public ] },
{ include: ["<pcap/pcap.h>", private, "<pcap.h>", public ] },
{ include: ['@"gmock/.*"', private, '"gmock/gmock.h"', public ] },
{ include: ["@<gmock/.*>", private, "<gmock/gmock.h>", public ] },
{ include: ['@"gtest/.*"', private, '"gtest/gtest.h"', public ] },
{ include: ["@<gtest/.*>", private, "<gtest/gtest.h>", public ] },
{ symbol: ["int32_t", private, "<stdint.h>", public ] },
{ symbol: ["std::ofstream", private, "<fstream>", public ] },
{ symbol: ["std::ostringstream", private, "<sstream>", public ] },
Expand Down
5 changes: 5 additions & 0 deletions omd/Makefile.omd
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ check-python-modules:
# perl #########################################################################

PACKAGE_BOOST_DESTDIR := $(PACKAGE_BASE)/boost/destdir


# googletest ###################################################################

PACKAGE_GOOGLETEST_DESTDIR := $(PACKAGE_BASE)/googletest/destdir
2 changes: 2 additions & 0 deletions omd/packages/googletest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
destdir/
googletest-??????????/
33 changes: 33 additions & 0 deletions omd/packages/googletest/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
include ../../Makefile.omd

# tar file generated by cloning https://github.com/google/googletest and doing:
# ( VERSION=0048647619; git archive --prefix=googletest-$VERSION/ -o ~/git/check_mk/omd/packages/googletest/googletest-$VERSION.tar.gz $VERSION )

NAME := googletest
VERSION := 0048647619
DIR := $(NAME)-$(VERSION)

.PHONY: build install skel clean

# The rules below are not perfect, but good enough for now...
build: $(DIR)/Makefile
$(MAKE) -C $(DIR)
mkdir -p $(PACKAGE_GOOGLETEST_DESTDIR)/lib
# We do not ship the headers and libraries, we just need them at a known
# location for testing.
cp -au $(DIR)/googletest/include $(DIR)/googlemock/include $(PACKAGE_GOOGLETEST_DESTDIR)
cp -au $(DIR)/googletest/lib/.libs/lib*.a $(DIR)/googlemock/lib/.libs/lib*.a $(PACKAGE_GOOGLETEST_DESTDIR)/lib

$(DIR)/Makefile.in: $(DIR).tar.gz
tar xzf $(DIR).tar.gz
cd $(DIR) && autoreconf -i

$(DIR)/Makefile: $(DIR)/Makefile.in
cd $(DIR) && ./configure --disable-shared

install:

skel:

clean:
rm -rf $(DIR) $(PACKAGE_GOOGLETEST_DESTDIR)
1 change: 0 additions & 1 deletion omd/packages/googletest/README

This file was deleted.

0 comments on commit 9882057

Please sign in to comment.