mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
tests: build integration.py targets with cmake
This commit is contained in:
parent
d2caaf22e8
commit
675211aff5
@ -23,6 +23,7 @@ option(STATIC_LINK "Statically link oid" OFF)
|
|||||||
option(ASAN "Enable address sanitizer" OFF)
|
option(ASAN "Enable address sanitizer" OFF)
|
||||||
option(CODE_COVERAGE "Enable code coverage" OFF)
|
option(CODE_COVERAGE "Enable code coverage" OFF)
|
||||||
option(WITH_TESTS "Build with tests" Off)
|
option(WITH_TESTS "Build with tests" Off)
|
||||||
|
option(WITH_FLAKY_TESTS "Build with flaky tests" OFF)
|
||||||
option(FORCE_BOOST_STATIC "Build with static boost" On)
|
option(FORCE_BOOST_STATIC "Build with static boost" On)
|
||||||
option(FORCE_LLVM_STATIC "Build with static llvm and clang" On)
|
option(FORCE_LLVM_STATIC "Build with static llvm and clang" On)
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ FetchContent_Populate(folly)
|
|||||||
|
|
||||||
add_library(folly_headers INTERFACE)
|
add_library(folly_headers INTERFACE)
|
||||||
target_include_directories(folly_headers SYSTEM INTERFACE ${folly_SOURCE_DIR})
|
target_include_directories(folly_headers SYSTEM INTERFACE ${folly_SOURCE_DIR})
|
||||||
|
target_link_libraries(folly_headers INTERFACE Boost::headers)
|
||||||
|
|
||||||
### bison & flex (for oid_parser)
|
### bison & flex (for oid_parser)
|
||||||
find_package(BISON 3.5 REQUIRED)
|
find_package(BISON 3.5 REQUIRED)
|
||||||
|
@ -37,16 +37,15 @@ function(cpp_unittest)
|
|||||||
gtest_discover_tests(${TEST_NAME} PROPERTIES ${TEST_PROPERTIES})
|
gtest_discover_tests(${TEST_NAME} PROPERTIES ${TEST_PROPERTIES})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Integration tests
|
add_executable(integration_mttest
|
||||||
# These tests can't be run in parallel with the other tests.
|
integration_mttest.cpp
|
||||||
# There is some sort of conflict triggering the following error:
|
)
|
||||||
# dwfl_linux_proc_report: bzip2 decompression failed
|
target_link_libraries(integration_mttest folly_headers)
|
||||||
# The integration tests are now triggered by the main Makefile.
|
|
||||||
#add_test(
|
add_executable(integration_sleepy
|
||||||
# NAME integration
|
integration_sleepy.cpp
|
||||||
# COMMAND make test-integration
|
)
|
||||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
target_link_libraries(integration_sleepy folly_headers)
|
||||||
#)
|
|
||||||
|
|
||||||
# Unit tests
|
# Unit tests
|
||||||
cpp_unittest(
|
cpp_unittest(
|
||||||
@ -61,5 +60,19 @@ cpp_unittest(
|
|||||||
DEPS oicore
|
DEPS oicore
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Integration tests
|
||||||
|
if (WITH_FLAKY_TESTS)
|
||||||
|
add_test(
|
||||||
|
NAME integration_py
|
||||||
|
COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/integration.py
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
set_tests_properties(integration_py PROPERTIES
|
||||||
|
TIMEOUT 90
|
||||||
|
ENVIRONMENT "OID=$<TARGET_FILE:oid>"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/extern/drgn/build")
|
include_directories("${PROJECT_SOURCE_DIR}/extern/drgn/build")
|
||||||
add_subdirectory("integration")
|
add_subdirectory("integration")
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
CXX=clang++
|
|
||||||
CXXFLAGS=-g -fdebug-types-section -I../extern/folly -O2 -pthread -no-pie
|
|
||||||
FILTER ?=
|
|
||||||
|
|
||||||
TARGETS=integration_mttest integration_sleepy
|
|
||||||
|
|
||||||
all: $(TARGETS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(TARGETS)
|
|
||||||
|
|
||||||
test-integration: integration_mttest integration_sleepy
|
|
||||||
sudo python3 integration.py -k '$(FILTER)'
|
|
@ -41,25 +41,21 @@ class OIDebuggerTestCase(unittest.TestCase):
|
|||||||
self.oid_source_dir = os.path.dirname(
|
self.oid_source_dir = os.path.dirname(
|
||||||
os.path.dirname(os.path.abspath(__file__))
|
os.path.dirname(os.path.abspath(__file__))
|
||||||
)
|
)
|
||||||
|
# Assume we started in the CMake build directory
|
||||||
|
self.build_dir = self.original_working_directory
|
||||||
|
|
||||||
# This needs to be a class variable, otherwise it won't be referenced
|
# This needs to be a class variable, otherwise it won't be referenced
|
||||||
# by any object alive by the end of this class method's execution and
|
# by any object alive by the end of this class method's execution and
|
||||||
# and the directory will be automatically removed before executing the
|
# and the directory will be automatically removed before executing the
|
||||||
# tests themselves.
|
# tests themselves.
|
||||||
self.temp = tempfile.TemporaryDirectory(
|
self.temp = tempfile.TemporaryDirectory(dir=self.build_dir)
|
||||||
dir=os.path.join(self.oid_source_dir, "build/")
|
|
||||||
)
|
|
||||||
os.chdir(self.temp.name)
|
os.chdir(self.temp.name)
|
||||||
|
|
||||||
self.oid = os.path.join(self.oid_source_dir, "build/oid")
|
self.oid = os.getenv("OID")
|
||||||
self.oid_conf = os.path.join(self.oid_source_dir, "build/testing.oid.toml")
|
self.oid_conf = os.path.join(self.build_dir, "..", "testing.oid.toml")
|
||||||
|
|
||||||
self.binary_path = os.path.join(
|
self.binary_path = os.path.join(self.build_dir, "integration_mttest")
|
||||||
self.oid_source_dir, "test", "integration_mttest"
|
self.sleepy_binary_path = os.path.join(self.build_dir, "integration_sleepy")
|
||||||
)
|
|
||||||
self.sleepy_binary_path = os.path.join(
|
|
||||||
self.oid_source_dir, "test", "integration_sleepy"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.custom_generated_code_file = os.path.join(
|
self.custom_generated_code_file = os.path.join(
|
||||||
self.temp.name, "custom_oid_output.cpp"
|
self.temp.name, "custom_oid_output.cpp"
|
||||||
@ -150,6 +146,9 @@ class OIDebuggerTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(output[0]["dynamicSize"], 76)
|
self.assertEqual(output[0]["dynamicSize"], 76)
|
||||||
self.assertEqual(len(output[0]["members"]), 25)
|
self.assertEqual(len(output[0]["members"]), 25)
|
||||||
|
|
||||||
|
@unittest.skip(
|
||||||
|
"https://github.com/facebookexperimental/object-introspection/issues/53"
|
||||||
|
)
|
||||||
def test_data_segment_size_change(self):
|
def test_data_segment_size_change(self):
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
f"{self.binary_path} 1000",
|
f"{self.binary_path} 1000",
|
||||||
|
Loading…
Reference in New Issue
Block a user