@@ -46,6 +46,15 @@ run_tests = tests/run_tests.sh $(1) $(TESTS_C:.c=)
46
46
run_valgrind = $(VALGRIND ) --tool=$(1 ) $(SUPPRESSIONS_VALGRIND_ARG ) --xml=yes \
47
47
--xml-file=$(2 ) $(3 ) >/dev/null 2>&1
48
48
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
+
49
58
tests : $(TESTS_XML )
50
59
@$(call run_tests, -cvdh)
51
60
@@ -62,25 +71,25 @@ helchecks: $(TESTS_HELGRIND_XML)
62
71
@$(call run_tests,-h)
63
72
64
73
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 $<'
66
75
-@$(call run_valgrind,memcheck,"$@ ","./$< ")
67
76
68
77
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 $<'
70
79
-@$(call run_valgrind,helgrind,"$@ ","./$< ")
71
80
72
81
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 $<'
74
83
-@$(call run_valgrind,drd,"$@ ","./$< ")
75
84
76
85
tests/% .xml : tests/% .test
77
- @echo -e ' \033[0;33m Testing: \033[0m $<'
86
+ @echo -e ' \033[1;34m[ Testing ] \033[0m\t $<'
78
87
@CMOCKA_XML_FILE=" $@ " CMOCKA_MESSAGE_OUTPUT=XML " ./$<" > /dev/null 2>&1
79
88
80
89
tests/% .test : CPPFLAGS := -I. $(CPPFLAGS )
81
90
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
84
93
85
94
check_coverage :
86
95
@ ( if [[ " x$( WITH_COVERAGE) " == " xn" ]]; then \
0 commit comments