summaryrefslogtreecommitdiff
path: root/test/android
diff options
context:
space:
mode:
Diffstat (limited to 'test/android')
-rw-r--r--test/android/32or64.c13
-rwxr-xr-xtest/android/gyptest-host-multilib.py32
-rwxr-xr-xtest/android/gyptest-settings-list.py24
-rwxr-xr-xtest/android/gyptest-settings.py24
-rw-r--r--test/android/host_32or64.gyp38
-rw-r--r--test/android/settings-list.gyp18
-rw-r--r--test/android/settings.gyp18
-rw-r--r--test/android/writefile.c18
8 files changed, 185 insertions, 0 deletions
diff --git a/test/android/32or64.c b/test/android/32or64.c
new file mode 100644
index 00000000..3ea81692
--- /dev/null
+++ b/test/android/32or64.c
@@ -0,0 +1,13 @@
+/* Copyright (c) 2014 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.
+ */
+
+const char* getString()
+{
+#ifdef __LP64__
+ return "Hello, 64-bit world!\n";
+#else
+ return "Hello, 32-bit world!\n";
+#endif
+}
diff --git a/test/android/gyptest-host-multilib.py b/test/android/gyptest-host-multilib.py
new file mode 100755
index 00000000..4fb79195
--- /dev/null
+++ b/test/android/gyptest-host-multilib.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 it's possible to build host targets correctly in a multilib
+configuration, explicitly forcing either 32 or 64 bit.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['android'])
+
+test.run_gyp('host_32or64.gyp')
+
+# Force building as 32-bit
+test.build('host_32or64.gyp', 'generate_output',
+ arguments=['GYP_HOST_VAR_PREFIX=$(HOST_2ND_ARCH_VAR_PREFIX)',
+ 'GYP_HOST_MULTILIB=32'])
+
+test.built_file_must_match('host_32or64.output', 'Hello, 32-bit world!\n')
+
+# Force building as 64-bit
+test.build('host_32or64.gyp', 'generate_output',
+ arguments=['GYP_HOST_VAR_PREFIX=',
+ 'GYP_HOST_MULTILIB=64'])
+
+test.built_file_must_match('host_32or64.output', 'Hello, 64-bit world!\n')
+
+test.pass_test()
diff --git a/test/android/gyptest-settings-list.py b/test/android/gyptest-settings-list.py
new file mode 100755
index 00000000..5850d47a
--- /dev/null
+++ b/test/android/gyptest-settings-list.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 it's possible to set Android build system settings using the
+aosp_build_settings key, with list values.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['android'])
+
+test.run_gyp('settings-list.gyp')
+
+test.build('settings-list.gyp', 'hello')
+
+test.run_built_executable('hello.foo', stdout="Hello, world!\n")
+
+test.up_to_date('settings-list.gyp', test.DEFAULT)
+
+test.pass_test()
diff --git a/test/android/gyptest-settings.py b/test/android/gyptest-settings.py
new file mode 100755
index 00000000..f4e89d1b
--- /dev/null
+++ b/test/android/gyptest-settings.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2014 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 it's possible to set Android build system settings using the
+aosp_build_settings key.
+"""
+
+import TestGyp
+
+test = TestGyp.TestGyp(formats=['android'])
+
+test.run_gyp('settings.gyp')
+
+test.build('settings.gyp', 'hello')
+
+test.run_built_executable('hello.foo', stdout="Hello, world!\n")
+
+test.up_to_date('settings.gyp', test.DEFAULT)
+
+test.pass_test()
diff --git a/test/android/host_32or64.gyp b/test/android/host_32or64.gyp
new file mode 100644
index 00000000..e8ca79f5
--- /dev/null
+++ b/test/android/host_32or64.gyp
@@ -0,0 +1,38 @@
+# Copyright (c) 2014 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': 'lib32or64',
+ 'type': 'static_library',
+ 'toolsets': [ 'host' ],
+ 'sources': [
+ '32or64.c',
+ ],
+ },
+ {
+ 'target_name': 'host_32or64',
+ 'type': 'executable',
+ 'toolsets': [ 'host' ],
+ 'dependencies': [ 'lib32or64#host' ],
+ 'sources': [
+ 'writefile.c',
+ ],
+ },
+ {
+ 'target_name': 'generate_output',
+ 'type': 'none',
+ 'dependencies': [ 'host_32or64#host' ],
+ 'actions': [
+ {
+ 'action_name': 'generate',
+ 'inputs': [ '<(PRODUCT_DIR)/host_32or64' ],
+ 'outputs': [ '<(PRODUCT_DIR)/host_32or64.output' ],
+ 'action': [ '<@(_inputs)', '<@(_outputs)' ],
+ }
+ ],
+ },
+ ],
+}
diff --git a/test/android/settings-list.gyp b/test/android/settings-list.gyp
new file mode 100644
index 00000000..b392ce2b
--- /dev/null
+++ b/test/android/settings-list.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2014 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': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ 'aosp_build_settings': {
+ 'LOCAL_MODULE_SUFFIX': ['.foo'],
+ }
+ },
+ ],
+}
diff --git a/test/android/settings.gyp b/test/android/settings.gyp
new file mode 100644
index 00000000..2f8ce7f5
--- /dev/null
+++ b/test/android/settings.gyp
@@ -0,0 +1,18 @@
+# Copyright (c) 2014 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': 'hello',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.c',
+ ],
+ 'aosp_build_settings': {
+ 'LOCAL_MODULE_SUFFIX': '.foo',
+ }
+ },
+ ],
+}
diff --git a/test/android/writefile.c b/test/android/writefile.c
new file mode 100644
index 00000000..3f5960f8
--- /dev/null
+++ b/test/android/writefile.c
@@ -0,0 +1,18 @@
+/* Copyright (c) 2014 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>
+
+extern const char* getString(void);
+
+int main(int argc, char* argv[])
+{
+ if (argc < 2) return 2;
+ FILE* f = fopen(argv[1], "w");
+ if (f == NULL) return 1;
+ fprintf(f, "%s", getString());
+ fclose(f);
+ return 0;
+}