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') |
21 | 23 |
22 ppapi_bad_files = [ | 24 ppapi_bad_files = [ |
23 'ppapi_bad.html', | 25 'ppapi_bad.html', |
24 'ppapi_bad.js', | 26 'ppapi_bad.js', |
25 'ppapi_bad_crossorigin.nmf', | 27 'ppapi_bad_crossorigin.nmf', |
26 'ppapi_bad_doesnotexist.nmf', | 28 'ppapi_bad_doesnotexist.nmf', |
27 'ppapi_bad_doesnotexist_nexe_only.nmf', | 29 'ppapi_bad_doesnotexist_nexe_only.nmf', |
28 'ppapi_bad_magic.nmf', | 30 'ppapi_bad_magic.nmf', |
29 'ppapi_bad_manifest_uses_nexes.nmf', | 31 'ppapi_bad_manifest_uses_nexes.nmf', |
30 'ppapi_bad_manifest_bad_files.nmf', | 32 'ppapi_bad_manifest_bad_files.nmf', |
31 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') | 33 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') |
32 ] | 34 ] |
33 ppapi_bad = env.Replicate('${STAGING_DIR}', ppapi_bad_files) | 35 ppapi_bad = env.Replicate('${STAGING_DIR}', ppapi_bad_files) |
34 | 36 |
35 | 37 nmfs = [] |
36 # Compile all nexes embedded into the above html | 38 # Compile all nexes embedded into the above html |
37 for kind in [ 'ppp_initialize', 'ppp_initialize_crash', | 39 for kind in [ 'ppp_initialize', 'ppp_initialize_crash', |
38 'no_ppp_instance', 'get_ppp_instance_crash', | 40 'no_ppp_instance', 'get_ppp_instance_crash', |
39 'get_ppp_messaging_crash', 'get_ppp_printing_crash', | 41 'get_ppp_messaging_crash', 'get_ppp_printing_crash', |
40 'ppp_instance_didcreate', 'ppp_instance_didcreate_crash', | 42 'ppp_instance_didcreate', 'ppp_instance_didcreate_crash', |
41 'event_replay_crash' | 43 'event_replay_crash' |
42 ]: | 44 ]: |
43 bad_nmf = 'ppapi_bad_%s.nmf' % kind | 45 bad_nmf = '${TEST_DIR}/ppapi_bad_%s.nmf' % kind |
44 bad_nexe = ('ppapi_bad_%s_%s' % (kind, env.get('TARGET_FULLARCH'))) | 46 bad_nexe = ('ppapi_bad_%s_%s' % (kind, env.get('TARGET_FULLARCH'))) |
45 env.ComponentProgram(bad_nexe, | 47 env.ComponentProgram(bad_nexe, |
46 ['ppapi_bad_%s.cc' % kind], | 48 ['ppapi_bad_%s.cc' % kind], |
47 EXTRA_LIBS=['${PPAPI_LIBS}', | 49 EXTRA_LIBS=['${PPAPI_LIBS}', |
48 'platform', | 50 'platform', |
49 'pthread', | 51 'pthread', |
50 'gio']) | 52 'gio']) |
51 | 53 nmfs.append(bad_nmf) |
52 env.Publish(bad_nexe, 'run', [bad_nmf]) | |
53 ppapi_bad_files.extend(env.ExtractPublishedFiles(bad_nexe)) | 54 ppapi_bad_files.extend(env.ExtractPublishedFiles(bad_nexe)) |
54 env.Depends(ppapi_bad, env.Alias(bad_nexe)) | 55 env.Depends(ppapi_bad, env.Alias(bad_nexe)) |
55 | 56 |
56 # "scons --mode=nacl ppapi_bad" will publish the html and all of its | 57 # "scons --mode=nacl ppapi_bad" will publish the html and all of its |
57 # dependencies to scons-out. | 58 # dependencies to scons-out. |
58 env.Alias('ppapi_bad', ppapi_bad) | 59 env.Alias('ppapi_bad', ppapi_bad) |
59 | 60 |
60 node = env.PPAPIBrowserTester( | 61 node = env.PPAPIBrowserTester( |
61 'ppapi_bad_browser_test.out', | 62 'ppapi_bad_browser_test.out', |
62 url='ppapi_bad.html', | 63 url='ppapi_bad.html', |
| 64 nmf=nmfs, |
63 files=[env.File(f) for f in ppapi_bad_files], | 65 files=[env.File(f) for f in ppapi_bad_files], |
64 args=['--allow_404']) | 66 args=['--allow_404']) |
65 | 67 |
66 env.AddNodeToTestSuite(node, | 68 env.AddNodeToTestSuite(node, |
67 ['chrome_browser_tests'], | 69 ['chrome_browser_tests'], |
68 'run_ppapi_bad_browser_test', | 70 'run_ppapi_bad_browser_test', |
69 is_broken=env.PPAPIBrowserTesterIsBroken()) | 71 is_broken=env.PPAPIBrowserTesterIsBroken() or |
| 72 env.Bit('nacl_glibc')) |
70 | 73 |
71 | 74 |
72 # Bad nexe tests that won't work in PNaCl (native) | 75 # Bad nexe tests that won't work in PNaCl (native) |
73 # For example, partly_invalid.nexe has inline assembly in its source files. | 76 # For example, partly_invalid.nexe has inline assembly in its source files. |
74 | |
75 ppapi_bad_native_files = [ | 77 ppapi_bad_native_files = [ |
76 env.File('ppapi_bad_native.html'), | 78 env.File('ppapi_bad_native.html'), |
77 env.File('partly_invalid.nmf'), | |
78 env.File('${SCONSTRUCT_DIR}/tests/ppapi_browser/progress_events/' + | 79 env.File('${SCONSTRUCT_DIR}/tests/ppapi_browser/progress_events/' + |
79 'ppapi_progress_events.js'), | 80 'ppapi_progress_events.js'), |
80 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') | 81 env.File('${SCONSTRUCT_DIR}/tools/browser_tester/browserdata/nacltest.js') |
81 ] | 82 ] |
82 replicated_files = env.Replicate('${STAGING_DIR}', ppapi_bad_native_files) | 83 replicated_files = env.Replicate('${STAGING_DIR}', ppapi_bad_native_files) |
83 env.Alias('all_programs', replicated_files) | 84 env.Alias('all_programs', replicated_files) |
84 | 85 |
85 partly_invalid = env.File('${STAGING_DIR}/partly_invalid${PROGSUFFIX}') | 86 partly_invalid = env.File('${STAGING_DIR}/partly_invalid${PROGSUFFIX}') |
86 ppapi_bad_native_files.append(partly_invalid) | 87 ppapi_bad_native_files.append(partly_invalid) |
87 | 88 |
88 node = env.PPAPIBrowserTester( | 89 node = env.PPAPIBrowserTester( |
89 'ppapi_bad_native_test.out', | 90 'ppapi_bad_native_test.out', |
90 url='ppapi_bad_native.html', | 91 url='ppapi_bad_native.html', |
| 92 nmf='${TEST_DIR}/partly_invalid.nmf', |
91 files=ppapi_bad_native_files, | 93 files=ppapi_bad_native_files, |
92 ) | 94 ) |
93 | 95 |
94 env.AddNodeToTestSuite(node, | 96 env.AddNodeToTestSuite(node, |
95 ['chrome_browser_tests'], | 97 ['chrome_browser_tests'], |
96 'run_ppapi_bad_native_test', | 98 'run_ppapi_bad_native_test', |
97 is_broken=env.PPAPIBrowserTesterIsBroken() or | 99 is_broken=env.PPAPIBrowserTesterIsBroken() or |
98 env.Bit('bitcode')) | 100 env.Bit('nacl_glibc') or |
| 101 env.Bit('bitcode')) |
OLD | NEW |