diff --git a/CMakeLists.txt b/CMakeLists.txt index 96f02f0..26c2eda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ target_link_libraries(sapi_test_main INTERFACE ) # 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() add_subdirectory(cmake/libunwind) diff --git a/sandboxed_api/bazel/CMakeLists.txt b/sandboxed_api/bazel/CMakeLists.txt index 02a333f..3d74d65 100644 --- a/sandboxed_api/bazel/CMakeLists.txt +++ b/sandboxed_api/bazel/CMakeLists.txt @@ -33,6 +33,8 @@ sapi_cc_embed_data(NAME filewrapper_embedded add_executable(filewrapper_test filewrapper_test.cc ) +configure_file(testdata/filewrapper_embedded.bin + testdata/filewrapper_embedded.bin COPYONLY) target_link_libraries(filewrapper_test PRIVATE absl::strings filewrapper_embedded @@ -42,6 +44,6 @@ target_link_libraries(filewrapper_test PRIVATE sapi::test_main ) gtest_discover_tests(filewrapper_test PROPERTIES - ENVIRONMENT TEST_TMPDIR=/tmp - ENVIRONMENT TEST_SRCDIR=${PROJECT_BINARY_DIR} + ENVIRONMENT "TEST_TMPDIR=/tmp" + ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}" ) diff --git a/sandboxed_api/sandbox2/CMakeLists.txt b/sandboxed_api/sandbox2/CMakeLists.txt index 45b7c1f..b40c1c2 100644 --- a/sandboxed_api/sandbox2/CMakeLists.txt +++ b/sandboxed_api/sandbox2/CMakeLists.txt @@ -532,7 +532,9 @@ target_link_libraries(buffer_test PRIVATE sapi::status_matchers 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 sapi_protobuf_generate_cpp(_sandbox2_forkserver_pb_h _sandbox2_forkserver_pb_cc @@ -633,13 +635,17 @@ target_link_libraries(forkserver_test PRIVATE sandbox2::testing 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 add_executable(limits_test limits_test.cc ) add_dependencies(limits_test + sandbox2::testcase_limits sandbox2::testcase_minimal ) target_link_libraries(limits_test PRIVATE @@ -651,7 +657,10 @@ target_link_libraries(limits_test PRIVATE sapi::status_matchers 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 add_executable(notify_test diff --git a/sandboxed_api/sandbox2/util/CMakeLists.txt b/sandboxed_api/sandbox2/util/CMakeLists.txt index 7559366..93470b7 100644 --- a/sandboxed_api/sandbox2/util/CMakeLists.txt +++ b/sandboxed_api/sandbox2/util/CMakeLists.txt @@ -138,6 +138,10 @@ target_link_libraries(sandbox2_util_minielf PRIVATE add_executable(minielf_test 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 absl::strings sandbox2::maps_parser @@ -146,8 +150,8 @@ target_link_libraries(minielf_test PRIVATE sapi::test_main ) gtest_discover_tests(minielf_test PROPERTIES - ENVIRONMENT TEST_TMPDIR=/tmp - ENVIRONMENT TEST_SRCDIR=${PROJECT_BINARY_DIR} + ENVIRONMENT "TEST_TMPDIR=/tmp" + ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}" ) # sandboxed_api/sandbox2/util:temp_file