| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
| 6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
| 7 | 7 |
| 8 declare_args() { | 8 declare_args() { |
| 9 compile_suid_client = is_linux | 9 compile_suid_client = is_linux |
| 10 | 10 |
| 11 compile_credentials = is_linux | 11 compile_credentials = is_linux |
| 12 | 12 |
| 13 compile_seccomp_bpf_demo = | 13 # On Android, use plain GTest. |
| 14 is_linux && (current_cpu == "x86" || current_cpu == "x64") | 14 use_base_test_suite = is_linux |
| 15 } | 15 } |
| 16 | 16 |
| 17 # We have two principal targets: sandbox and sandbox_linux_unittests | 17 # We have two principal targets: sandbox and sandbox_linux_unittests |
| 18 # All other targets are listed as dependencies. | 18 # All other targets are listed as dependencies. |
| 19 # There is one notable exception: for historical reasons, chrome_sandbox is | 19 # There is one notable exception: for historical reasons, chrome_sandbox is |
| 20 # the setuid sandbox and is its own target. | 20 # the setuid sandbox and is its own target. |
| 21 | 21 |
| 22 group("sandbox") { | 22 group("sandbox") { |
| 23 deps = [ | 23 deps = [ |
| 24 ":sandbox_services", | 24 ":sandbox_services", |
| (...skipping 29 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 if (use_seccomp_bpf) { | 55 if (use_seccomp_bpf) { |
| 56 sources += [ | 56 sources += [ |
| 57 "seccomp-bpf/bpf_tester_compatibility_delegate.h", | 57 "seccomp-bpf/bpf_tester_compatibility_delegate.h", |
| 58 "seccomp-bpf/bpf_tests.h", | 58 "seccomp-bpf/bpf_tests.h", |
| 59 "seccomp-bpf/sandbox_bpf_test_runner.cc", | 59 "seccomp-bpf/sandbox_bpf_test_runner.cc", |
| 60 "seccomp-bpf/sandbox_bpf_test_runner.h", | 60 "seccomp-bpf/sandbox_bpf_test_runner.h", |
| 61 ] | 61 ] |
| 62 deps += [ ":seccomp_bpf" ] | 62 deps += [ ":seccomp_bpf" ] |
| 63 } | 63 } |
| 64 |
| 65 if (use_base_test_suite) { |
| 66 deps += [ "//base/test:test_support" ] |
| 67 defines = [ "SANDBOX_USES_BASE_TEST_SUITE" ] |
| 68 } |
| 64 } | 69 } |
| 65 | 70 |
| 66 # Sources shared by sandbox_linux_unittests and sandbox_linux_jni_unittests. | 71 # Sources shared by sandbox_linux_unittests and sandbox_linux_jni_unittests. |
| 67 source_set("sandbox_linux_unittests_sources") { | 72 source_set("sandbox_linux_unittests_sources") { |
| 68 testonly = true | 73 testonly = true |
| 69 | 74 |
| 70 sources = [ | 75 sources = [ |
| 71 "services/proc_util_unittest.cc", | 76 "services/proc_util_unittest.cc", |
| 72 "services/resource_limits_unittests.cc", | 77 "services/resource_limits_unittests.cc", |
| 73 "services/scoped_process_unittest.cc", | 78 "services/scoped_process_unittest.cc", |
| 74 "services/syscall_wrappers_unittest.cc", | 79 "services/syscall_wrappers_unittest.cc", |
| 75 "services/thread_helpers_unittests.cc", | 80 "services/thread_helpers_unittests.cc", |
| 76 "services/yama_unittests.cc", | 81 "services/yama_unittests.cc", |
| 77 "syscall_broker/broker_file_permission_unittest.cc", | 82 "syscall_broker/broker_file_permission_unittest.cc", |
| 78 "syscall_broker/broker_process_unittest.cc", | 83 "syscall_broker/broker_process_unittest.cc", |
| 79 "tests/main.cc", | 84 "tests/main.cc", |
| 80 "tests/scoped_temporary_file.cc", | 85 "tests/scoped_temporary_file.cc", |
| 81 "tests/scoped_temporary_file.h", | 86 "tests/scoped_temporary_file.h", |
| 82 "tests/scoped_temporary_file_unittest.cc", | 87 "tests/scoped_temporary_file_unittest.cc", |
| 83 "tests/test_utils_unittest.cc", | 88 "tests/test_utils_unittest.cc", |
| 84 "tests/unit_tests_unittest.cc", | 89 "tests/unit_tests_unittest.cc", |
| 85 ] | 90 ] |
| 86 | 91 |
| 87 deps = [ | 92 deps = [ |
| 88 ":sandbox", | 93 ":sandbox", |
| 89 ":sandbox_linux_test_utils", | 94 ":sandbox_linux_test_utils", |
| 90 "//base", | 95 "//base", |
| 91 "//base/test:test_support", | |
| 92 "//testing/gtest", | 96 "//testing/gtest", |
| 93 ] | 97 ] |
| 94 | 98 |
| 99 if (use_base_test_suite) { |
| 100 deps += [ "//base/test:test_support" ] |
| 101 defines = [ "SANDBOX_USES_BASE_TEST_SUITE" ] |
| 102 } |
| 103 |
| 95 if (is_linux) { | 104 if (is_linux) { |
| 96 # Don't use this on Android. | 105 # Don't use this on Android. |
| 97 libs = [ "rt" ] | 106 libs = [ "rt" ] |
| 98 } | 107 } |
| 99 | 108 |
| 100 if (compile_suid_client) { | 109 if (compile_suid_client) { |
| 101 sources += [ | 110 sources += [ |
| 102 "suid/client/setuid_sandbox_client_unittest.cc", | 111 "suid/client/setuid_sandbox_client_unittest.cc", |
| 103 "suid/client/setuid_sandbox_host_unittest.cc", | 112 "suid/client/setuid_sandbox_host_unittest.cc", |
| 104 ] | 113 ] |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 "seccomp-bpf/errorcode_unittest.cc", | 126 "seccomp-bpf/errorcode_unittest.cc", |
| 118 "seccomp-bpf/sandbox_bpf_unittest.cc", | 127 "seccomp-bpf/sandbox_bpf_unittest.cc", |
| 119 "seccomp-bpf/syscall_unittest.cc", | 128 "seccomp-bpf/syscall_unittest.cc", |
| 120 "seccomp-bpf/trap_unittest.cc", | 129 "seccomp-bpf/trap_unittest.cc", |
| 121 ] | 130 ] |
| 122 } | 131 } |
| 123 if (compile_credentials) { | 132 if (compile_credentials) { |
| 124 sources += [ | 133 sources += [ |
| 125 "integration_tests/namespace_unix_domain_socket_unittest.cc", | 134 "integration_tests/namespace_unix_domain_socket_unittest.cc", |
| 126 "services/credentials_unittest.cc", | 135 "services/credentials_unittest.cc", |
| 127 "services/namespace_sandbox_unittest.cc", | |
| 128 "services/namespace_utils_unittest.cc", | 136 "services/namespace_utils_unittest.cc", |
| 129 ] | 137 ] |
| 130 | 138 |
| 139 if (use_base_test_suite) { |
| 140 # Tests that use advanced features not available in stock GTest. |
| 141 sources += [ "services/namespace_sandbox_unittest.cc" ] |
| 142 } |
| 143 |
| 131 # For credentials_unittest.cc | 144 # For credentials_unittest.cc |
| 132 configs += [ "//build/config/linux:libcap" ] | 145 configs += [ "//build/config/linux:libcap" ] |
| 133 } | 146 } |
| 134 } | 147 } |
| 135 | 148 |
| 136 # The main sandboxing test target. | 149 # The main sandboxing test target. |
| 137 test("sandbox_linux_unittests") { | 150 test("sandbox_linux_unittests") { |
| 138 deps = [ | 151 deps = [ |
| 139 ":sandbox_linux_unittests_sources", | 152 ":sandbox_linux_unittests_sources", |
| 140 ] | 153 ] |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 # 'type': 'none', | 372 # 'type': 'none', |
| 360 # 'variables': { | 373 # 'variables': { |
| 361 # 'test_suite_name': 'sandbox_linux_jni_unittests', | 374 # 'test_suite_name': 'sandbox_linux_jni_unittests', |
| 362 # }, | 375 # }, |
| 363 # 'dependencies': [ | 376 # 'dependencies': [ |
| 364 # 'sandbox_linux_jni_unittests', | 377 # 'sandbox_linux_jni_unittests', |
| 365 # ], | 378 # ], |
| 366 # 'includes': [ '../../build/apk_test.gypi' ], | 379 # 'includes': [ '../../build/apk_test.gypi' ], |
| 367 # } | 380 # } |
| 368 } | 381 } |
| OLD | NEW |