gn format: Fix and enable a few more tests
[chromium-blink-merge.git] / ppapi / ppapi_nacl_test_common.gypi
blobca119fe0ed5f809af96415155382af2ced1b613b
1 # Copyright (c) 2013 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.
6   'includes': [
7     '../build/common_untrusted.gypi',
8   ],
9   'target_defaults': {
10     # We need to override the variables in untrusted.gypi outside of a
11     # target_condition block because the target_condition block in
12     # untrusted gypi is fully evaluated and interpolated before any of the
13     # target_condition blocks in this file are expanded.  This means that any
14     # variables overriden inside a target_condition block in this file will not
15     # affect the values in untrusted.gypi.
16     'variables': {
17       'test_files': [],
18       'generate_nmf%': 1,
19       'nacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/newlib',
20       'nacl_glibc_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/glibc',
21       'nacl_pnacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/pnacl',
22       'nacl_pnacl_newlib_nonsfi_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/nonsfi',
23       'target_conditions': [
24         ['nexe_target!=""', {
25           # These variables are used for nexe building and for library building.
26           'out_newlib32%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_32.nexe',
27           'out_newlib64%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_64.nexe',
28           'out_newlib_arm%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_arm.nexe',
29           'out_newlib_mips%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_mips32.nexe',
30           'nmf_newlib%': '>(nacl_newlib_out_dir)/>(nexe_target).nmf',
31           'out_glibc32%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_32.nexe',
32           'out_glibc64%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_64.nexe',
33           'out_glibc_arm%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_arm.nexe',
34           'nmf_glibc%': '>(nacl_glibc_out_dir)/>(nexe_target).nmf',
35           'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
36           'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
37           'out_pnacl_newlib_x86_32_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_x32_nonsfi.nexe',
38           'out_pnacl_newlib_arm_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_arm_nonsfi.nexe',
39           'nmf_pnacl_newlib_nonsfi%': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target).nmf',
40         }],
41       ],
42     },
43     'dependencies': [
44        '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
45        '<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib',
46        '<(DEPTH)/ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
47        '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
48     ],
49     'target_conditions': [
50       ['test_files!=[] and build_newlib==1', {
51         'copies': [
52           {
53             'destination': '>(nacl_newlib_out_dir)',
54             'files': [
55               '>@(test_files)',
56             ],
57           },
58         ],
59       }],
60       ['test_files!=[] and "<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and disable_glibc==0 and build_glibc==1', {
61         'copies': [
62           {
63             'destination': '>(nacl_glibc_out_dir)',
64             'files': [
65               '>@(test_files)',
66             ],
67           },
68         ],
69       }],
70       # Nonsfi pnacl copy is covered below.
71       ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0', {
72         'copies': [
73           {
74             'destination': '>(nacl_pnacl_newlib_out_dir)',
75             'files': [
76               '>@(test_files)',
77             ],
78           },
79         ],
80       }],
81       ['test_files!=[] and build_pnacl_newlib==1 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
82         'copies': [
83           {
84             'destination': '>(nacl_pnacl_newlib_nonsfi_out_dir)',
85             'files': [
86               '>@(test_files)',
87             ],
88           },
89         ],
90       }],
91       ['nexe_target!=""', {
92         'variables': {
93           # Patch over the fact that untrusted.gypi doesn't define these in all
94           # cases.
95           'enable_x86_64%': 0,
96           'enable_x86_32%': 0,
97           'enable_arm%': 0,
98           'enable_mips%': 0,
99           'include_dirs': [
100             '<(DEPTH)',
101           ],
102           'link_flags': [
103             '-lppapi_cpp',
104             '-lppapi',
105             '-pthread',
106           ],
107           'extra_args': [
108             '--strip-all',
109           ],
110           'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
111           'create_nmf_args_portable%': [],
112           'create_nonsfi_test_nmf': '<(DEPTH)/ppapi/tests/create_nonsfi_test_nmf.py',
113         },
114         'target_conditions': [
115           ['generate_nmf==1 and build_newlib==1', {
116             'actions': [
117               {
118                 'action_name': 'Generate NEWLIB NMF',
119                 'inputs': ['>(create_nmf)'],
120                 'outputs': ['>(nmf_newlib)'],
121                 'action': [
122                   'python',
123                   '>(create_nmf)',
124                   '--output=>(nmf_newlib)',
125                   '>@(create_nmf_args_portable)',
126                 ],
127                 'target_conditions': [
128                   ['enable_x86_64==1', {
129                     'inputs': ['>(out_newlib64)'],
130                     'action': ['>(out_newlib64)'],
131                   }],
132                   ['enable_x86_32==1', {
133                     'inputs': ['>(out_newlib32)'],
134                     'action': ['>(out_newlib32)'],
135                   }],
136                   ['enable_arm==1', {
137                     'inputs': ['>(out_newlib_arm)'],
138                     'action': ['>(out_newlib_arm)'],
139                   }],
140                   ['enable_mips==1', {
141                     'inputs': ['>(out_newlib_mips)'],
142                     'action': ['>(out_newlib_mips)'],
143                   }],
144                 ],
145               },
146             ],
147           }],
148           ['"<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and generate_nmf==1 and disable_glibc==0 and build_glibc==1', {
149             'variables': {
150               # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
151               # doesn't work on Windows.
152               'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
153               'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
154               'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
155             },
156             'actions': [
157               {
158                 'action_name': 'Generate GLIBC NMF and copy libs',
159                 'inputs': ['>(create_nmf)'],
160                 # NOTE: There is no explicit dependency for the lib32
161                 # and lib64 directories created in the PRODUCT_DIR.
162                 # They are created as a side-effect of NMF creation.
163                 'outputs': ['>(nmf_glibc)'],
164                 'action': [
165                   'python',
166                   '>(create_nmf)',
167                   '--objdump=>(nacl_objdump)',
168                   '--output=>(nmf_glibc)',
169                   '--path-prefix=>(nexe_target)_libs',
170                   '--stage-dependencies=<(nacl_glibc_out_dir)',
171                   '>@(create_nmf_args_portable)',
172                 ],
173                 'target_conditions': [
174                   ['enable_x86_64==1', {
175                     'inputs': ['>(out_glibc64)'],
176                     'action': [
177                       '>(out_glibc64)',
178                       '--library-path=>(libdir_glibc64)',
179                       '--library-path=>(tc_lib_dir_glibc64)',
180                     ],
181                   }],
182                   ['enable_x86_32==1', {
183                     'inputs': ['>(out_glibc32)'],
184                     'action': [
185                       '>(out_glibc32)',
186                       '--library-path=>(libdir_glibc32)',
187                       '--library-path=>(tc_lib_dir_glibc32)',
188                     ],
189                   }],
190                   # TODO(ncbray) handle arm case.  We don't have ARM glibc yet.
191                 ],
192               },
193             ],
194           }],
195           ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
196             'actions': [
197               {
198                 'action_name': 'Generate PNACL NEWLIB NMF',
199                 # NOTE: create_nmf must be first, it is the script python
200                 # executes below.
201                 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
202                 'outputs': ['>(nmf_pnacl_newlib)'],
203                 'action': [
204                   'python',
205                   '>(create_nmf)',
206                   '--output=>(nmf_pnacl_newlib)',
207                   '>(out_pnacl_newlib)',
208                   '>@(create_nmf_args_portable)',
209                 ],
210               },
211             ],
212           }],
213           ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
214             'actions': [
215               {
216                 'action_name': 'Generate PNACL NEWLIB nonsfi NMF',
217                 'inputs': ['>(create_nonsfi_test_nmf)'],
218                 'outputs': ['>(nmf_pnacl_newlib_nonsfi)'],
219                 'action': [
220                   'python',
221                   '>(create_nonsfi_test_nmf)',
222                   '>@(create_nmf_args_portable)',
223                   '--output=>(nmf_pnacl_newlib_nonsfi)',
224                 ],
225                 'target_conditions': [
226                   ['enable_x86_32_nonsfi==1', {
227                     'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
228                     'action': [
229                       '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
230                       '--arch=x86-32',
231                     ]
232                   }],
233                   ['enable_arm_nonsfi==1', {
234                     'inputs': ['>(out_pnacl_newlib_arm_nonsfi_nexe)'],
235                     'action': [
236                       '--program=>(out_pnacl_newlib_arm_nonsfi_nexe)',
237                       '--arch=arm',
238                     ]
239                   }],
240                 ],
241               },
242             ],
243           }],
244         ],
245       }],
246     ],
247   },