summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/copies
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/copies')
-rwxr-xr-xthird_party/python/gyp/test/copies/gyptest-all.py42
-rw-r--r--third_party/python/gyp/test/copies/gyptest-attribs.py41
-rwxr-xr-xthird_party/python/gyp/test/copies/gyptest-default.py42
-rwxr-xr-xthird_party/python/gyp/test/copies/gyptest-samedir.py28
-rwxr-xr-xthird_party/python/gyp/test/copies/gyptest-slash.py39
-rw-r--r--third_party/python/gyp/test/copies/gyptest-sourceless-shared-lib.py20
-rwxr-xr-xthird_party/python/gyp/test/copies/gyptest-updir.py32
-rw-r--r--third_party/python/gyp/test/copies/src/copies-attribs.gyp20
-rw-r--r--third_party/python/gyp/test/copies/src/copies-samedir.gyp37
-rw-r--r--third_party/python/gyp/test/copies/src/copies-slash.gyp36
-rw-r--r--third_party/python/gyp/test/copies/src/copies-sourceless-shared-lib.gyp27
-rw-r--r--third_party/python/gyp/test/copies/src/copies-updir.gyp21
-rw-r--r--third_party/python/gyp/test/copies/src/copies.gyp70
-rw-r--r--third_party/python/gyp/test/copies/src/directory/file31
-rw-r--r--third_party/python/gyp/test/copies/src/directory/file41
-rw-r--r--third_party/python/gyp/test/copies/src/directory/subdir/file51
-rwxr-xr-xthird_party/python/gyp/test/copies/src/executable-file.sh3
-rw-r--r--third_party/python/gyp/test/copies/src/file11
-rw-r--r--third_party/python/gyp/test/copies/src/file21
-rw-r--r--third_party/python/gyp/test/copies/src/foo.c13
-rw-r--r--third_party/python/gyp/test/copies/src/parentdir/subdir/file61
21 files changed, 477 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/copies/gyptest-all.py b/third_party/python/gyp/test/copies/gyptest-all.py
new file mode 100755
index 0000000000..aeccf3324c
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-all.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using an explicit build target of 'all'.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies.gyp',
+ '-G', 'xcode_ninja_target_pattern=^(?!copies_null)',
+ chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('copies.gyp', test.ALL, chdir='relocate/src')
+
+test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n')
+
+test.built_file_must_match('copies-out/file2',
+ 'file2 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/subdir/file6',
+ 'file6 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-attribs.py b/third_party/python/gyp/test/copies/gyptest-attribs.py
new file mode 100644
index 0000000000..70d717a45e
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-attribs.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies that copying files preserves file attributes.
+"""
+
+import TestGyp
+
+import os
+import stat
+import sys
+
+
+def check_attribs(path, expected_exec_bit):
+ out_path = test.built_file_path(path, chdir='src')
+
+ in_stat = os.stat(os.path.join('src', path))
+ out_stat = os.stat(out_path)
+ if out_stat.st_mode & stat.S_IXUSR != expected_exec_bit:
+ test.fail_test()
+
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies-attribs.gyp', chdir='src')
+
+test.build('copies-attribs.gyp', chdir='src')
+
+if sys.platform != 'win32':
+ out_path = test.built_file_path('executable-file.sh', chdir='src')
+ test.must_contain(out_path,
+ '#!/bin/bash\n'
+ '\n'
+ 'echo echo echo echo cho ho o o\n')
+ check_attribs('executable-file.sh', expected_exec_bit=stat.S_IXUSR)
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-default.py b/third_party/python/gyp/test/copies/gyptest-default.py
new file mode 100755
index 0000000000..a916869f0d
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-default.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies using the build tool default.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('copies.gyp',
+ '-G', 'xcode_ninja_target_pattern=^(?!copies_null)',
+ chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('copies.gyp', chdir='relocate/src')
+
+test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n')
+
+test.built_file_must_match('copies-out/file2',
+ 'file2 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out/subdir/file6',
+ 'file6 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-samedir.py b/third_party/python/gyp/test/copies/gyptest-samedir.py
new file mode 100755
index 0000000000..923ca61557
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-samedir.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies where two copies sections in the same target have the
+same destination directory.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+test.run_gyp('copies-samedir.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+test.build('copies-samedir.gyp', 'copies_samedir', chdir='relocate/src')
+
+test.built_file_must_match('copies-out-samedir/file1',
+ 'file1 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out-samedir/file2',
+ 'file2 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-slash.py b/third_party/python/gyp/test/copies/gyptest-slash.py
new file mode 100755
index 0000000000..f7a2e549eb
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-slash.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies with a trailing slash in the destination directory.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+test.run_gyp('copies-slash.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+test.build('copies-slash.gyp', chdir='relocate/src')
+
+test.built_file_must_match('copies-out-slash/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out-slash/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out-slash/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+
+test.built_file_must_match('copies-out-slash-2/directory/file3',
+ 'file3 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out-slash-2/directory/file4',
+ 'file4 contents\n',
+ chdir='relocate/src')
+test.built_file_must_match('copies-out-slash-2/directory/subdir/file5',
+ 'file5 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-sourceless-shared-lib.py b/third_party/python/gyp/test/copies/gyptest-sourceless-shared-lib.py
new file mode 100644
index 0000000000..6ec2e512ad
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-sourceless-shared-lib.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies copies in sourceless shared_library targets are executed.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+test.run_gyp('copies-sourceless-shared-lib.gyp', chdir='src')
+test.relocate('src', 'relocate/src')
+test.build('copies-sourceless-shared-lib.gyp', chdir='relocate/src')
+test.built_file_must_match('copies-out/file1',
+ 'file1 contents\n',
+ chdir='relocate/src')
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/gyptest-updir.py b/third_party/python/gyp/test/copies/gyptest-updir.py
new file mode 100755
index 0000000000..47a2ca2e1d
--- /dev/null
+++ b/third_party/python/gyp/test/copies/gyptest-updir.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Verifies file copies where the destination is one level above an expansion that
+yields a make variable.
+"""
+
+from __future__ import print_function
+
+import sys
+
+import TestGyp
+
+if sys.platform == 'darwin':
+ print("This test is currently disabled: https://crbug.com/483696.")
+ sys.exit(0)
+
+test = TestGyp.TestGyp()
+test.run_gyp('copies-updir.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+test.build('copies-updir.gyp', 'copies_up', chdir='relocate/src')
+
+test.built_file_must_match('../copies-out-updir/file1',
+ 'file1 contents\n',
+ chdir='relocate/src')
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/copies/src/copies-attribs.gyp b/third_party/python/gyp/test/copies/src/copies-attribs.gyp
new file mode 100644
index 0000000000..073e0d0cf6
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies-attribs.gyp
@@ -0,0 +1,20 @@
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies1',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)',
+ 'files': [
+ 'executable-file.sh',
+ ],
+ },
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/copies/src/copies-samedir.gyp b/third_party/python/gyp/test/copies/src/copies-samedir.gyp
new file mode 100644
index 0000000000..2919ce503e
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies-samedir.gyp
@@ -0,0 +1,37 @@
+# Copyright (c) 2013 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies_samedir',
+ 'type': 'none',
+ 'dependencies': [
+ 'copies_samedir_dependency',
+ ],
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out-samedir',
+ 'files': [
+ 'file1',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'copies_samedir_dependency',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out-samedir',
+ 'files': [
+ 'file2',
+ ],
+ },
+ ],
+ },
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/copies/src/copies-slash.gyp b/third_party/python/gyp/test/copies/src/copies-slash.gyp
new file mode 100644
index 0000000000..9bf54bd181
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies-slash.gyp
@@ -0,0 +1,36 @@
+# Copyright (c) 2011 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ # A trailing slash on the destination directory should be ignored.
+ {
+ 'target_name': 'copies_recursive_trailing_slash',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out-slash/',
+ 'files': [
+ 'directory/',
+ ],
+ },
+ ],
+ },
+ # Even if the source directory is below <(PRODUCT_DIR).
+ {
+ 'target_name': 'copies_recursive_trailing_slash_in_product_dir',
+ 'type': 'none',
+ 'dependencies': [ ':copies_recursive_trailing_slash' ],
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out-slash-2/',
+ 'files': [
+ '<(PRODUCT_DIR)/copies-out-slash/directory/',
+ ],
+ },
+ ],
+ },
+ ],
+}
+
diff --git a/third_party/python/gyp/test/copies/src/copies-sourceless-shared-lib.gyp b/third_party/python/gyp/test/copies/src/copies-sourceless-shared-lib.gyp
new file mode 100644
index 0000000000..7908f716a9
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies-sourceless-shared-lib.gyp
@@ -0,0 +1,27 @@
+# Copyright (c) 2015 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'mylib',
+ 'type': 'static_library',
+ 'sources': [ 'foo.c' ],
+ },
+ {
+ 'target_name': 'mysolib',
+ 'type': 'shared_library',
+ 'dependencies': [ 'mylib' ],
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [ 'file1' ],
+ },
+ ],
+ # link.exe gets confused by sourceless shared libraries and needs this
+ # to become unconfused.
+ 'msvs_settings': { 'VCLinkerTool': { 'TargetMachine': '1', }, },
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/copies/src/copies-updir.gyp b/third_party/python/gyp/test/copies/src/copies-updir.gyp
new file mode 100644
index 0000000000..bd3bfdd1d2
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies-updir.gyp
@@ -0,0 +1,21 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies_up',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/../copies-out-updir',
+ 'files': [
+ 'file1',
+ ],
+ },
+ ],
+ },
+ ],
+}
+
diff --git a/third_party/python/gyp/test/copies/src/copies.gyp b/third_party/python/gyp/test/copies/src/copies.gyp
new file mode 100644
index 0000000000..ce2e0cabca
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/copies.gyp
@@ -0,0 +1,70 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'copies1',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': 'copies-out',
+ 'files': [
+ 'file1',
+ ],
+ },
+ ],
+ },
+ {
+ 'target_name': 'copies2',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'file2',
+ ],
+ },
+ ],
+ },
+ # Copy a directory tree.
+ {
+ 'target_name': 'copies_recursive',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'directory/',
+ ],
+ },
+ ],
+ },
+ # Copy a directory from deeper in the tree (this should not reproduce the
+ # entire directory path in the destination, only the final directory).
+ {
+ 'target_name': 'copies_recursive_depth',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-out',
+ 'files': [
+ 'parentdir/subdir/',
+ ],
+ },
+ ],
+ },
+ # Verify that a null 'files' list doesn't gag the generators.
+ {
+ 'target_name': 'copies_null',
+ 'type': 'none',
+ 'copies': [
+ {
+ 'destination': '<(PRODUCT_DIR)/copies-null',
+ 'files': [],
+ },
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/copies/src/directory/file3 b/third_party/python/gyp/test/copies/src/directory/file3
new file mode 100644
index 0000000000..43f16f3522
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/directory/file3
@@ -0,0 +1 @@
+file3 contents
diff --git a/third_party/python/gyp/test/copies/src/directory/file4 b/third_party/python/gyp/test/copies/src/directory/file4
new file mode 100644
index 0000000000..5f7270a084
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/directory/file4
@@ -0,0 +1 @@
+file4 contents
diff --git a/third_party/python/gyp/test/copies/src/directory/subdir/file5 b/third_party/python/gyp/test/copies/src/directory/subdir/file5
new file mode 100644
index 0000000000..41f47186bd
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/directory/subdir/file5
@@ -0,0 +1 @@
+file5 contents
diff --git a/third_party/python/gyp/test/copies/src/executable-file.sh b/third_party/python/gyp/test/copies/src/executable-file.sh
new file mode 100755
index 0000000000..796953a1a2
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/executable-file.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo echo echo echo cho ho o o
diff --git a/third_party/python/gyp/test/copies/src/file1 b/third_party/python/gyp/test/copies/src/file1
new file mode 100644
index 0000000000..84d55c5759
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/file1
@@ -0,0 +1 @@
+file1 contents
diff --git a/third_party/python/gyp/test/copies/src/file2 b/third_party/python/gyp/test/copies/src/file2
new file mode 100644
index 0000000000..af1b8ae35d
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/file2
@@ -0,0 +1 @@
+file2 contents
diff --git a/third_party/python/gyp/test/copies/src/foo.c b/third_party/python/gyp/test/copies/src/foo.c
new file mode 100644
index 0000000000..99a4c103ba
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/foo.c
@@ -0,0 +1,13 @@
+// Copyright (c) 2015 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+int f() { return 42; }
+
+#ifdef _MSC_VER
+// link.exe gets confused by sourceless shared libraries and needs this
+// to become unconfused.
+int __stdcall _DllMainCRTStartup(
+ unsigned hInst, unsigned reason, void* reserved) {
+ return 1;
+}
+#endif
diff --git a/third_party/python/gyp/test/copies/src/parentdir/subdir/file6 b/third_party/python/gyp/test/copies/src/parentdir/subdir/file6
new file mode 100644
index 0000000000..f5d5757348
--- /dev/null
+++ b/third_party/python/gyp/test/copies/src/parentdir/subdir/file6
@@ -0,0 +1 @@
+file6 contents