Fix sandbox2 tests when run with CTest

This test runs, but fails due to a different problem:
  StackTraceTest.ForkEnterNsLibunwindDoesNotLeakFDs

PiperOrigin-RevId: 251218516
Change-Id: If06cdbcb71fad84ebd9d934ff173d7ef1a1eebc0
This commit is contained in:
Christian Blichmann 2019-06-03 06:27:35 -07:00 committed by Copybara-Service
parent dd2a84b980
commit 719cd24933
4 changed files with 23 additions and 8 deletions

View File

@ -94,7 +94,7 @@ target_link_libraries(sapi_test_main INTERFACE
) )
# Setup tests to work like with Bazel # Setup tests to work like with Bazel
create_directory_symlink(${PROJECT_SOURCE_DIR} com_google_sandboxed_api) create_directory_symlink(${PROJECT_BINARY_DIR} com_google_sandboxed_api)
enable_testing() enable_testing()
add_subdirectory(cmake/libunwind) add_subdirectory(cmake/libunwind)

View File

@ -33,6 +33,8 @@ sapi_cc_embed_data(NAME filewrapper_embedded
add_executable(filewrapper_test add_executable(filewrapper_test
filewrapper_test.cc filewrapper_test.cc
) )
configure_file(testdata/filewrapper_embedded.bin
testdata/filewrapper_embedded.bin COPYONLY)
target_link_libraries(filewrapper_test PRIVATE target_link_libraries(filewrapper_test PRIVATE
absl::strings absl::strings
filewrapper_embedded filewrapper_embedded
@ -42,6 +44,6 @@ target_link_libraries(filewrapper_test PRIVATE
sapi::test_main sapi::test_main
) )
gtest_discover_tests(filewrapper_test PROPERTIES gtest_discover_tests(filewrapper_test PROPERTIES
ENVIRONMENT TEST_TMPDIR=/tmp ENVIRONMENT "TEST_TMPDIR=/tmp"
ENVIRONMENT TEST_SRCDIR=${PROJECT_BINARY_DIR} ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
) )

View File

@ -532,7 +532,9 @@ target_link_libraries(buffer_test PRIVATE
sapi::status_matchers sapi::status_matchers
sapi::test_main sapi::test_main
) )
gtest_discover_tests(buffer_test) gtest_discover_tests(buffer_test PROPERTIES
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
)
# sandboxed_api/sandbox2:forkserver_proto # sandboxed_api/sandbox2:forkserver_proto
sapi_protobuf_generate_cpp(_sandbox2_forkserver_pb_h _sandbox2_forkserver_pb_cc sapi_protobuf_generate_cpp(_sandbox2_forkserver_pb_h _sandbox2_forkserver_pb_cc
@ -633,13 +635,17 @@ target_link_libraries(forkserver_test PRIVATE
sandbox2::testing sandbox2::testing
sapi::test_main sapi::test_main
) )
gtest_discover_tests(forkserver_test) gtest_discover_tests(forkserver_test PROPERTIES
ENVIRONMENT "TEST_TMPDIR=/tmp"
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
)
# sandboxed_api/sandbox2:limits_test # sandboxed_api/sandbox2:limits_test
add_executable(limits_test add_executable(limits_test
limits_test.cc limits_test.cc
) )
add_dependencies(limits_test add_dependencies(limits_test
sandbox2::testcase_limits
sandbox2::testcase_minimal sandbox2::testcase_minimal
) )
target_link_libraries(limits_test PRIVATE target_link_libraries(limits_test PRIVATE
@ -651,7 +657,10 @@ target_link_libraries(limits_test PRIVATE
sapi::status_matchers sapi::status_matchers
sapi::test_main sapi::test_main
) )
gtest_discover_tests(limits_test) gtest_discover_tests(limits_test PROPERTIES
ENVIRONMENT "TEST_TMPDIR=/tmp"
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
)
# sandboxed_api/sandbox2:notify_test # sandboxed_api/sandbox2:notify_test
add_executable(notify_test add_executable(notify_test

View File

@ -138,6 +138,10 @@ target_link_libraries(sandbox2_util_minielf PRIVATE
add_executable(minielf_test add_executable(minielf_test
minielf_test.cc minielf_test.cc
) )
configure_file(testdata/hello_world
testdata/hello_world COPYONLY)
configure_file(testdata/chrome_grte_header
testdata/chrome_grte_header COPYONLY)
target_link_libraries(minielf_test PRIVATE target_link_libraries(minielf_test PRIVATE
absl::strings absl::strings
sandbox2::maps_parser sandbox2::maps_parser
@ -146,8 +150,8 @@ target_link_libraries(minielf_test PRIVATE
sapi::test_main sapi::test_main
) )
gtest_discover_tests(minielf_test PROPERTIES gtest_discover_tests(minielf_test PROPERTIES
ENVIRONMENT TEST_TMPDIR=/tmp ENVIRONMENT "TEST_TMPDIR=/tmp"
ENVIRONMENT TEST_SRCDIR=${PROJECT_BINARY_DIR} ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
) )
# sandboxed_api/sandbox2/util:temp_file # sandboxed_api/sandbox2/util:temp_file