dodan override za lintian
[ossec-hids.git] / src / tests / Makefile
1 # Copyright (C) 2014 Trend Micro Inc.
2 # All rights reserved.
3 #
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
7 # Foundation
8
9 PT=../
10 include ${PT}Config.Make
11
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 \
19         -Wwrite-strings \
20         -g -O0 --coverage \
21         -I../headers/
22
23 run_tests: build_tests
24         ./test_os_zlib
25         ./test_os_xml
26         ./test_os_regex
27         
28 generate_coverage: build_tests
29         lcov --base-directory . --directory . --zerocounters --rc lcov_branch_coverage=1 --quiet
30         @echo "Running tests\n"
31         
32         ./test_os_zlib
33         ./test_os_xml
34         ./test_os_regex
35         
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
40         
41         
42 build_tests: test_os_zlib test_os_xml test_os_regex
43
44 test_os_zlib: test_os_zlib.c ${OS_ZLIB}
45         ${CC} ${CFLAGS_TEST} $+ ${CHECK_LINK} -o $@
46
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 $@
49         
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 $@
52
53
54                 
55 clean:
56         ${CLEAN} test_os_zlib test_os_xml test_os_regex coverage-report/ ossec.test