OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import json | 6 import json |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 Import('env') | 9 Import('env') |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 # dynamic_code_loading/nacl.scons. The dyncode tests don't work with | 23 # dynamic_code_loading/nacl.scons. The dyncode tests don't work with |
24 # dynamic linking yet, and they don't build with non-ARM PNaCl. | 24 # dynamic linking yet, and they don't build with non-ARM PNaCl. |
25 if (env.Bit('nacl_static_link') and | 25 if (env.Bit('nacl_static_link') and |
26 not (env.Bit('bitcode') and not env.Bit('target_arm'))): | 26 not (env.Bit('bitcode') and not env.Bit('target_arm'))): |
27 exe_list.append('dynamic_load_browser_test') | 27 exe_list.append('dynamic_load_browser_test') |
28 | 28 |
29 # Dynamic code modification is not implemented for ARM yet. | 29 # Dynamic code modification is not implemented for ARM yet. |
30 if not env.Bit('target_arm'): | 30 if not env.Bit('target_arm'): |
31 exe_list.append('dynamic_modify_browser_test') | 31 exe_list.append('dynamic_modify_browser_test') |
32 | 32 |
33 # Exception handling support is not implemented everywhere yet. | 33 |
34 if (not env.Bit('disable_dynamic_plugin_loading') and | 34 def AddTest(env, test_name, exe_list): |
35 not (env.Bit('host_windows') and env.Bit('build_x86_64'))): | 35 test_files = [env.File('${STAGING_DIR}/%s_${TARGET_FULLARCH}${PROGSUFFIX}' |
36 exe_list.append('exception_browser_test') | 36 % exe_name) |
37 env['ENV']['NACL_UNTRUSTED_EXCEPTION_HANDLING'] = '1' | 37 for exe_name in exe_list] |
| 38 |
| 39 def WriteManifestList(target, source, env): |
| 40 nmf_names = ['%s.nmf' % exe_name for exe_name in exe_list] |
| 41 data = ('// This file is automatically generated\n' |
| 42 'var G_NMF_TEST_LIST = %s;\n' % json.dumps(nmf_names)) |
| 43 fh = open(target[0].abspath, 'w') |
| 44 fh.write(data) |
| 45 fh.close() |
| 46 |
| 47 nmf_list_js = env.Command(['%s_nmf_test_list.js' % test_name], [], |
| 48 WriteManifestList)[0] |
| 49 # Scons does not track the dependency of nmf_list_js on exe_list, so |
| 50 # we must always recreate nmf_list_js when it is used. |
| 51 env.AlwaysBuild(nmf_list_js) |
| 52 |
| 53 node = env.PPAPIBrowserTester( |
| 54 '%s.out' % test_name, url='test_runner.html', |
| 55 nmf_names=exe_list, |
| 56 files=[env.File('test_runner.html')] + test_files, |
| 57 map_files=[('nmf_test_list.js', nmf_list_js)]) |
| 58 |
| 59 # Disabled on Valgrind because of multiple nexes. |
| 60 # TODO(eugenis): enable when Valgrind learns to autodetect the nexe name |
| 61 env.AddNodeToTestSuite(node, ['chrome_browser_tests'], test_name, |
| 62 is_broken=env.PPAPIBrowserTesterIsBroken() or |
| 63 env.Bit('running_on_valgrind') or |
| 64 not env.Bit('irt')) |
38 | 65 |
39 | 66 |
40 test_files = ([env.File('${STAGING_DIR}/nacltest.js')] + | 67 AddTest(env, 'run_inbrowser_test_runner', exe_list) |
41 [env.File('${STAGING_DIR}/%s_${TARGET_FULLARCH}${PROGSUFFIX}' | |
42 % exe_name) | |
43 for exe_name in exe_list]) | |
44 # These are not true dependencies: They are not needed for | |
45 # test_runner.html to be replicated to "staging", but they are needed | |
46 # for test_runner.html to work when run. | |
47 env.Depends(dest_copy, test_files) | |
48 env.Alias('test_runner.html', dest_copy) | |
49 | 68 |
50 def WriteManifestList(target, source, env): | 69 # "exception_test" is added as a separate test so that it can be |
51 nmf_names = ['%s.nmf' % exe_name for exe_name in exe_list] | 70 # separately enabled or disabled from the Chromium side. |
52 data = ('// This file is automatically generated\n' | 71 # TODO(mseaborn): When this test works fully in Chromium on all OSes, |
53 'var G_NMF_TEST_LIST = %s;\n' % json.dumps(nmf_names)) | 72 # merge this back into run_inbrowser_test_runner. |
54 fh = open(target[0].abspath, 'w') | 73 # See http://code.google.com/p/nativeclient/issues/detail?id=2602 |
55 fh.write(data) | 74 exception_env = env.Clone() |
56 fh.close() | 75 exception_env['ENV']['NACL_UNTRUSTED_EXCEPTION_HANDLING'] = '1' |
57 | 76 AddTest(exception_env, 'run_inbrowser_exception_test', |
58 nmf_list_js = env.Command(['nmf_test_list.js'], [], WriteManifestList)[0] | 77 ['exception_browser_test']) |
59 # Scons does not track the dependency of nmf_list_js on exe_list, so | |
60 # we must always recreate nmf_list_js when it is used. | |
61 env.AlwaysBuild(nmf_list_js) | |
62 | |
63 node = env.PPAPIBrowserTester( | |
64 'inbrowser_test_runner.out', url='test_runner.html', | |
65 nmf_names=exe_list, | |
66 files=[env.File('test_runner.html'), nmf_list_js] + test_files) | |
67 | |
68 # Disabled on Valgrind because of multiple nexes. | |
69 # TODO(eugenis): enable when Valgrind learns to autodetect the nexe name | |
70 env.AddNodeToTestSuite(node, ['chrome_browser_tests'], | |
71 'run_inbrowser_test_runner', | |
72 is_broken=env.PPAPIBrowserTesterIsBroken() or | |
73 env.Bit('running_on_valgrind') or | |
74 not env.Bit('irt')) | |
OLD | NEW |