Skip to content

Commit

Permalink
tests: fix test_compiled.address_sanitizer_coverage test
Browse files Browse the repository at this point in the history
Restore building of the sanitizer-coverage executable in CMake, and just
skip the test if it was not built with clang.

The original code made it hard to understand the purpose of the test.
  • Loading branch information
perillo committed Apr 5, 2024
1 parent b0d8917 commit 0709fab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ add_executable(fork+exec fork/fork+exec.c)
add_executable(thread-test threads/thread-main.c)
target_link_libraries(thread-test ${CMAKE_THREAD_LIBS_INIT})

#if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# add_executable(sanitizer-coverage sanitizer-coverage.c)
# set_target_properties(sanitizer-coverage PROPERTIES COMPILE_FLAGS "-g -fsanitize=address -fsanitize-coverage=bb")
# set_target_properties(sanitizer-coverage PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=bb")
#endif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_executable(sanitizer-coverage sanitizer-coverage.c)
set_target_properties(sanitizer-coverage PROPERTIES COMPILE_FLAGS "-g -fsanitize=address -fsanitize-coverage=bb")
set_target_properties(sanitizer-coverage PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=bb")
endif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

add_executable (pie pie.c)
if (CMAKE_VERSION VERSION_LESS "2.8.9")
Expand Down
4 changes: 2 additions & 2 deletions tests/tools/test_compiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ class address_sanitizer_coverage(libkcov.TestCase):
@unittest.expectedFailure
def runTest(self):
if not os.path.isfile(self.binaries + "/sanitizer-coverage"):
self.write_message("Clang-only")
assert False
self.skipTest("Clang only")

rv, o = self.do(
self.kcov
+ " --clang "
Expand Down

0 comments on commit 0709fab

Please sign in to comment.