OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 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 # Tests fatal errors that occur during loading. | 6 # Tests fatal errors that occur during loading. |
7 # (See ppapi_browser/crash for fatal errors that occur after loading). | 7 # (See ppapi_browser/crash for fatal errors that occur after loading). |
8 # TODO(polina): rename the directory and browser test to bad_load | 8 # TODO(polina): rename the directory and browser test to bad_load |
9 # | 9 # |
10 # Manual testing with localhost:5103/scons-out/.../staging/ppapi_bad.html: | 10 # Manual testing with localhost:5103/scons-out/.../staging/ppapi_bad.html: |
11 # scons --mode=nacl ppapi_bad | 11 # scons --mode=nacl ppapi_bad |
12 # Automatic testing: | 12 # Automatic testing: |
13 # scons run_ppapi_bad_browser_test | 13 # scons run_ppapi_bad_browser_test |
14 # | 14 # |
15 | 15 |
16 Import('env') | 16 Import('env') |
17 | 17 |
18 # TODO(robertm): those should not be necessary once we go -std=c99 | 18 # TODO(robertm): those should not be necessary once we go -std=c99 |
19 env.FilterOut(CFLAGS=['-pedantic']) | 19 env.FilterOut(CFLAGS=['-pedantic']) |
20 env.FilterOut(CCFLAGS=['-pedantic']) | 20 env.FilterOut(CCFLAGS=['-pedantic']) |
21 env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/' + | |
22 'bad') | |
23 | 21 |
24 ppapi_bad_files = [ | 22 ppapi_bad_files = [ |
25 'ppapi_bad.html', | 23 'ppapi_bad.html', |
26 'ppapi_bad.js', | 24 'ppapi_bad.js', |
27 'ppapi_bad_crossorigin.nmf', | 25 'ppapi_bad_crossorigin.nmf', |
28 'ppapi_bad_doesnotexist.nmf', | 26 'ppapi_bad_doesnotexist.nmf', |
29 'ppapi_bad_doesnotexist_nexe_only.nmf', | 27 'ppapi_bad_doesnotexist_nexe_only.nmf', |
30 'ppapi_bad_magic.nmf', | 28 'ppapi_bad_magic.nmf', |
31 'ppapi_bad_manifest_uses_nexes.nmf', | 29 'ppapi_bad_manifest_uses_nexes.nmf', |
32 'ppapi_bad_manifest_bad_files.nmf', | 30 'ppapi_bad_manifest_bad_files.nmf', |
33 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') | 31 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') |
34 ] | 32 ] |
35 ppapi_bad = env.Replicate('${STAGING_DIR}', ppapi_bad_files) | 33 ppapi_bad = env.Replicate('${STAGING_DIR}', ppapi_bad_files) |
36 | 34 |
37 nmfs = [] | 35 |
38 # Compile all nexes embedded into the above html | 36 # Compile all nexes embedded into the above html |
39 for kind in [ 'ppp_initialize', 'ppp_initialize_crash', | 37 for kind in [ 'ppp_initialize', 'ppp_initialize_crash', |
40 'no_ppp_instance', 'get_ppp_instance_crash', | 38 'no_ppp_instance', 'get_ppp_instance_crash', |
41 'get_ppp_messaging_crash', 'get_ppp_printing_crash', | 39 'get_ppp_messaging_crash', 'get_ppp_printing_crash', |
42 'ppp_instance_didcreate', 'ppp_instance_didcreate_crash', | 40 'ppp_instance_didcreate', 'ppp_instance_didcreate_crash', |
43 'event_replay_crash' | 41 'event_replay_crash' |
44 ]: | 42 ]: |
45 bad_nmf = '${TEST_DIR}/ppapi_bad_%s.nmf' % kind | 43 bad_nmf = 'ppapi_bad_%s.nmf' % kind |
46 bad_nexe = ('ppapi_bad_%s_%s' % (kind, env.get('TARGET_FULLARCH'))) | 44 bad_nexe = ('ppapi_bad_%s_%s' % (kind, env.get('TARGET_FULLARCH'))) |
47 env.ComponentProgram(bad_nexe, | 45 env.ComponentProgram(bad_nexe, |
48 ['ppapi_bad_%s.cc' % kind], | 46 ['ppapi_bad_%s.cc' % kind], |
49 EXTRA_LIBS=['${PPAPI_LIBS}', | 47 EXTRA_LIBS=['${PPAPI_LIBS}', |
50 'platform', | 48 'platform', |
51 'pthread', | 49 'pthread', |
52 'gio']) | 50 'gio']) |
53 nmfs.append(bad_nmf) | 51 |
| 52 env.Publish(bad_nexe, 'run', [bad_nmf]) |
54 ppapi_bad_files.extend(env.ExtractPublishedFiles(bad_nexe)) | 53 ppapi_bad_files.extend(env.ExtractPublishedFiles(bad_nexe)) |
55 env.Depends(ppapi_bad, env.Alias(bad_nexe)) | 54 env.Depends(ppapi_bad, env.Alias(bad_nexe)) |
56 | 55 |
57 # "scons --mode=nacl ppapi_bad" will publish the html and all of its | 56 # "scons --mode=nacl ppapi_bad" will publish the html and all of its |
58 # dependencies to scons-out. | 57 # dependencies to scons-out. |
59 env.Alias('ppapi_bad', ppapi_bad) | 58 env.Alias('ppapi_bad', ppapi_bad) |
60 | 59 |
61 node = env.PPAPIBrowserTester( | 60 node = env.PPAPIBrowserTester( |
62 'ppapi_bad_browser_test.out', | 61 'ppapi_bad_browser_test.out', |
63 url='ppapi_bad.html', | 62 url='ppapi_bad.html', |
64 nmf=nmfs, | |
65 files=[env.File(f) for f in ppapi_bad_files], | 63 files=[env.File(f) for f in ppapi_bad_files], |
66 args=['--allow_404']) | 64 args=['--allow_404']) |
67 | 65 |
68 env.AddNodeToTestSuite(node, | 66 env.AddNodeToTestSuite(node, |
69 ['chrome_browser_tests'], | 67 ['chrome_browser_tests'], |
70 'run_ppapi_bad_browser_test', | 68 'run_ppapi_bad_browser_test', |
71 is_broken=env.PPAPIBrowserTesterIsBroken() or | 69 is_broken=env.PPAPIBrowserTesterIsBroken()) |
72 env.Bit('nacl_glibc')) | |
73 | 70 |
74 | 71 |
75 # Bad nexe tests that won't work in PNaCl (native) | 72 # Bad nexe tests that won't work in PNaCl (native) |
76 # For example, partly_invalid.nexe has inline assembly in its source files. | 73 # For example, partly_invalid.nexe has inline assembly in its source files. |
| 74 |
77 ppapi_bad_native_files = [ | 75 ppapi_bad_native_files = [ |
78 env.File('ppapi_bad_native.html'), | 76 env.File('ppapi_bad_native.html'), |
| 77 env.File('partly_invalid.nmf'), |
79 env.File('${SCONSTRUCT_DIR}/tests/ppapi_browser/progress_events/' + | 78 env.File('${SCONSTRUCT_DIR}/tests/ppapi_browser/progress_events/' + |
80 'ppapi_progress_events.js'), | 79 'ppapi_progress_events.js'), |
81 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') | 80 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') |
82 ] | 81 ] |
83 replicated_files = env.Replicate('${STAGING_DIR}', ppapi_bad_native_files) | 82 replicated_files = env.Replicate('${STAGING_DIR}', ppapi_bad_native_files) |
84 env.Alias('all_programs', replicated_files) | 83 env.Alias('all_programs', replicated_files) |
85 | 84 |
86 partly_invalid = env.File('${STAGING_DIR}/partly_invalid${PROGSUFFIX}') | 85 partly_invalid = env.File('${STAGING_DIR}/partly_invalid${PROGSUFFIX}') |
87 ppapi_bad_native_files.append(partly_invalid) | 86 ppapi_bad_native_files.append(partly_invalid) |
88 | 87 |
89 node = env.PPAPIBrowserTester( | 88 node = env.PPAPIBrowserTester( |
90 'ppapi_bad_native_test.out', | 89 'ppapi_bad_native_test.out', |
91 url='ppapi_bad_native.html', | 90 url='ppapi_bad_native.html', |
92 nmf='${TEST_DIR}/partly_invalid.nmf', | |
93 files=ppapi_bad_native_files, | 91 files=ppapi_bad_native_files, |
94 ) | 92 ) |
95 | 93 |
96 env.AddNodeToTestSuite(node, | 94 env.AddNodeToTestSuite(node, |
97 ['chrome_browser_tests'], | 95 ['chrome_browser_tests'], |
98 'run_ppapi_bad_native_test', | 96 'run_ppapi_bad_native_test', |
99 is_broken=env.PPAPIBrowserTesterIsBroken() or | 97 is_broken=env.PPAPIBrowserTesterIsBroken() or |
100 env.Bit('nacl_glibc') or | 98 env.Bit('bitcode')) |
101 env.Bit('bitcode')) | |
OLD | NEW |