Upstream version 10.39.225.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     ['OS!="android" and target_arch!="arm" and target_arch!="mipsel"', {
98       'targets': [
99         # If the target ABI is not compatible with host ABI,
100         # only build the tests, but don't try to run them.
101         {
102           'target_name': 'test_hello_world_nexe',
103           'type': 'none',
104           'dependencies': [
105             'hello_world_nexe',
106             'src/trusted/service_runtime/service_runtime.gyp:sel_ldr',
107           ],
108           'variables': {
109             'arch': '--arch=<(target_arch)',
110             'name': '--name=hello_world',
111             'path': '--path=<(PRODUCT_DIR)',
112             'script': '<(DEPTH)/native_client/build/test_build.py',
113             'disable_glibc%': 0,
114           },
115           'conditions': [
116             ['OS=="win" and target_arch=="ia32"', {
117               'dependencies': [
118                 'src/trusted/service_runtime/service_runtime.gyp:sel_ldr64',
119               ],
120             }],
121             ['disable_glibc==0',{
122               'variables': {
123                 'tools': '--tools=newlib',
124               },
125             }, {
126               'variables': {
127                 'tools': '--tools=newlib',
128               },
129             }],
130           ],
131           'actions': [
132             {
133               'action_name': 'test build',
134               'msvs_cygwin_shell': 0,
135               'description': 'Testing NACL build',
136               'inputs': [
137                 '<!@(python <(script) -i <(arch) <(name) <(tools))',
138               ],
139               # Add a bogus output file, to cause this step to always fire.
140               'outputs': [
141                 '<(PRODUCT_DIR)/test-output/dont_create_hello_world.out'
142               ],
143               'action': [
144                 'python',
145                 '<(script)',
146                 '-r',
147                 '<(arch)',
148                 '<(name)',
149                 # TODO(bradnelson): Hack here to prevent gyp path ending with \"
150                 #               being passed to python which incorrectly
151                 #               interprets this as escaped quote.
152                 # http://code.google.com/p/chromium/issues/detail?id=141463
153                 '<(path)/hack',
154                 '<(tools)'
155               ],
156             },
157           ],
158         },
159         { # Test the hello world translated from pexe to nexe
160           'target_name': 'test_hello_world_pnacl_x86_64_nexe',
161           'type': 'none',
162           'dependencies': [
163             'hello_world_nexe',
164             'src/trusted/service_runtime/service_runtime.gyp:sel_ldr',
165           ],
166           'variables': {
167             'arch': '--arch=<(target_arch)',
168             'name': '--name=hello_world',
169             'path': '--path=<(PRODUCT_DIR)',
170             'tools': '--tools=pnacl_newlib',
171             'script': '<(DEPTH)/native_client/build/test_build.py',
172           },
173           'conditions': [
174             ['OS=="win" and target_arch=="ia32"', {
175               'dependencies': [
176                 'src/trusted/service_runtime/service_runtime.gyp:sel_ldr64',
177               ],
178             }],
179           ],
180           'actions': [
181             {
182               'action_name': 'test pnacl nexe build',
183               'msvs_cygwin_shell': 0,
184               'description': 'Testing PNaCl translated Nexe build',
185               'inputs': [
186                 '<!@(python <(script) -i <(arch) <(name) <(tools))',
187               ],
188               # Add a bogus output file, to cause this step to always fire.
189               'outputs': [
190                 '<(PRODUCT_DIR)/test-output/dont_create_hello_world_pnacl.out'
191               ],
192               'action': [
193                 'python',
194                 '<(script)',
195                 '-r',
196                 '<(arch)',
197                 '<(name)',
198                 # TODO(bradnelson): Hack here to prevent gyp path ending with \"
199                 #               being passed to python which incorrectly
200                 #               interprets this as escaped quote.
201                 # http://code.google.com/p/chromium/issues/detail?id=141463
202                 '<(path)/hack',
203                 '<(tools)'
204               ],
205             },
206           ],
207         },
208       ],
209     }],
210   ],
211 }