summaryrefslogtreecommitdiffstats
path: root/sandbox/src/SConscript
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/src/SConscript')
-rw-r--r--sandbox/src/SConscript326
1 files changed, 326 insertions, 0 deletions
diff --git a/sandbox/src/SConscript b/sandbox/src/SConscript
new file mode 100644
index 0000000..8c4e774
--- /dev/null
+++ b/sandbox/src/SConscript
@@ -0,0 +1,326 @@
+# Copyright 2008, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Import('env')
+
+env = env.Clone()
+
+env.Prepend(
+ CPPPATH = [
+ '../..',
+ ],
+)
+
+# Some of the sandbox sources include "gtest.h", so we need it
+# in the base env here, not just in env_tests.
+env.Append(
+ CPPPATH = [
+ '$GTEST_DIR/include',
+ ],
+)
+
+env.Append(
+ CCFLAGS = [
+ '/TP',
+ '/WX', # treat warnings as errors
+ '/Wp64', # warn about potential 64-bit problems
+ '/wd4503',
+ '/wd4819',
+ ],
+ CPPDEFINES = [
+ 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
+ 'WIN32_LEAN_AND_MEAN',
+ ],
+)
+
+env_tests = env.Clone(
+ TESTS_DIR = '../tests',
+ INTEGRATION_TESTS_DIR = '$TESTS_DIR/integration_tests',
+ UNIT_TESTS_DIR = '$TESTS_DIR/unit_tests',
+ VALIDATION_TESTS_DIR = '$TESTS_DIR/validation_tests',
+)
+
+
+input_files = [
+ 'Wow64.cc',
+ 'acl.cc',
+ 'broker_services.cc',
+ 'crosscall_server.cc',
+ 'dep.cc',
+ 'eat_resolver.cc',
+ 'filesystem_dispatcher.cc',
+ 'filesystem_interception.cc',
+ 'filesystem_policy.cc',
+ 'interception.cc',
+ 'interception_agent.cc',
+ 'job.cc',
+ 'named_pipe_dispatcher.cc',
+ 'named_pipe_interception.cc',
+ 'named_pipe_policy.cc',
+ 'pe_image.cc',
+ 'policy_broker.cc',
+ 'policy_engine_opcodes.cc',
+ 'policy_engine_processor.cc',
+ 'policy_low_level.cc',
+ 'policy_target.cc',
+ 'process_thread_dispatcher.cc',
+ 'process_thread_interception.cc',
+ 'process_thread_policy.cc',
+ 'registry_dispatcher.cc',
+ 'registry_interception.cc',
+ 'registry_policy.cc',
+ 'resolver.cc',
+ 'restricted_token.cc',
+ 'restricted_token_utils.cc',
+ 'sandbox.cc',
+ 'sandbox_nt_util.cc',
+ 'sandbox_policy_base.cc',
+ 'sandbox_utils.cc',
+ 'service_resolver.cc',
+ 'shared_handles.cc',
+ 'sharedmem_ipc_client.cc',
+ 'sharedmem_ipc_server.cc',
+ 'sid.cc',
+ 'sidestep/ia32_modrm_map.cpp',
+ 'sidestep/ia32_opcode_map.cpp',
+ 'sidestep/mini_disassembler.cpp',
+ 'sidestep/preamble_patcher_with_stub.cpp',
+ 'sidestep_resolver.cc',
+ 'sync_dispatcher.cc',
+ 'sync_interception.cc',
+ 'sync_policy.cc',
+ 'target_interceptions.cc',
+ 'target_process.cc',
+ 'target_services.cc',
+ 'win2k_threadpool.cc',
+ 'win_utils.cc',
+]
+
+
+# TODO(bradnelson): This step generates sandbox.pch.ib_tag
+# SCons doesn't know.
+env_p = env.Clone()
+env_p.Append(CCFLAGS='/Ylsandbox')
+pch, obj = env_p.PCH(['sandbox.pch', 'stdafx.obj'], 'stdafx.cc')
+env['PCH'] = pch
+env['PCHSTOP'] = 'stdafx.h'
+env.Append(CCPCHFLAGS = ['/FIstdafx.h'])
+
+
+env.StaticLibrary('sandbox', input_files + [obj])
+
+
+env_tests.Prepend(
+ LINKFLAGS = [
+ '/DELAYLOAD:dwmapi.dll',
+ '/DELAYLOAD:uxtheme.dll',
+ '/MACHINE:X86',
+ '/FIXED:No',
+ '/safeseh',
+ '/dynamicbase',
+ '/ignore:4199',
+ '/nxcompat',
+ ],
+ LIBS = [
+ # System libraries.
+ 'DelayImp.lib',
+ 'advapi32.lib',
+ 'comdlg32.lib',
+ 'gdi32.lib',
+ 'kernel32.lib',
+ 'msimg32.lib',
+ 'odbc32.lib',
+ 'odbccp32.lib',
+ 'ole32.lib',
+ 'oleaut32.lib',
+ 'psapi.lib',
+ 'shell32.lib',
+ 'user32.lib',
+ 'usp10.lib',
+ 'uuid.lib',
+ 'version.lib',
+ 'wininet.lib',
+ 'winspool.lib',
+ 'ws2_32.lib',
+
+ # Chrome libraries.
+ 'base.lib',
+ 'sandbox.lib',
+ ],
+ LIBPATH = [
+ '.',
+ '$BASE_DIR'
+ ],
+)
+
+controller_obj = env_tests.StaticObject('$TESTS_DIR/common/controller.cc')
+
+extra_libs = ['$TESTING_DIR/gtest.lib']
+
+
+# Unit Tests
+
+env_unit_tests = env_tests.Clone()
+
+unit_test_files = [
+ 'interception_unittest.cc',
+ 'ipc_unittest.cc',
+ 'job_unittest.cc',
+ 'pe_image_unittest.cc',
+ 'policy_engine_unittest.cc',
+ 'policy_low_level_unittest.cc',
+ 'policy_opcodes_unittest.cc',
+ 'restricted_token_unittest.cc',
+ 'service_resolver_unittest.cc',
+ 'sid_unittest.cc',
+ 'threadpool_unittest.cc',
+
+ '$UNIT_TESTS_DIR/unit_tests$OBJSUFFIX',
+ # The VisualStudio build link with the old gtest.obj file directly,
+ # although we no longer remember why. Since we're linking with all
+ # of gtest.lib now, this shouldn't be necessary (hey, the unit tests
+ # all pass!), but we're leaving this here, commented out, just in case.
+ #'$GTEST_DIR/src/gtest$OBJSUFFIX',
+ controller_obj,
+]
+
+
+# TODO(bradnelson): This step generates unittests_tests.pch.ib_tag
+# SCons doesn't know.
+env_p = env_unit_tests.Clone()
+pch, obj = env_p.PCH(['$UNIT_TESTS_DIR/unit_tests.pch',
+ '$UNIT_TESTS_DIR/unit_tests.obj'],
+ '$UNIT_TESTS_DIR/unit_tests.cc')
+env_unit_tests['PCH'] = pch
+env_unit_tests['PCHSTOP'] = 'stdafx.h'
+env_unit_tests.Append(CCPCHFLAGS = ['/FIstdafx.h'])
+
+
+unit_tests = env_unit_tests.Program(
+ ['../sandbox_unit_tests.exe',
+ '../sandbox_unit_tests.ilk',
+ '../sandbox_unit_tests.pdb'],
+ unit_test_files + extra_libs,
+)
+
+
+# Integration Tests
+
+env_integration_tests = env_tests.Clone()
+
+integration_test_files = [
+ '$INTEGRATION_TESTS_DIR/integration_tests_test.cc',
+# 'dep_test.cc',
+ 'file_policy_test.cc',
+ 'integrity_level_test.cc',
+ 'ipc_ping_test.cc',
+ 'named_pipe_policy_test.cc',
+ 'policy_target_test.cc',
+ 'process_policy_test.cc',
+ 'registry_policy_test.cc',
+ 'sync_policy_test.cc',
+
+ '$INTEGRATION_TESTS_DIR/integration_tests$OBJSUFFIX',
+ # The VisualStudio build link with the old gtest.obj file directly,
+ # although we no longer remember why. Since we're linking with all
+ # of gtest.lib now, this shouldn't be necessary (hey, the unit tests
+ # all pass!), but we're leaving this here, commented out, just in case.
+ #'$GTEST_DIR/src/gtest$OBJSUFFIX',
+ controller_obj,
+]
+
+
+# TODO(bradnelson): This step generates integration_tests.pch.ib_tag
+# SCons doesn't know.
+env_p = env_integration_tests.Clone()
+pch, obj = env_p.PCH(['$INTEGRATION_TESTS_DIR/integration_tests.pch',
+ '$INTEGRATION_TESTS_DIR/integration_tests.obj'],
+ '$INTEGRATION_TESTS_DIR/integration_tests.cc')
+env_integration_tests['PCH'] = pch
+env_integration_tests['PCHSTOP'] = 'stdafx.h'
+env_integration_tests.Append(CCPCHFLAGS = ['/FIstdafx.h'])
+
+integration_tests = env_integration_tests.Program(
+ ['../integration_tests.exe',
+ '../integration_tests.ilk',
+ '../integration_tests.lib',
+ '../integration_tests.exp',
+ '../integration_tests.pdb'],
+ integration_test_files + extra_libs,
+)
+
+
+# Validation Tests #
+
+env_validation_tests = env_tests.Clone()
+
+env_validation_tests.Prepend(LIBS=['shlwapi.lib'])
+
+validation_test_files = [
+ '$VALIDATION_TESTS_DIR/suite.cc',
+ '$VALIDATION_TESTS_DIR/commands.cc',
+ '$VALIDATION_TESTS_DIR/unit_tests$OBJSUFFIX',
+ # The VisualStudio build link with the old gtest.obj file directly,
+ # although we no longer remember why. Since we're linking with all
+ # of gtest.lib now, this shouldn't be necessary (hey, the unit tests
+ # all pass!), but we're leaving this here, commented out, just in case.
+ #'$GTEST_DIR/src/gtest$OBJSUFFIX',
+ controller_obj,
+]
+
+env_p = env_validation_tests.Clone()
+
+# TODO(bradnelson): This step generates unittests_tests.pch.ib_tag
+# SCons doesn't know.
+pch, obj = env_p.PCH(['$VALIDATION_TESTS_DIR/unit_tests.pch',
+ '$VALIDATION_TESTS_DIR/unit_tests.obj'],
+ '$VALIDATION_TESTS_DIR/unit_tests.cc')
+env_validation_tests['PCH'] = pch
+env_validation_tests['PCHSTOP'] = 'stdafx.h'
+env_validation_tests.Append(CCPCHFLAGS = ['/FIstdafx.h'])
+
+validation_tests = env_validation_tests.Program(
+ ['../validation_tests.exe',
+ '../validation_tests.ilk',
+ '../validation_tests.lib',
+ '../validation_tests.exp',
+ '../validation_tests.pdb'],
+ validation_test_files + extra_libs,
+)
+
+
+# Install tests to a path where they can find their inputs.
+installed_tests = env.Install('$OBJ_ROOT',
+ unit_tests + validation_tests + integration_tests)
+
+
+# Setup alias for sandbox related targets.
+env.Alias('sandbox', ['.', installed_tests])
+
+