summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/determinism
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/determinism')
-rw-r--r--third_party/python/gyp/test/determinism/determinism.gyp59
-rw-r--r--third_party/python/gyp/test/determinism/empty-targets.gyp32
-rw-r--r--third_party/python/gyp/test/determinism/gyptest-determinism.py30
-rw-r--r--third_party/python/gyp/test/determinism/gyptest-empty-target-names.py30
-rw-r--r--third_party/python/gyp/test/determinism/gyptest-needed-variables.py30
-rw-r--r--third_party/python/gyp/test/determinism/gyptest-solibs.py37
-rw-r--r--third_party/python/gyp/test/determinism/main.cc5
-rw-r--r--third_party/python/gyp/test/determinism/needed-variables.gyp33
-rw-r--r--third_party/python/gyp/test/determinism/rule.py8
-rw-r--r--third_party/python/gyp/test/determinism/solib.cc8
-rw-r--r--third_party/python/gyp/test/determinism/solibs.gyp32
11 files changed, 304 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/determinism/determinism.gyp b/third_party/python/gyp/test/determinism/determinism.gyp
new file mode 100644
index 0000000000..81346748a1
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/determinism.gyp
@@ -0,0 +1,59 @@
+# 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': 'determinism',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'depfile_action',
+ 'inputs': [
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output.txt',
+ ],
+ 'depfile': 'depfile.d',
+ 'action': [ ]
+ },
+ ],
+ },
+ {
+ 'target_name': 'determinism2',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'depfile_action',
+ 'inputs': [
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output.txt',
+ ],
+ 'depfile': 'depfile.d',
+ 'action': [ ]
+ },
+ ],
+ },
+ {
+ 'target_name': 'determinism3',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'depfile_action',
+ 'inputs': [
+ 'input.txt',
+ ],
+ 'outputs': [
+ 'output.txt',
+ ],
+ 'depfile': 'depfile.d',
+ 'action': [ ]
+ },
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/determinism/empty-targets.gyp b/third_party/python/gyp/test/determinism/empty-targets.gyp
new file mode 100644
index 0000000000..a4ccdd703c
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/empty-targets.gyp
@@ -0,0 +1,32 @@
+# 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': 'empty_target1',
+ 'type': 'none',
+ },
+ {
+ 'target_name': 'empty_target2',
+ 'type': 'none',
+ },
+ {
+ 'target_name': 'empty_target3',
+ 'type': 'none',
+ },
+ {
+ 'target_name': 'empty_target4',
+ 'type': 'none',
+ },
+ {
+ 'target_name': 'empty_target5',
+ 'type': 'none',
+ },
+ {
+ 'target_name': 'empty_target6',
+ 'type': 'none',
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/determinism/gyptest-determinism.py b/third_party/python/gyp/test/determinism/gyptest-determinism.py
new file mode 100644
index 0000000000..670cb4bc9f
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/gyptest-determinism.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies builds are the same even with different PYTHONHASHSEEDs.
+Tests target_short_names and FlattenToList.
+"""
+
+import os
+import sys
+import TestGyp
+
+test = TestGyp.TestGyp()
+if test.format == 'ninja':
+ os.environ["PYTHONHASHSEED"] = "1"
+ test.run_gyp('determinism.gyp')
+ base = open(test.built_file_path('build.ninja')).read()
+
+ for i in range(1,5):
+ os.environ["PYTHONHASHSEED"] = str(i)
+ test.run_gyp('determinism.gyp')
+ contents = open(test.built_file_path('build.ninja')).read()
+ if base != contents:
+ test.fail_test()
+
+ del os.environ["PYTHONHASHSEED"]
+ test.pass_test()
diff --git a/third_party/python/gyp/test/determinism/gyptest-empty-target-names.py b/third_party/python/gyp/test/determinism/gyptest-empty-target-names.py
new file mode 100644
index 0000000000..cf49f50084
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/gyptest-empty-target-names.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies builds are the same even with different PYTHONHASHSEEDs.
+Tests both solibs and implicit_deps.
+"""
+
+import os
+import sys
+import TestGyp
+
+test = TestGyp.TestGyp()
+if test.format == 'ninja':
+ os.environ["PYTHONHASHSEED"] = "1"
+ test.run_gyp('empty-targets.gyp')
+ base = open(test.built_file_path('build.ninja')).read()
+
+ for i in range(1,5):
+ os.environ["PYTHONHASHSEED"] = str(i)
+ test.run_gyp('empty-targets.gyp')
+ contents = open(test.built_file_path('build.ninja')).read()
+ if base != contents:
+ test.fail_test()
+
+ del os.environ["PYTHONHASHSEED"]
+ test.pass_test()
diff --git a/third_party/python/gyp/test/determinism/gyptest-needed-variables.py b/third_party/python/gyp/test/determinism/gyptest-needed-variables.py
new file mode 100644
index 0000000000..7b97cca0d2
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/gyptest-needed-variables.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies builds are the same even with different PYTHONHASHSEEDs.
+Tests needed_variables.
+"""
+
+import os
+import sys
+import TestGyp
+
+test = TestGyp.TestGyp()
+if test.format == 'ninja':
+ os.environ["PYTHONHASHSEED"] = "1"
+ test.run_gyp('needed-variables.gyp')
+ base = open(test.built_file_path('test.ninja', subdir='obj')).read()
+
+ for i in range(1,5):
+ os.environ["PYTHONHASHSEED"] = str(i)
+ test.run_gyp('needed-variables.gyp')
+ contents = open(test.built_file_path('test.ninja', subdir='obj')).read()
+ if base != contents:
+ test.fail_test()
+
+ del os.environ["PYTHONHASHSEED"]
+ test.pass_test()
diff --git a/third_party/python/gyp/test/determinism/gyptest-solibs.py b/third_party/python/gyp/test/determinism/gyptest-solibs.py
new file mode 100644
index 0000000000..a9c312573b
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/gyptest-solibs.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# 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.
+
+"""
+Verifies builds are the same even with different PYTHONHASHSEEDs.
+Tests all_targets, implicit_deps and solibs.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+import TestGyp
+
+test = TestGyp.TestGyp()
+if test.format == 'ninja':
+ os.environ["PYTHONHASHSEED"] = "1"
+ test.run_gyp('solibs.gyp')
+ base1 = open(test.built_file_path('c.ninja', subdir='obj')).read()
+ base2 = open(test.built_file_path('build.ninja')).read()
+
+ for i in range(1,5):
+ os.environ["PYTHONHASHSEED"] = str(i)
+ test.run_gyp('solibs.gyp')
+ contents1 = open(test.built_file_path('c.ninja', subdir='obj')).read()
+ contents2 = open(test.built_file_path('build.ninja')).read()
+ if base1 != contents1:
+ test.fail_test()
+ if base2 != contents2:
+ print(base2)
+ test.fail_test()
+
+ del os.environ["PYTHONHASHSEED"]
+ test.pass_test()
diff --git a/third_party/python/gyp/test/determinism/main.cc b/third_party/python/gyp/test/determinism/main.cc
new file mode 100644
index 0000000000..2cd74d3c77
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/main.cc
@@ -0,0 +1,5 @@
+extern int foo();
+
+int main() {
+ return foo();
+}
diff --git a/third_party/python/gyp/test/determinism/needed-variables.gyp b/third_party/python/gyp/test/determinism/needed-variables.gyp
new file mode 100644
index 0000000000..022165bebd
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/needed-variables.gyp
@@ -0,0 +1,33 @@
+# 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': 'test',
+ 'type': 'executable',
+ 'sources': ['rule.ext'],
+ 'rules': [{
+ 'rule_name': 'rule',
+ 'extension': 'ext',
+ 'inputs': [ 'rule.py', ],
+ 'action': [
+ 'python',
+ 'rule.py',
+ '<(RULE_INPUT_ROOT)',
+ '<(RULE_INPUT_EXT)',
+ '<(RULE_INPUT_DIRNAME)',
+ '<(RULE_INPUT_NAME)',
+ '<(RULE_INPUT_PATH)',
+ ],
+ 'outputs': [ 'hello_world.txt' ],
+ 'sources': ['rule.ext'],
+ 'message': 'Processing <(RULE_INPUT_PATH)',
+ 'process_outputs_as_sources': 1,
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ }],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/determinism/rule.py b/third_party/python/gyp/test/determinism/rule.py
new file mode 100644
index 0000000000..e18c314557
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/rule.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# Copyright (c) 2017 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.
+
+from __future__ import print_function
+
+print('Hello World')
diff --git a/third_party/python/gyp/test/determinism/solib.cc b/third_party/python/gyp/test/determinism/solib.cc
new file mode 100644
index 0000000000..0856cd4e00
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/solib.cc
@@ -0,0 +1,8 @@
+#ifdef _MSC_VER
+__declspec(dllexport)
+#else
+__attribute__((visibility("default")))
+#endif
+int foo() {
+ return 42;
+}
diff --git a/third_party/python/gyp/test/determinism/solibs.gyp b/third_party/python/gyp/test/determinism/solibs.gyp
new file mode 100644
index 0000000000..9ae3246d63
--- /dev/null
+++ b/third_party/python/gyp/test/determinism/solibs.gyp
@@ -0,0 +1,32 @@
+# 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.
+
+# This test both tests solibs and implicit_deps.
+{
+ 'targets': [
+ {
+ 'target_name': 'a',
+ 'type': 'shared_library',
+ 'sources': [ 'solib.cc' ],
+ },
+ {
+ 'target_name': 'b',
+ 'type': 'shared_library',
+ 'sources': [ 'solib.cc' ],
+ },
+ {
+ 'target_name': 'c',
+ 'type': 'executable',
+ 'sources': [ 'main.cc' ],
+ 'dependencies': [ 'a', 'b' ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'target_defaults': {
+ 'cflags': ['-fPIC'],
+ },
+ }],
+ ],
+}