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