From 3021832c3eb6b158e3dbcf8879a7f7953ddbb7f4 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Sat, 14 Mar 2015 22:52:35 +0900 Subject: [PATCH] Add tests for PIE support. (Continuation of issue #77) --- tests/CMakeLists.txt | 4 ++++ tests/pie.c | 7 +++++++ tests/robot-framework/kcov-tests.txt | 8 ++++++++ 3 files changed, 19 insertions(+) create mode 100644 tests/pie.c diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 56bbcb04..578c018c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -102,6 +102,10 @@ add_executable(issue31 daemon/test-issue31.cc) add_executable(dlopen dlopen/dlopen.cc dlopen/dlopen-main.cc) add_executable(s short-file.c) +add_executable(pie pie.c) +set_target_properties(pie PROPERTIES COMPILE_FLAGS "-g -fpie -fPIE") +set_target_properties(pie PROPERTIES LINK_FLAGS "-pie") + add_executable(main-tests-gcov ${main_tests_SRCS}) set_target_properties(main-tests-gcov PROPERTIES COMPILE_FLAGS "--coverage") set_target_properties(main-tests-gcov PROPERTIES LINK_FLAGS "--coverage") diff --git a/tests/pie.c b/tests/pie.c new file mode 100644 index 00000000..679b35e0 --- /dev/null +++ b/tests/pie.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("Hello\n"); +} + diff --git a/tests/robot-framework/kcov-tests.txt b/tests/robot-framework/kcov-tests.txt index 72849772..f73af35a 100644 --- a/tests/robot-framework/kcov-tests.txt +++ b/tests/robot-framework/kcov-tests.txt @@ -242,6 +242,14 @@ short-filename ${rc}= Run and return RC ${kcov} ${out} ./s Should be equal as integers ${rc} 99 +pie + Run rm -rf ${out}/pie + ${no_kcov_rc}= Run and return RC ./pie + ${rc}= Run and return RC ${kcov} ${out} ./pie + Should be equal as integers ${rc} ${no_kcov_rc} + ${output}= Run ${xml_lookup} ${out}/pie/cobertura.xml pie_c 5 + Should Contain ${output} 1 + global-constructors-test Run rm -rf ${out}/global-constructors ${no_kcov_rc}= Run and return RC ./global-constructors