diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 59c06fc7..272df959 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -133,6 +133,8 @@ target_link_libraries(multi_fork "${M_LIBRARY}") add_executable(shared_library_test ${shared_library_test_SRCS}) target_link_libraries(shared_library_test shared_library) +# This doesn't appear to work, unfortunately, but will be needed for the --skip-solibs test +set_target_properties (shared_library_test PROPERTIES POSITION_INDEPENDENT_CODE False) add_executable(argv_dependent ${argv_dependent_SRCS}) add_executable(test_popen ${test_popen_SRCS}) diff --git a/tests/shared-library/solib.c b/tests/shared-library/solib.c index 571d5539..5dce07ef 100644 --- a/tests/shared-library/solib.c +++ b/tests/shared-library/solib.c @@ -7,7 +7,10 @@ int vobb(int a) a = a + 1; if (a > 2) + { + printf("a is greater than 2\n"); return 1; + } return 0; } diff --git a/tests/tools/test_compiled.py b/tests/tools/test_compiled.py index ff2a3054..3006c349 100644 --- a/tests/tools/test_compiled.py +++ b/tests/tools/test_compiled.py @@ -498,7 +498,7 @@ def runTest(self): assert cobertura.hitsPerLine(dom, "dlopen.cc", 11) == 1 assert cobertura.hitsPerLine(dom, "dlopen.cc", 12) == 0 assert cobertura.hitsPerLine(dom, "solib.c", 5) == 1 - assert cobertura.hitsPerLine(dom, "solib.c", 12) == 0 + assert cobertura.hitsPerLine(dom, "solib.c", 15) == 0 class dlopen_in_ignored_source_file(libkcov.TestCase): @@ -516,7 +516,7 @@ def runTest(self): dom = cobertura.parseFile(self.outbase + "/kcov/dlopen/cobertura.xml") assert cobertura.hitsPerLine(dom, "dlopen-main.cc", 10) == 1 assert cobertura.hitsPerLine(dom, "solib.c", 5) == 1 - assert cobertura.hitsPerLine(dom, "solib.c", 12) == 0 + assert cobertura.hitsPerLine(dom, "solib.c", 15) == 0 class daemon_no_wait_for_last_child(libkcov.TestCase): diff --git a/tests/tools/test_compiled_basic.py b/tests/tools/test_compiled_basic.py index bc8fc7b2..69b6d741 100644 --- a/tests/tools/test_compiled_basic.py +++ b/tests/tools/test_compiled_basic.py @@ -35,11 +35,12 @@ def runTest(self): + "/shared_library_test", False, ) + # Fickle since the binary is built as a PIE by default, not sure how to disable it self.skipTest("Fickle test, ignoring") assert rv == 0 dom = cobertura.parseFile(self.outbase + "/kcov/shared_library_test/cobertura.xml") - assert cobertura.hitsPerLine(dom, "main.c", 9) == 1 + assert cobertura.hitsPerLine(dom, "main.c", 9) >= 1 assert cobertura.hitsPerLine(dom, "solib.c", 5) is None @@ -74,7 +75,7 @@ def runTest(self): dom = cobertura.parseFile(self.outbase + "/kcov/shared_library_test/cobertura.xml") assert cobertura.hitsPerLine(dom, "main.c", 9) == 1 assert cobertura.hitsPerLine(dom, "solib.c", 5) == 1 - assert cobertura.hitsPerLine(dom, "solib.c", 10) == 1 + assert cobertura.hitsPerLine(dom, "solib.c", 11) >= 1 class MainTestBase(libkcov.TestCase):