# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'variables': {
    'chromium_code': 1,
  },
  'targets': [
    {
      'target_name': 'seccomp_sandbox',
      'type': 'static_library',
      'sources': [
        'access.cc',
        'allocator.cc',
        'allocator.h',
        'clone.cc',
        'exit.cc',
        'debug.cc',
        'getpid.cc',
        'gettid.cc',
        'ioctl.cc',
        'ipc.cc',
        'library.cc',
        'library.h',
        'linux_syscall_support.h',
        'madvise.cc',
        'maps.cc',
        'maps.h',
        'mmap.cc',
        'mprotect.cc',
        'munmap.cc',
        'mutex.h',
        'open.cc',
        'sandbox.cc',
        'sandbox.h',
        'sandbox_impl.h',
        'securemem.cc',
        'securemem.h',
        'sigaction.cc',
        'sigprocmask.cc',
        'socketcall.cc',
        'stat.cc',
        'syscall.cc',
        'syscall.h',
        'syscall_table.c',
        'syscall_table.h',
        'tls.h',
        'trusted_process.cc',
        'trusted_thread.cc',
        'x86_decode.cc',
        'x86_decode.h',
      ],
    },
    {
      'target_name': 'timestats',
      'type': 'executable',
      'sources': [
        'timestats.cc',
      ],
    },
  ],
}

@@ -203,21 +203,92 @@
 de': 1,%0A
+    'seccomp_intermediate_dir': '%3C(INTERMEDIATE_DIR)/seccomp-sandbox',%0A
   %7D,%0A
-
   'targe
@@ -832,24 +832,63 @@
  'open.cc',%0A
+        'reference_trusted_thread.cc',%0A
         'san
@@ -1279,24 +1279,24 @@
 decode.cc',%0A
-
         'x86
@@ -1325,24 +1325,732 @@
    %7D,%0A    %7B%0A
+      'target_name': 'seccomp_tests',%0A      'type': 'executable',%0A      'sources': %5B%0A        'tests/test_syscalls.cc',%0A      %5D,%0A      'include_dirs': %5B%0A         '.',%0A         '%3C(seccomp_intermediate_dir)',%0A      %5D,%0A      'dependencies': %5B%0A        'seccomp_sandbox',%0A      %5D,%0A      'libraries': %5B%0A        '-lpthread',%0A        '-lutil', # For openpty()%0A      %5D,%0A      'actions': %5B%0A        %7B%0A          'action_name': 'make_test_list',%0A          'inputs': %5B%0A            'tests/list_tests.py',%0A            'tests/test_syscalls.cc',%0A          %5D,%0A          'outputs': %5B'%3C(seccomp_intermediate_dir)/test-list.h'%5D,%0A          'action': %5B'sh', '-c', 'python %3C(_inputs) %3E %3C(_outputs)'%5D,%0A        %7D,%0A      %5D,%0A    %7D,%0A    %7B%0A
       'targe

Add Gyp rules for building the test suite