Skip to content

Commit

Permalink
Merge pull request #435 from perillo/additional-test-improvements
Browse files Browse the repository at this point in the history
Additional test fixes
  • Loading branch information
SimonKagstrom authored Apr 6, 2024
2 parents b374103 + 449fec0 commit b270dce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
22 changes: 7 additions & 15 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,17 @@ 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")
set_target_properties (pie PROPERTIES COMPILE_FLAGS -fPIE)
else (CMAKE_VERSION VERSION_LESS "2.8.9")
set_target_properties (pie PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif (CMAKE_VERSION VERSION_LESS "2.8.9")
set_target_properties (pie PROPERTIES POSITION_INDEPENDENT_CODE ON)

add_executable (pie-test argv-dependent.c)
if (CMAKE_VERSION VERSION_LESS "2.8.9")
set_target_properties (pie-test PROPERTIES COMPILE_FLAGS -fPIE)
else (CMAKE_VERSION VERSION_LESS "2.8.9")
set_target_properties (pie-test PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif (CMAKE_VERSION VERSION_LESS "2.8.9")
set_target_properties (pie-test PROPERTIES POSITION_INDEPENDENT_CODE ON)

if (NOT(CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
if (CMAKE_TARGET_ARCHITECTURES STREQUAL "i386" OR CMAKE_TARGET_ARCHITECTURES STREQUAL "x86_64")
Expand Down
12 changes: 5 additions & 7 deletions tests/tools/test_compiled.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import platform
import sys
import time
import unittest

import libkcov
Expand Down Expand Up @@ -100,7 +101,7 @@ def runTest(self):
assert rv == 99


class Pie(libkcov.TestCase):
class pie(libkcov.TestCase):
def runTest(self):
noKcovRv, o = self.doCmd(self.binaries + "/pie")
rv, o = self.do(self.kcov + " " + self.outbase + "/kcov " + self.binaries + "/pie", False)
Expand Down Expand Up @@ -180,9 +181,6 @@ def runTest(self):


class SignalsBase(libkcov.TestCase):
def SignalsBase():
self.m_self = ""

def cmpOne(self, sig):
noKcovRv, o = self.doCmd(self.binaries + "/signals " + sig + " " + self.m_self)
rv, o = self.do(
Expand Down Expand Up @@ -270,7 +268,7 @@ def runTest(self):
try:
dom = cobertura.parseFile(self.outbase + "/kcov/main-tests/cobertura.xml")
self.fail("File unexpectedly found")
except:
except Exception:
# Exception is expected here
pass

Expand Down Expand Up @@ -570,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
2 changes: 1 addition & 1 deletion tests/tools/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def doTest(self, extra):


class python_coverage(PythonBase):
def runTestTest(self):
def runTest(self):
self.doTest("")


Expand Down

0 comments on commit b270dce

Please sign in to comment.