Skip to content

Commit 3a623e4

Browse files
committed
🔧 Prepare configure and Makefile
Now it's possible to run: ./configure --enable-integration-tests
1 parent 0790a23 commit 3a623e4

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ run_tests = tests/run_tests.sh $(1) $(TESTS_C:.c=)
4646
run_valgrind = $(VALGRIND) --tool=$(1) $(SUPPRESSIONS_VALGRIND_ARG) --xml=yes \
4747
--xml-file=$(2) $(3) >/dev/null 2>&1
4848

49+
setup-tests:
50+
docker network create --subnet=172.26.0.0/24 test
51+
docker run -d --net test --ip 172.26.0.2 --name zookeeper wurstmeister/zookeeper
52+
docker run -d --net test --ip 172.26.0.3 --name kafka -e KAFKA_ADVERTISED_HOST_NAME="172.26.0.3" -e KAFKA_ADVERTISED_PORT="9092" -e KAFKA_ZOOKEEPER_CONNECT="172.26.0.2:2181" -v /var/run/docker.sock:/var/run/docker.sock wurstmeister/kafka
53+
54+
teardown-tests:
55+
docker rm -f zookeeper kafka
56+
docker network rm test
57+
4958
tests: $(TESTS_XML)
5059
@$(call run_tests, -cvdh)
5160

@@ -62,25 +71,25 @@ helchecks: $(TESTS_HELGRIND_XML)
6271
@$(call run_tests,-h)
6372

6473
tests/%.mem.xml: tests/%.test
65-
@echo -e '\033[0;33m Checking memory:\033[0m $<'
74+
@echo -e '\033[1;34m[Checking memory ]\033[0m\t $<'
6675
-@$(call run_valgrind,memcheck,"$@","./$<")
6776

6877
tests/%.helgrind.xml: tests/%.test
69-
@echo -e '\033[0;33m Testing concurrency [HELGRIND]:\033[0m $<'
78+
@echo -e '\033[1;34m[Checking concurrency with HELGRIND]\033[0m\t $<'
7079
-@$(call run_valgrind,helgrind,"$@","./$<")
7180

7281
tests/%.drd.xml: tests/%.test
73-
@echo -e '\033[0;33m Testing concurrency [DRD]:\033[0m $<'
82+
@echo -e '\033[1;34m[Checking concurrency with DRD]\033[0m\t $<'
7483
-@$(call run_valgrind,drd,"$@","./$<")
7584

7685
tests/%.xml: tests/%.test
77-
@echo -e '\033[0;33m Testing:\033[0m $<'
86+
@echo -e '\033[1;34m[Testing ]\033[0m\t $<'
7887
@CMOCKA_XML_FILE="$@" CMOCKA_MESSAGE_OUTPUT=XML "./$<" >/dev/null 2>&1
7988

8089
tests/%.test: CPPFLAGS := -I. $(CPPFLAGS)
8190
tests/%.test: tests/%.o $(filter-out src/engine/n2kafka.o,$(OBJS))
82-
@echo -e '\033[0;33m Building: $@ \033[0m'
83-
@$(CC) $(CPPFLAGS) $(LDFLAGS) $< $(shell cat $(@:.test=.objdeps)) -o $@ $(LIBS) -lcmocka
91+
@echo -e '\033[1;32m[Building]\033[0m\t $@'
92+
@$(CC) $(CPPFLAGS) $(LDFLAGS) $< $(shell cat $(@:.test=.objdeps)) -o $@ $(LIBS) -lcmocka >/dev/null 2>&1
8493

8594
check_coverage:
8695
@( if [[ "x$(WITH_COVERAGE)" == "xn" ]]; then \

configure.n2kafka

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wmissing-declarations -Wdisabled-optimizati
2323
mkl_mkvar_append CPPFLAGS CPPFLAGS "-I. -I./src"
2424

2525
mkl_toggle_option "Feature" WITH_HTTP "--enable-http" "HTTP support using libmicrohttpd" "y"
26+
mkl_toggle_option "Feature" WITH_INTEGRATION_TESTS "--enable-integration-tests" "Run integration tests" "n"
2627
mkl_toggle_option "Debug" WITH_COVERAGE "--enable-coverage" "Coverage build" "n"
2728

2829
function checks_libmicrohttpd {
@@ -88,6 +89,10 @@ function checks {
8889
"#include <curl/curl.h>
8990
static int foo __attribute__((unused)) = CURLMOPT_MAX_TOTAL_CONNECTIONS;"
9091

92+
if [[ "x$WITH_INTEGRATION_TESTS" == "xy" ]]; then
93+
mkl_define_set "" "TESTS_KAFKA_HOST" "172.26.0.3"
94+
fi
95+
9196
if [[ "x$WITHOUT_OPTIMIZATION" != "xy" || "x$WITH_COVERAGE" != "xy" ]]; then
9297
mkl_mkvar_append CPPFLAGS CPPFLAGS "-DNDEBUG"
9398
fi

0 commit comments

Comments
 (0)