1 # Copyright (C) 2014 Trend Micro Inc.
4 # This program is a free software; you can redistribute it
5 # and/or modify it under the terms of the GNU General Public
6 # License (version 2) as published by the FSF - Free Software
10 include ${PT}Config.Make
12 CHECK_LINK = -lcheck -lm -pthread -lrt
13 CFLAGS_TEST = -Waggregate-return -Wall -Wbad-function-cast -Wc++-compat -Wcast-align \
14 -Wcast-qual -Wconversion -Wextra -Wfloat-equal -Wformat=2 -Winit-self -Winline \
15 -Winvalid-pch -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs \
16 -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls \
17 -Wshadow -Wstack-protector -Wstrict-aliasing -Wstrict-overflow=4 \
18 -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wsync-nand -Wundef -Wunused \
23 run_tests: build_tests
28 generate_coverage: build_tests
29 lcov --base-directory . --directory . --zerocounters --rc lcov_branch_coverage=1 --quiet
30 @echo "Running tests\n"
36 @echo "\nTests finished."
37 lcov --base-directory . --directory . --capture --quiet --rc lcov_branch_coverage=1 --output-file ossec.test
38 rm -rf coverage-report/
39 genhtml --branch-coverage --output-directory coverage-report/ --title "ossec test coverage" --show-details --legend --num-spaces 4 --quiet ossec.test
42 build_tests: test_os_zlib test_os_xml test_os_regex
44 test_os_zlib: test_os_zlib.c ${OS_ZLIB}
45 ${CC} ${CFLAGS_TEST} $+ ${CHECK_LINK} -o $@
47 test_os_xml: test_os_xml.c ../os_xml/*.c ../os_xml/*.h
48 ${CC} ${CFLAGS_TEST} test_os_xml.c ../os_xml/*.c ${CHECK_LINK} -o $@
50 test_os_regex: test_os_regex.c ../os_regex/*.c ../os_regex/*.h
51 ${CC} ${CFLAGS_TEST} test_os_regex.c ../os_regex/*.c ${CHECK_LINK} -o $@
56 ${CLEAN} test_os_zlib test_os_xml test_os_regex coverage-report/ ossec.test