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(CODE_COVERAGE "Enable code coverage" 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_LLVM_STATIC "Build with static llvm and clang" On)
|
||||
|
||||
@ -123,6 +124,7 @@ FetchContent_Populate(folly)
|
||||
|
||||
add_library(folly_headers INTERFACE)
|
||||
target_include_directories(folly_headers SYSTEM INTERFACE ${folly_SOURCE_DIR})
|
||||
target_link_libraries(folly_headers INTERFACE Boost::headers)
|
||||
|
||||
### bison & flex (for oid_parser)
|
||||
find_package(BISON 3.5 REQUIRED)
|
||||
|
@ -37,16 +37,15 @@ function(cpp_unittest)
|
||||
gtest_discover_tests(${TEST_NAME} PROPERTIES ${TEST_PROPERTIES})
|
||||
endfunction()
|
||||
|
||||
# Integration tests
|
||||
# These tests can't be run in parallel with the other tests.
|
||||
# There is some sort of conflict triggering the following error:
|
||||
# dwfl_linux_proc_report: bzip2 decompression failed
|
||||
# The integration tests are now triggered by the main Makefile.
|
||||
#add_test(
|
||||
# NAME integration
|
||||
# COMMAND make test-integration
|
||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
#)
|
||||
add_executable(integration_mttest
|
||||
integration_mttest.cpp
|
||||
)
|
||||
target_link_libraries(integration_mttest folly_headers)
|
||||
|
||||
add_executable(integration_sleepy
|
||||
integration_sleepy.cpp
|
||||
)
|
||||
target_link_libraries(integration_sleepy folly_headers)
|
||||
|
||||
# Unit tests
|
||||
cpp_unittest(
|
||||
@ -61,5 +60,19 @@ cpp_unittest(
|
||||
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")
|
||||
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(
|
||||
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
|
||||
# by any object alive by the end of this class method's execution and
|
||||
# and the directory will be automatically removed before executing the
|
||||
# tests themselves.
|
||||
self.temp = tempfile.TemporaryDirectory(
|
||||
dir=os.path.join(self.oid_source_dir, "build/")
|
||||
)
|
||||
self.temp = tempfile.TemporaryDirectory(dir=self.build_dir)
|
||||
os.chdir(self.temp.name)
|
||||
|
||||
self.oid = os.path.join(self.oid_source_dir, "build/oid")
|
||||
self.oid_conf = os.path.join(self.oid_source_dir, "build/testing.oid.toml")
|
||||
self.oid = os.getenv("OID")
|
||||
self.oid_conf = os.path.join(self.build_dir, "..", "testing.oid.toml")
|
||||
|
||||
self.binary_path = os.path.join(
|
||||
self.oid_source_dir, "test", "integration_mttest"
|
||||
)
|
||||
self.sleepy_binary_path = os.path.join(
|
||||
self.oid_source_dir, "test", "integration_sleepy"
|
||||
)
|
||||
self.binary_path = os.path.join(self.build_dir, "integration_mttest")
|
||||
self.sleepy_binary_path = os.path.join(self.build_dir, "integration_sleepy")
|
||||
|
||||
self.custom_generated_code_file = os.path.join(
|
||||
self.temp.name, "custom_oid_output.cpp"
|
||||
@ -150,6 +146,9 @@ class OIDebuggerTestCase(unittest.TestCase):
|
||||
self.assertEqual(output[0]["dynamicSize"], 76)
|
||||
self.assertEqual(len(output[0]["members"]), 25)
|
||||
|
||||
@unittest.skip(
|
||||
"https://github.com/facebookexperimental/object-introspection/issues/53"
|
||||
)
|
||||
def test_data_segment_size_change(self):
|
||||
with subprocess.Popen(
|
||||
f"{self.binary_path} 1000",
|
||||
|
Loading…
Reference in New Issue
Block a user