Move unit tests to sr/libutil/tests, use mk make rules

This commit is contained in:
Eelco Dolstra 2020-05-08 11:34:09 +02:00
parent 73d0b5d807
commit 7cc7cef950
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 15 additions and 8 deletions

View file

@ -3,6 +3,7 @@ makefiles = \
local.mk \
nix-rust/local.mk \
src/libutil/local.mk \
src/libutil/tests/local.mk \
src/libstore/local.mk \
src/libfetchers/local.mk \
src/libmain/local.mk \
@ -16,8 +17,7 @@ makefiles = \
misc/upstart/local.mk \
doc/manual/local.mk \
tests/local.mk \
tests/plugins/local.mk \
tests/unit-tests/local.mk
tests/plugins/local.mk
-include Makefile.config

View file

@ -0,0 +1,11 @@
programs += libutil-tests
libutil-tests_DIR := $(d)
libutil-tests_SOURCES := $(wildcard $(d)/*.cc)
libutil-tests_CXXFLAGS += -I src/libutil
libutil-tests_LIBS = libutil
libutil-tests_LDFLAGS := $$(pkg-config --libs gtest_main)

View file

@ -1,5 +1,5 @@
#include "../../src/libutil/util.hh"
#include "../../src/libutil/types.hh"
#include "util.hh"
#include "types.hh"
#include <gtest/gtest.h>

View file

@ -1,4 +0,0 @@
LIBS=-larchive -lcrypto -llzma -lbz2 -lz -lbrotlienc -lbrotlidec
unit-tests:
echo $(nix_LDFLAGS)
$(CXX) -o unit-test $(nix_CXXFLAGS) $(nix_LDFLAGS) $(LIBS) --std=c++17 $$(pkg-config --libs gtest_main) ./src/libutil/*.o tests/unit-tests/test-util.cc