mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Add CMake options to exclude examples and tests from build
PiperOrigin-RevId: 258136393 Change-Id: Ifb2d7a24f93cd1d2782b4e4d6ac2c34a0d1c2bff
This commit is contained in:
parent
99ac7fa60d
commit
6d33c1f908
|
@ -25,10 +25,13 @@ project(sandboxed_api C CXX ASM)
|
||||||
# SAPI-wide setting for the language level
|
# SAPI-wide setting for the language level
|
||||||
set(SAPI_CXX_STANDARD 11)
|
set(SAPI_CXX_STANDARD 11)
|
||||||
|
|
||||||
|
# Sapi CMake modules, order matters
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
include(SapiOptions)
|
||||||
include(SapiDeps)
|
include(SapiDeps)
|
||||||
include(SapiUtil) # Needs to come after SapiDeps
|
include(SapiUtil)
|
||||||
include(SapiBuildDefs)
|
include(SapiBuildDefs)
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
|
|
||||||
# Make Bazel-style includes work
|
# Make Bazel-style includes work
|
||||||
|
|
|
@ -33,16 +33,18 @@ if(_sapi_saved_CMAKE_CXX_STANDARD)
|
||||||
set(CMAKE_CXX_STANDARD "${_sapi_saved_CMAKE_CXX_STANDARD}")
|
set(CMAKE_CXX_STANDARD "${_sapi_saved_CMAKE_CXX_STANDARD}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build Googletest directly, as recommended upstream
|
if(SAPI_ENABLE_TESTS)
|
||||||
find_path(googletest_src_dir
|
# Build Googletest directly, as recommended upstream
|
||||||
|
find_path(googletest_src_dir
|
||||||
googletest/include/gtest/gtest.h
|
googletest/include/gtest/gtest.h
|
||||||
HINTS ${GOOGLETEST_ROOT_DIR}
|
HINTS ${GOOGLETEST_ROOT_DIR}
|
||||||
PATHS ${PROJECT_BINARY_DIR}/Dependencies/Source/googletest
|
PATHS ${PROJECT_BINARY_DIR}/Dependencies/Source/googletest
|
||||||
)
|
)
|
||||||
set(gtest_force_shared_crt ON CACHE BOOL "")
|
set(gtest_force_shared_crt ON CACHE BOOL "")
|
||||||
add_subdirectory(${googletest_src_dir}
|
add_subdirectory(${googletest_src_dir}
|
||||||
${PROJECT_BINARY_DIR}/Dependencies/Build/googletest
|
${PROJECT_BINARY_DIR}/Dependencies/Build/googletest
|
||||||
EXCLUDE_FROM_ALL)
|
EXCLUDE_FROM_ALL)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Prefer to use static libraries
|
# Prefer to use static libraries
|
||||||
set(_sapi_saved_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(_sapi_saved_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
@ -56,7 +58,9 @@ find_package(gflags REQUIRED)
|
||||||
find_package(glog REQUIRED)
|
find_package(glog REQUIRED)
|
||||||
find_package(Libcap REQUIRED)
|
find_package(Libcap REQUIRED)
|
||||||
find_package(Libffi REQUIRED)
|
find_package(Libffi REQUIRED)
|
||||||
find_package(ZLIB REQUIRED)
|
if(SAPI_ENABLE_EXAMPLES)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
endif()
|
||||||
find_package(Protobuf REQUIRED)
|
find_package(Protobuf REQUIRED)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_LESS "3.12")
|
if(CMAKE_VERSION VERSION_LESS "3.12")
|
||||||
|
|
16
cmake/SapiOptions.cmake
Normal file
16
cmake/SapiOptions.cmake
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Copyright 2019 Google LLC. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
option(SAPI_ENABLE_EXAMPLES "Build example code" ON)
|
||||||
|
option(SAPI_ENABLE_TESTS "Build unit tests" ON)
|
|
@ -29,21 +29,23 @@ sapi_cc_embed_data(NAME filewrapper_embedded
|
||||||
SOURCES testdata/filewrapper_embedded.bin
|
SOURCES testdata/filewrapper_embedded.bin
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/bazel:filewrapper_test
|
if(SAPI_ENABLE_TESTS)
|
||||||
add_executable(filewrapper_test
|
# sandboxed_api/bazel:filewrapper_test
|
||||||
|
add_executable(filewrapper_test
|
||||||
filewrapper_test.cc
|
filewrapper_test.cc
|
||||||
)
|
)
|
||||||
configure_file(testdata/filewrapper_embedded.bin
|
configure_file(testdata/filewrapper_embedded.bin
|
||||||
testdata/filewrapper_embedded.bin COPYONLY)
|
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
|
||||||
sandbox2::file_helpers
|
sandbox2::file_helpers
|
||||||
sandbox2::fileops
|
sandbox2::fileops
|
||||||
sandbox2::testing
|
sandbox2::testing
|
||||||
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}"
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
|
@ -12,5 +12,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
add_subdirectory(stringop)
|
if(SAPI_ENABLE_EXAMPLES)
|
||||||
add_subdirectory(sum)
|
add_subdirectory(stringop)
|
||||||
|
add_subdirectory(sum)
|
||||||
|
endif()
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
add_subdirectory(testcases)
|
|
||||||
add_subdirectory(unwind)
|
add_subdirectory(unwind)
|
||||||
add_subdirectory(util)
|
add_subdirectory(util)
|
||||||
|
|
||||||
|
@ -61,17 +60,6 @@ target_link_libraries(sandbox2_syscall
|
||||||
PUBLIC glog::glog
|
PUBLIC glog::glog
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:syscall_test
|
|
||||||
add_executable(syscall_test
|
|
||||||
syscall_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(syscall_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::syscall
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(syscall_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:result
|
# sandboxed_api/sandbox2:result
|
||||||
add_library(sandbox2_result STATIC
|
add_library(sandbox2_result STATIC
|
||||||
result.cc
|
result.cc
|
||||||
|
@ -419,27 +407,6 @@ target_link_libraries(sandbox2_mounts PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:mounts_test
|
|
||||||
add_executable(mounts_test
|
|
||||||
mounts_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(mounts_test
|
|
||||||
sandbox2::testcase_minimal_dynamic
|
|
||||||
)
|
|
||||||
target_link_libraries(mounts_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::file_base
|
|
||||||
sandbox2::mounts
|
|
||||||
sandbox2::temp_file
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(mounts_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:namespace
|
# sandboxed_api/sandbox2:namespace
|
||||||
add_library(sandbox2_namespace STATIC
|
add_library(sandbox2_namespace STATIC
|
||||||
namespace.cc
|
namespace.cc
|
||||||
|
@ -461,29 +428,6 @@ target_link_libraries(sandbox2_namespace PRIVATE
|
||||||
sapi::raw_logging
|
sapi::raw_logging
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:namespace_test
|
|
||||||
add_executable(namespace_test
|
|
||||||
namespace_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(mounts_test
|
|
||||||
sandbox2::testcase_hostname
|
|
||||||
sandbox2::testcase_namespace
|
|
||||||
)
|
|
||||||
target_link_libraries(namespace_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::namespace
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(namespace_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:forkingclient
|
# sandboxed_api/sandbox2:forkingclient
|
||||||
add_library(sandbox2_forkingclient STATIC
|
add_library(sandbox2_forkingclient STATIC
|
||||||
forkingclient.cc
|
forkingclient.cc
|
||||||
|
@ -539,26 +483,6 @@ target_link_libraries(sandbox2_buffer PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:buffer_test
|
|
||||||
add_executable(buffer_test
|
|
||||||
buffer_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(buffer_test
|
|
||||||
sandbox2::testcase_buffer
|
|
||||||
)
|
|
||||||
target_link_libraries(buffer_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
sandbox2::buffer
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(buffer_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:forkserver_proto
|
# sandboxed_api/sandbox2:forkserver_proto
|
||||||
protobuf_generate_cpp(_sandbox2_forkserver_pb_h _sandbox2_forkserver_pb_cc
|
protobuf_generate_cpp(_sandbox2_forkserver_pb_h _sandbox2_forkserver_pb_cc
|
||||||
forkserver.proto
|
forkserver.proto
|
||||||
|
@ -610,250 +534,6 @@ target_link_libraries(sandbox2_comms PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:comms_test_proto
|
|
||||||
protobuf_generate_cpp(_sandbox2_comms_test_pb_h _sandbox2_comms_test_pb_cc
|
|
||||||
comms_test.proto
|
|
||||||
)
|
|
||||||
add_library(sandbox2_comms_test_proto STATIC
|
|
||||||
${_sandbox2_comms_test_pb_cc}
|
|
||||||
${_sandbox2_comms_test_pb_h}
|
|
||||||
)
|
|
||||||
add_library(sandbox2::comms_test_proto ALIAS sandbox2_comms_test_proto)
|
|
||||||
target_link_libraries(sandbox2_comms_test_proto PRIVATE
|
|
||||||
protobuf::libprotobuf
|
|
||||||
sapi::base
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:comms_test
|
|
||||||
add_executable(comms_test
|
|
||||||
comms_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(comms_test PRIVATE
|
|
||||||
absl::fixed_array
|
|
||||||
absl::strings
|
|
||||||
glog::glog
|
|
||||||
protobuf::libprotobuf
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::comms_test_proto
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(comms_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:forkserver_test
|
|
||||||
add_executable(forkserver_test
|
|
||||||
forkserver_test.cc
|
|
||||||
global_forkclient.h
|
|
||||||
)
|
|
||||||
add_dependencies(forkserver_test
|
|
||||||
sandbox2::testcase_minimal
|
|
||||||
)
|
|
||||||
target_link_libraries(forkserver_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
glog::glog
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::forkserver
|
|
||||||
sandbox2::forkserver_proto
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
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
|
|
||||||
absl::memory
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::limits
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
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
|
|
||||||
notify_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(notify_test
|
|
||||||
sandbox2::testcase_personality
|
|
||||||
sandbox2::testcase_pidcomms
|
|
||||||
)
|
|
||||||
target_link_libraries(notify_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::regs
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(notify_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:policy_test
|
|
||||||
add_executable(policy_test
|
|
||||||
policy_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(policy_test
|
|
||||||
sandbox2::testcase_add_policy_on_syscalls
|
|
||||||
sandbox2::testcase_malloc_system
|
|
||||||
sandbox2::testcase_minimal
|
|
||||||
sandbox2::testcase_minimal_dynamic
|
|
||||||
sandbox2::testcase_policy
|
|
||||||
)
|
|
||||||
target_link_libraries(policy_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::limits
|
|
||||||
sandbox2::regs
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(policy_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:sandbox2_test
|
|
||||||
add_executable(sandbox2_test
|
|
||||||
sandbox2_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(sandbox2_test
|
|
||||||
sandbox2::testcase_abort
|
|
||||||
sandbox2::testcase_minimal
|
|
||||||
sandbox2::testcase_sleep
|
|
||||||
sandbox2::testcase_tsync
|
|
||||||
)
|
|
||||||
target_link_libraries(sandbox2_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(sandbox2_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:sanitizer_test
|
|
||||||
add_executable(sanitizer_test
|
|
||||||
sanitizer_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(sanitizer_test
|
|
||||||
sandbox2::testcase_sanitizer
|
|
||||||
)
|
|
||||||
target_link_libraries(sanitizer_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::client
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sandbox2::util
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(sanitizer_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:util_test
|
|
||||||
add_executable(util_test
|
|
||||||
util_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(util_test PRIVATE
|
|
||||||
sandbox2::file_base
|
|
||||||
sandbox2::testing
|
|
||||||
sandbox2::util
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(util_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:stack_trace_test
|
|
||||||
add_executable(stack_trace_test
|
|
||||||
stack_trace_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(stack_trace_test
|
|
||||||
sandbox2::testcase_symbolize
|
|
||||||
)
|
|
||||||
target_link_libraries(stack_trace_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
absl::strings
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::fileops
|
|
||||||
sandbox2::global_forkserver
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::temp_file
|
|
||||||
sandbox2::testing
|
|
||||||
sandbox2::util
|
|
||||||
sapi::flags
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(stack_trace_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:ipc_test
|
|
||||||
add_executable(ipc_test
|
|
||||||
ipc_test.cc
|
|
||||||
)
|
|
||||||
add_dependencies(ipc_test
|
|
||||||
sandbox2::testcase_ipc
|
|
||||||
)
|
|
||||||
target_link_libraries(ipc_test PRIVATE
|
|
||||||
absl::memory
|
|
||||||
sandbox2::bpf_helper
|
|
||||||
sandbox2::comms
|
|
||||||
sandbox2::sandbox2
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::flags
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(ipc_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:testing
|
|
||||||
add_library(sandbox2_testing STATIC
|
|
||||||
testing.cc
|
|
||||||
testing.h
|
|
||||||
)
|
|
||||||
add_library(sandbox2::testing ALIAS sandbox2_testing)
|
|
||||||
target_link_libraries(sandbox2_testing PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::file_base
|
|
||||||
sapi::base
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:violation_proto
|
# sandboxed_api/sandbox2:violation_proto
|
||||||
protobuf_generate_cpp(_sandbox2_violation_pb_cc _sandbox2_violation_pb_h
|
protobuf_generate_cpp(_sandbox2_violation_pb_cc _sandbox2_violation_pb_h
|
||||||
violation.proto
|
violation.proto
|
||||||
|
@ -869,14 +549,336 @@ target_link_libraries(sandbox2_violation_proto PRIVATE
|
||||||
sapi::base
|
sapi::base
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2:policybuilder_test
|
if(SAPI_ENABLE_TESTS)
|
||||||
add_executable(policybuilder_test
|
add_subdirectory(testcases)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:syscall_test
|
||||||
|
add_executable(syscall_test
|
||||||
|
syscall_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(syscall_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::syscall
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(syscall_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:mounts_test
|
||||||
|
add_executable(mounts_test
|
||||||
|
mounts_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(mounts_test
|
||||||
|
sandbox2::testcase_minimal_dynamic
|
||||||
|
)
|
||||||
|
target_link_libraries(mounts_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::file_base
|
||||||
|
sandbox2::mounts
|
||||||
|
sandbox2::temp_file
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(mounts_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:namespace_test
|
||||||
|
add_executable(namespace_test
|
||||||
|
namespace_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(mounts_test
|
||||||
|
sandbox2::testcase_hostname
|
||||||
|
sandbox2::testcase_namespace
|
||||||
|
)
|
||||||
|
target_link_libraries(namespace_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::namespace
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(namespace_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:buffer_test
|
||||||
|
add_executable(buffer_test
|
||||||
|
buffer_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(buffer_test
|
||||||
|
sandbox2::testcase_buffer
|
||||||
|
)
|
||||||
|
target_link_libraries(buffer_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
sandbox2::buffer
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(buffer_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:comms_test_proto
|
||||||
|
protobuf_generate_cpp(_sandbox2_comms_test_pb_h _sandbox2_comms_test_pb_cc
|
||||||
|
comms_test.proto
|
||||||
|
)
|
||||||
|
add_library(sandbox2_comms_test_proto STATIC
|
||||||
|
${_sandbox2_comms_test_pb_cc}
|
||||||
|
${_sandbox2_comms_test_pb_h}
|
||||||
|
)
|
||||||
|
add_library(sandbox2::comms_test_proto ALIAS sandbox2_comms_test_proto)
|
||||||
|
target_link_libraries(sandbox2_comms_test_proto PRIVATE
|
||||||
|
protobuf::libprotobuf
|
||||||
|
sapi::base
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:comms_test
|
||||||
|
add_executable(comms_test
|
||||||
|
comms_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(comms_test PRIVATE
|
||||||
|
absl::fixed_array
|
||||||
|
absl::strings
|
||||||
|
glog::glog
|
||||||
|
protobuf::libprotobuf
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::comms_test_proto
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(comms_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:forkserver_test
|
||||||
|
add_executable(forkserver_test
|
||||||
|
forkserver_test.cc
|
||||||
|
global_forkclient.h
|
||||||
|
)
|
||||||
|
add_dependencies(forkserver_test
|
||||||
|
sandbox2::testcase_minimal
|
||||||
|
)
|
||||||
|
target_link_libraries(forkserver_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
glog::glog
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::forkserver
|
||||||
|
sandbox2::forkserver_proto
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
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
|
||||||
|
absl::memory
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::limits
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
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
|
||||||
|
notify_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(notify_test
|
||||||
|
sandbox2::testcase_personality
|
||||||
|
sandbox2::testcase_pidcomms
|
||||||
|
)
|
||||||
|
target_link_libraries(notify_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::regs
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(notify_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:policy_test
|
||||||
|
add_executable(policy_test
|
||||||
|
policy_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(policy_test
|
||||||
|
sandbox2::testcase_add_policy_on_syscalls
|
||||||
|
sandbox2::testcase_malloc_system
|
||||||
|
sandbox2::testcase_minimal
|
||||||
|
sandbox2::testcase_minimal_dynamic
|
||||||
|
sandbox2::testcase_policy
|
||||||
|
)
|
||||||
|
target_link_libraries(policy_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::limits
|
||||||
|
sandbox2::regs
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(policy_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:sandbox2_test
|
||||||
|
add_executable(sandbox2_test
|
||||||
|
sandbox2_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(sandbox2_test
|
||||||
|
sandbox2::testcase_abort
|
||||||
|
sandbox2::testcase_minimal
|
||||||
|
sandbox2::testcase_sleep
|
||||||
|
sandbox2::testcase_tsync
|
||||||
|
)
|
||||||
|
target_link_libraries(sandbox2_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(sandbox2_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:sanitizer_test
|
||||||
|
add_executable(sanitizer_test
|
||||||
|
sanitizer_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(sanitizer_test
|
||||||
|
sandbox2::testcase_sanitizer
|
||||||
|
)
|
||||||
|
target_link_libraries(sanitizer_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::client
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sandbox2::util
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(sanitizer_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:util_test
|
||||||
|
add_executable(util_test
|
||||||
|
util_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(util_test PRIVATE
|
||||||
|
sandbox2::file_base
|
||||||
|
sandbox2::testing
|
||||||
|
sandbox2::util
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(util_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:stack_trace_test
|
||||||
|
add_executable(stack_trace_test
|
||||||
|
stack_trace_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(stack_trace_test
|
||||||
|
sandbox2::testcase_symbolize
|
||||||
|
)
|
||||||
|
target_link_libraries(stack_trace_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
absl::strings
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::fileops
|
||||||
|
sandbox2::global_forkserver
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::temp_file
|
||||||
|
sandbox2::testing
|
||||||
|
sandbox2::util
|
||||||
|
sapi::flags
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(stack_trace_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:ipc_test
|
||||||
|
add_executable(ipc_test
|
||||||
|
ipc_test.cc
|
||||||
|
)
|
||||||
|
add_dependencies(ipc_test
|
||||||
|
sandbox2::testcase_ipc
|
||||||
|
)
|
||||||
|
target_link_libraries(ipc_test PRIVATE
|
||||||
|
absl::memory
|
||||||
|
sandbox2::bpf_helper
|
||||||
|
sandbox2::comms
|
||||||
|
sandbox2::sandbox2
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::flags
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(ipc_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:testing
|
||||||
|
add_library(sandbox2_testing STATIC
|
||||||
|
testing.cc
|
||||||
|
testing.h
|
||||||
|
)
|
||||||
|
add_library(sandbox2::testing ALIAS sandbox2_testing)
|
||||||
|
target_link_libraries(sandbox2_testing PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::file_base
|
||||||
|
sapi::base
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2:policybuilder_test
|
||||||
|
add_executable(policybuilder_test
|
||||||
policybuilder_test.cc
|
policybuilder_test.cc
|
||||||
)
|
)
|
||||||
add_dependencies(policybuilder_test
|
add_dependencies(policybuilder_test
|
||||||
sandbox2::testcase_print_fds
|
sandbox2::testcase_print_fds
|
||||||
)
|
)
|
||||||
target_link_libraries(policybuilder_test PRIVATE
|
target_link_libraries(policybuilder_test PRIVATE
|
||||||
absl::memory
|
absl::memory
|
||||||
absl::strings
|
absl::strings
|
||||||
glog::glog
|
glog::glog
|
||||||
|
@ -887,8 +889,9 @@ target_link_libraries(policybuilder_test PRIVATE
|
||||||
sapi::flags
|
sapi::flags
|
||||||
sapi::status_matchers
|
sapi::status_matchers
|
||||||
sapi::test_main
|
sapi::test_main
|
||||||
)
|
)
|
||||||
gtest_discover_tests(policybuilder_test PROPERTIES
|
gtest_discover_tests(policybuilder_test PROPERTIES
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
|
@ -12,8 +12,10 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
add_subdirectory(crc4)
|
if(SAPI_ENABLE_EXAMPLES)
|
||||||
add_subdirectory(custom_fork)
|
add_subdirectory(crc4)
|
||||||
add_subdirectory(static)
|
add_subdirectory(custom_fork)
|
||||||
add_subdirectory(tool)
|
add_subdirectory(static)
|
||||||
add_subdirectory(zlib)
|
add_subdirectory(tool)
|
||||||
|
add_subdirectory(zlib)
|
||||||
|
endif()
|
||||||
|
|
|
@ -34,18 +34,6 @@ target_link_libraries(sandbox2_util_file_helpers PRIVATE
|
||||||
sapi::status
|
sapi::status
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:file_helpers_test
|
|
||||||
add_executable(file_helpers_test
|
|
||||||
file_helpers_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(file_helpers_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::file_helpers
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(file_helpers_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:fileops
|
# sandboxed_api/sandbox2/util:fileops
|
||||||
add_library(sandbox2_util_fileops STATIC
|
add_library(sandbox2_util_fileops STATIC
|
||||||
fileops.cc
|
fileops.cc
|
||||||
|
@ -58,23 +46,6 @@ target_link_libraries(sandbox2_util_fileops PRIVATE
|
||||||
sapi::base
|
sapi::base
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:fileops_test
|
|
||||||
add_executable(fileops_test
|
|
||||||
fileops_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(fileops_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::file_helpers
|
|
||||||
sandbox2::fileops
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(fileops_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:file_base
|
# sandboxed_api/sandbox2/util:file_base
|
||||||
add_library(sandbox2_util_file_base STATIC
|
add_library(sandbox2_util_file_base STATIC
|
||||||
path.cc
|
path.cc
|
||||||
|
@ -86,17 +57,6 @@ target_link_libraries(sandbox2_util_file_base PRIVATE
|
||||||
sapi::base
|
sapi::base
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:file_base_test
|
|
||||||
add_executable(file_base_test
|
|
||||||
path_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(file_base_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::file_base
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(file_base_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:strerror
|
# sandboxed_api/sandbox2/util:strerror
|
||||||
add_library(sandbox2_util_strerror STATIC
|
add_library(sandbox2_util_strerror STATIC
|
||||||
strerror.cc
|
strerror.cc
|
||||||
|
@ -108,17 +68,6 @@ target_link_libraries(sandbox2_util_strerror PRIVATE
|
||||||
sapi::base
|
sapi::base
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:strerror
|
|
||||||
add_executable(strerror_test
|
|
||||||
strerror_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(strerror_test PRIVATE
|
|
||||||
absl::strings
|
|
||||||
sandbox2::strerror
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(strerror_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:minielf
|
# sandboxed_api/sandbox2/util:minielf
|
||||||
add_library(sandbox2_util_minielf STATIC
|
add_library(sandbox2_util_minielf STATIC
|
||||||
minielf.cc
|
minielf.cc
|
||||||
|
@ -134,26 +83,6 @@ target_link_libraries(sandbox2_util_minielf PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:minielf_test
|
|
||||||
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
|
|
||||||
sandbox2::minielf
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(minielf_test PROPERTIES
|
|
||||||
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
||||||
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:temp_file
|
# sandboxed_api/sandbox2/util:temp_file
|
||||||
add_library(sandbox2_util_temp_file STATIC
|
add_library(sandbox2_util_temp_file STATIC
|
||||||
temp_file.cc
|
temp_file.cc
|
||||||
|
@ -169,20 +98,6 @@ target_link_libraries(sandbox2_util_temp_file PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:temp_file_test
|
|
||||||
add_executable(temp_file_test
|
|
||||||
temp_file_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(temp_file_test PRIVATE
|
|
||||||
sandbox2::file_base
|
|
||||||
sandbox2::fileops
|
|
||||||
sandbox2::temp_file
|
|
||||||
sandbox2::testing
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(temp_file_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:maps_parser
|
# sandboxed_api/sandbox2/util:maps_parser
|
||||||
add_library(sandbox2_util_maps_parser STATIC
|
add_library(sandbox2_util_maps_parser STATIC
|
||||||
maps_parser.cc
|
maps_parser.cc
|
||||||
|
@ -196,17 +111,6 @@ target_link_libraries(sandbox2_util_maps_parser PRIVATE
|
||||||
sapi::statusor
|
sapi::statusor
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:maps_parser_test
|
|
||||||
add_executable(maps_parser_test
|
|
||||||
maps_parser_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(maps_parser_test PRIVATE
|
|
||||||
sandbox2::maps_parser
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
)
|
|
||||||
gtest_discover_tests(maps_parser_test)
|
|
||||||
|
|
||||||
# sandboxed_api/sandbox2/util:runfiles
|
# sandboxed_api/sandbox2/util:runfiles
|
||||||
add_library(sandbox2_util_runfiles STATIC
|
add_library(sandbox2_util_runfiles STATIC
|
||||||
runfiles.h
|
runfiles.h
|
||||||
|
@ -221,3 +125,101 @@ target_link_libraries(sandbox2_util_runfiles PRIVATE
|
||||||
sapi::flags
|
sapi::flags
|
||||||
sapi::raw_logging
|
sapi::raw_logging
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(SAPI_ENABLE_TESTS)
|
||||||
|
# sandboxed_api/sandbox2/util:file_helpers_test
|
||||||
|
add_executable(file_helpers_test
|
||||||
|
file_helpers_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(file_helpers_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::file_helpers
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(file_helpers_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:fileops_test
|
||||||
|
add_executable(fileops_test
|
||||||
|
fileops_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(fileops_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::file_helpers
|
||||||
|
sandbox2::fileops
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(fileops_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:file_base_test
|
||||||
|
add_executable(file_base_test
|
||||||
|
path_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(file_base_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::file_base
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(file_base_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:strerror
|
||||||
|
add_executable(strerror_test
|
||||||
|
strerror_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(strerror_test PRIVATE
|
||||||
|
absl::strings
|
||||||
|
sandbox2::strerror
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(strerror_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:minielf_test
|
||||||
|
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
|
||||||
|
sandbox2::minielf
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(minielf_test PROPERTIES
|
||||||
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
||||||
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:temp_file_test
|
||||||
|
add_executable(temp_file_test
|
||||||
|
temp_file_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(temp_file_test PRIVATE
|
||||||
|
sandbox2::file_base
|
||||||
|
sandbox2::fileops
|
||||||
|
sandbox2::temp_file
|
||||||
|
sandbox2::testing
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(temp_file_test)
|
||||||
|
|
||||||
|
# sandboxed_api/sandbox2/util:maps_parser_test
|
||||||
|
add_executable(maps_parser_test
|
||||||
|
maps_parser_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(maps_parser_test PRIVATE
|
||||||
|
sandbox2::maps_parser
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
)
|
||||||
|
gtest_discover_tests(maps_parser_test)
|
||||||
|
endif()
|
||||||
|
|
|
@ -56,31 +56,6 @@ target_link_libraries(sapi_util_statusor PRIVATE
|
||||||
sapi::status
|
sapi::status
|
||||||
)
|
)
|
||||||
|
|
||||||
# sandboxed_api/util:status_matchers
|
|
||||||
add_library(sapi_util_status_matchers STATIC
|
|
||||||
status_matchers.h
|
|
||||||
)
|
|
||||||
add_library(sapi::status_matchers ALIAS sapi_util_status_matchers)
|
|
||||||
target_link_libraries(sapi_util_status_matchers PRIVATE
|
|
||||||
absl::optional
|
|
||||||
gmock
|
|
||||||
gtest
|
|
||||||
sapi::base
|
|
||||||
sapi::status
|
|
||||||
sapi::statusor
|
|
||||||
)
|
|
||||||
|
|
||||||
# sandboxed_api/util:status_test
|
|
||||||
add_executable(status_test
|
|
||||||
status_test.cc
|
|
||||||
)
|
|
||||||
target_link_libraries(status_test PRIVATE
|
|
||||||
sapi::status_matchers
|
|
||||||
sapi::test_main
|
|
||||||
absl::type_traits
|
|
||||||
)
|
|
||||||
gtest_discover_tests(status_test)
|
|
||||||
|
|
||||||
# sandboxed_api/util:flag
|
# sandboxed_api/util:flag
|
||||||
add_library(sapi_util_flags STATIC
|
add_library(sapi_util_flags STATIC
|
||||||
flag.h
|
flag.h
|
||||||
|
@ -103,3 +78,29 @@ target_link_libraries(sapi_util_raw_logging PRIVATE
|
||||||
sapi::base
|
sapi::base
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(SAPI_ENABLE_TESTS)
|
||||||
|
# sandboxed_api/util:status_matchers
|
||||||
|
add_library(sapi_util_status_matchers STATIC
|
||||||
|
status_matchers.h
|
||||||
|
)
|
||||||
|
add_library(sapi::status_matchers ALIAS sapi_util_status_matchers)
|
||||||
|
target_link_libraries(sapi_util_status_matchers PRIVATE
|
||||||
|
absl::optional
|
||||||
|
gmock
|
||||||
|
gtest
|
||||||
|
sapi::base
|
||||||
|
sapi::status
|
||||||
|
sapi::statusor
|
||||||
|
)
|
||||||
|
|
||||||
|
# sandboxed_api/util:status_test
|
||||||
|
add_executable(status_test
|
||||||
|
status_test.cc
|
||||||
|
)
|
||||||
|
target_link_libraries(status_test PRIVATE
|
||||||
|
sapi::status_matchers
|
||||||
|
sapi::test_main
|
||||||
|
absl::type_traits
|
||||||
|
)
|
||||||
|
gtest_discover_tests(status_test)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user