summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/external-cross-compile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /third_party/python/gyp/test/external-cross-compile
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/gyp/test/external-cross-compile')
-rwxr-xr-xthird_party/python/gyp/test/external-cross-compile/gyptest-cross.py31
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/bogus1.cc1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/bogus2.c1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/cross.gyp83
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/cross_compile.gypi23
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/fake_cross.py18
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/program.cc16
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/test1.cc1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/test2.c1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/test3.cc1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/test4.c1
-rw-r--r--third_party/python/gyp/test/external-cross-compile/src/tochar.py13
12 files changed, 190 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/external-cross-compile/gyptest-cross.py b/third_party/python/gyp/test/external-cross-compile/gyptest-cross.py
new file mode 100755
index 0000000000..a837ec57dc
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/gyptest-cross.py
@@ -0,0 +1,31 @@
+#!/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 that actions can be + a source scanner can be used to implement,
+cross-compiles (for Native Client at this point).
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp()
+
+test.run_gyp('cross.gyp', chdir='src')
+
+test.relocate('src', 'relocate/src')
+
+test.build('cross.gyp', test.ALL, chdir='relocate/src')
+
+expect = """\
+From test1.cc
+From test2.c
+From test3.cc
+From test4.c
+"""
+test.run_built_executable('program', chdir='relocate/src', stdout=expect)
+
+
+test.pass_test()
diff --git a/third_party/python/gyp/test/external-cross-compile/src/bogus1.cc b/third_party/python/gyp/test/external-cross-compile/src/bogus1.cc
new file mode 100644
index 0000000000..1b8d01199b
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/bogus1.cc
@@ -0,0 +1 @@
+From bogus1.cc
diff --git a/third_party/python/gyp/test/external-cross-compile/src/bogus2.c b/third_party/python/gyp/test/external-cross-compile/src/bogus2.c
new file mode 100644
index 0000000000..cbf4a123c4
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/bogus2.c
@@ -0,0 +1 @@
+From bogus2.c
diff --git a/third_party/python/gyp/test/external-cross-compile/src/cross.gyp b/third_party/python/gyp/test/external-cross-compile/src/cross.gyp
new file mode 100644
index 0000000000..aeda76b5bd
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/cross.gyp
@@ -0,0 +1,83 @@
+# 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.
+
+{
+ 'includes': ['cross_compile.gypi'],
+ 'target_defaults': {
+ 'variables': {
+ 'nix_lame%': 0,
+ },
+ 'target_conditions': [
+ ['nix_lame==1', {
+ 'sources/': [
+ ['exclude', 'lame'],
+ ],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': [
+ 'program_inc',
+ ],
+ 'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)',
+ ],
+ 'sources': [
+ 'program.cc',
+ ],
+ },
+ {
+ 'target_name': 'program_inc',
+ 'type': 'none',
+ 'dependencies': ['cross_program'],
+ 'actions': [
+ {
+ 'action_name': 'program_inc',
+ 'inputs': ['<(SHARED_INTERMEDIATE_DIR)/cross_program.fake'],
+ 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/cross_program.h'],
+ 'action': ['python', 'tochar.py', '<@(_inputs)', '<@(_outputs)'],
+ },
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ {
+ 'target_name': 'cross_program',
+ 'type': 'none',
+ 'variables': {
+ 'cross': 1,
+ 'nix_lame': 1,
+ },
+ 'dependencies': ['cross_lib'],
+ 'sources': [
+ 'test1.cc',
+ 'test2.c',
+ 'very_lame.cc',
+ '<(SHARED_INTERMEDIATE_DIR)/cross_lib.fake',
+ ],
+ },
+ {
+ 'target_name': 'cross_lib',
+ 'type': 'none',
+ 'variables': {
+ 'cross': 1,
+ 'nix_lame': 1,
+ },
+ 'sources': [
+ 'test3.cc',
+ 'test4.c',
+ 'bogus1.cc',
+ 'bogus2.c',
+ 'sort_of_lame.cc',
+ ],
+ 'sources!': [
+ 'bogus1.cc',
+ 'bogus2.c',
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/external-cross-compile/src/cross_compile.gypi b/third_party/python/gyp/test/external-cross-compile/src/cross_compile.gypi
new file mode 100644
index 0000000000..36e651903f
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/cross_compile.gypi
@@ -0,0 +1,23 @@
+{
+ 'target_defaults': {
+ 'variables': {
+ 'cross%': 0,
+ },
+ 'target_conditions': [
+ ['cross==1', {
+ 'actions': [
+ {
+ 'action_name': 'cross compile >(_target_name)',
+ 'inputs': ['^@(_sources)'],
+ 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/>(_target_name).fake'],
+ 'action': [
+ 'python', 'fake_cross.py', '>@(_outputs)', '^@(_sources)',
+ ],
+ # Allows the test to run without hermetic cygwin on windows.
+ 'msvs_cygwin_shell': 0,
+ },
+ ],
+ }],
+ ],
+ },
+}
diff --git a/third_party/python/gyp/test/external-cross-compile/src/fake_cross.py b/third_party/python/gyp/test/external-cross-compile/src/fake_cross.py
new file mode 100644
index 0000000000..05eacc6a63
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/fake_cross.py
@@ -0,0 +1,18 @@
+#!/usr/bin/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.
+
+import sys
+
+fh = open(sys.argv[1], 'w')
+
+filenames = sys.argv[2:]
+
+for filename in filenames:
+ subfile = open(filename)
+ data = subfile.read()
+ subfile.close()
+ fh.write(data)
+
+fh.close()
diff --git a/third_party/python/gyp/test/external-cross-compile/src/program.cc b/third_party/python/gyp/test/external-cross-compile/src/program.cc
new file mode 100644
index 0000000000..5172ae90fe
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/program.cc
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+
+static char data[] = {
+#include "cross_program.h"
+};
+
+int main(void) {
+ fwrite(data, 1, sizeof(data), stdout);
+ return 0;
+}
diff --git a/third_party/python/gyp/test/external-cross-compile/src/test1.cc b/third_party/python/gyp/test/external-cross-compile/src/test1.cc
new file mode 100644
index 0000000000..b584c31d15
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/test1.cc
@@ -0,0 +1 @@
+From test1.cc
diff --git a/third_party/python/gyp/test/external-cross-compile/src/test2.c b/third_party/python/gyp/test/external-cross-compile/src/test2.c
new file mode 100644
index 0000000000..367ae19ea0
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/test2.c
@@ -0,0 +1 @@
+From test2.c
diff --git a/third_party/python/gyp/test/external-cross-compile/src/test3.cc b/third_party/python/gyp/test/external-cross-compile/src/test3.cc
new file mode 100644
index 0000000000..9eb64735b8
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/test3.cc
@@ -0,0 +1 @@
+From test3.cc
diff --git a/third_party/python/gyp/test/external-cross-compile/src/test4.c b/third_party/python/gyp/test/external-cross-compile/src/test4.c
new file mode 100644
index 0000000000..8ecc33ec16
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/test4.c
@@ -0,0 +1 @@
+From test4.c
diff --git a/third_party/python/gyp/test/external-cross-compile/src/tochar.py b/third_party/python/gyp/test/external-cross-compile/src/tochar.py
new file mode 100644
index 0000000000..c0780d984f
--- /dev/null
+++ b/third_party/python/gyp/test/external-cross-compile/src/tochar.py
@@ -0,0 +1,13 @@
+#!/usr/bin/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.
+
+import sys
+
+src = open(sys.argv[1])
+dst = open(sys.argv[2], 'w')
+for ch in src.read():
+ dst.write('%d,\n' % ord(ch))
+src.close()
+dst.close()