Upstream version 9.38.207.0
[platform/framework/web/crosswalk.git] / src / native_client / tests.gyp
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 {
6   ######################################################################
7   'includes': [
8     'build/common.gypi',
9   ],
10   ######################################################################
11   'targets': [
12     {
13       'target_name': 'hello_world_nexe',
14       'type': 'none',
15       'dependencies': [
16         'tools.gyp:prep_toolchain',
17         'src/untrusted/nacl/nacl.gyp:nacl_lib',
18         'src/untrusted/irt/irt.gyp:irt_core_nexe'
19       ],
20       'variables': {
21         'nexe_target': 'hello_world',
22         'build_glibc': 0,
23         'build_newlib': 1,
24         'build_pnacl_newlib': 1,
25         'translate_pexe_with_build': 1,
26         'extra_args': [
27           '--strip-all',
28         ],
29       },
30       'sources': [
31         'tests/hello_world/hello_world.c',
32       ],
33     },
34     # Compile a file in the output directory to make sure build_nexe can handle
35     # generated code.
36     {
37       'target_name': 'copy_hello_world',
38       'type': 'none',
39       'copies': [
40         {
41           'destination': '<(SHARED_INTERMEDIATE_DIR)',
42           'files': [
43             'tests/hello_world/hello_world.c',
44           ],
45         },
46       ],
47     },
48     {
49       'target_name': 'generated_hello_world_nexe',
50       'type': 'none',
51       'dependencies': [
52         'tools.gyp:prep_toolchain',
53         'src/untrusted/nacl/nacl.gyp:nacl_lib',
54         'src/untrusted/irt/irt.gyp:irt_core_nexe',
55         'copy_hello_world',
56       ],
57       'variables': {
58         'nexe_target': 'generated_hello_world',
59         'build_glibc': 0,
60         'build_newlib': 1,
61         'build_pnacl_newlib': 0,
62         'extra_args': [
63           '--strip-all',
64         ],
65       },
66       'sources': [
67         '<(SHARED_INTERMEDIATE_DIR)/hello_world.c',
68       ],
69     },
70     # Build simple_thread_test to verify that __thread linkage works
71     # correctly with gyp-built libraries:
72     # https://code.google.com/p/chromium/issues/detail?id=3461
73     {
74       'target_name': 'simple_thread_test',
75       'type': 'none',
76       'dependencies': [
77         'tools.gyp:prep_toolchain',
78         'src/untrusted/nacl/nacl.gyp:nacl_lib',
79         'src/untrusted/irt/irt.gyp:irt_core_nexe'
80       ],
81       'link_flags': ['-lpthread'],
82       # Bug 3461 only occurs when linking -fPIC objects so we use
83       # -fPIC here even though it isn't strictly necessary.
84       'compile_flags': ['-fPIC'],
85       'variables': {
86         'nexe_target': 'simple_thread_test',
87         'build_glibc': 0,
88         'build_newlib': 1,
89         'build_pnacl_newlib': 0,
90       },
91       'sources': [
92         'tests/threads/simple_thread_test.c',
93       ],
94     },
95   ],
96   'conditions': [
97     ['target_arch!="arm" and target_arch!="mipsel"', {
98       'targets': [
99         # Only build the tests on arm and mips, but don't try to run them
100         {
101           'target_name': 'test_hello_world_nexe',
102           'type': 'none',
103           'dependencies': [
104             'hello_world_nexe',
105             'src/trusted/service_runtime/service_runtime.gyp:sel_ldr',
106           ],
107           'variables': {
108             'arch': '--arch=<(target_arch)',
109             'name': '--name=hello_world',
110             'path': '--path=<(PRODUCT_DIR)',
111             'script': '<(DEPTH)/native_client/build/test_build.py',
112             'disable_glibc%': 0,
113           },
114           'conditions': [
115             ['OS=="win" and target_arch=="ia32"', {
116               'dependencies': [
117                 'src/trusted/service_runtime/service_runtime.gyp:sel_ldr64',
118               ],
119             }],
120             ['disable_glibc==0',{
121               'variables': {
122                 'tools': '--tools=newlib',
123               },
124             }, {
125               'variables': {
126                 'tools': '--tools=newlib',
127               },
128             }],
129           ],
130           'actions': [
131             {
132               'action_name': 'test build',
133               'msvs_cygwin_shell': 0,
134               'description': 'Testing NACL build',
135               'inputs': [
136                 '<!@(python <(script) -i <(arch) <(name) <(tools))',
137               ],
138               # Add a bogus output file, to cause this step to always fire.
139               'outputs': [
140                 '<(PRODUCT_DIR)/test-output/dont_create_hello_world.out'
141               ],
142               'action': [
143                 'python',
144                 '<(DEPTH)/native_client/build/test_build.py',
145                 '-r',
146                 '<(arch)',
147                 '<(name)',
148                 # TODO(bradnelson): Hack here to prevent gyp path ending with \"
149                 #               being passed to python which incorrectly
150                 #               interprets this as escaped quote.
151                 # http://code.google.com/p/chromium/issues/detail?id=141463
152                 '<(path)/hack',
153                 '<(tools)'
154               ],
155             },
156           ],
157         },
158         { # Test the hello world translated from pexe to nexe
159           'target_name': 'test_hello_world_pnacl_x86_64_nexe',
160           'type': 'none',
161           'dependencies': [
162             'hello_world_nexe',
163             'src/trusted/service_runtime/service_runtime.gyp:sel_ldr',
164           ],
165           'variables': {
166             'arch': '--arch=<(target_arch)',
167             'name': '--name=hello_world',
168             'path': '--path=<(PRODUCT_DIR)',
169             'tools': '--tools=pnacl_newlib',
170             'script': '<(DEPTH)/native_client/build/test_build.py',
171           },
172           'conditions': [
173             ['OS=="win" and target_arch=="ia32"', {
174               'dependencies': [
175                 'src/trusted/service_runtime/service_runtime.gyp:sel_ldr64',
176               ],
177             }],
178           ],
179           'actions': [
180             {
181               'action_name': 'test pnacl nexe build',
182               'msvs_cygwin_shell': 0,
183               'description': 'Testing PNaCl translated Nexe build',
184               'inputs': [
185                 '<!@(python <(script) -i <(arch) <(name) <(tools))',
186               ],
187               # Add a bogus output file, to cause this step to always fire.
188               'outputs': [
189                 '<(PRODUCT_DIR)/test-output/dont_create_hello_world_pnacl.out'
190               ],
191               'action': [
192                 'python',
193                 '<(DEPTH)/native_client/build/test_build.py',
194                 '-r',
195                 '<(arch)',
196                 '<(name)',
197                 # TODO(bradnelson): Hack here to prevent gyp path ending with \"
198                 #               being passed to python which incorrectly
199                 #               interprets this as escaped quote.
200                 # http://code.google.com/p/chromium/issues/detail?id=141463
201                 '<(path)/hack',
202                 '<(tools)'
203               ],
204             },
205           ],
206         },
207       ],
208     }],
209   ],
210 }