Home | History | Annotate | Download | only in breakpad_crash_test
      1 # -*- python -*-
      2 # Copyright (c) 2012 The Chromium 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 import os
      7 
      8 Import('env')
      9 
     10 if env.Bit('host_windows') or env.Bit('host_mac'):
     11   expected_crash_dumps = 1
     12 else:
     13   # We are also checking that crash dumping does not work
     14   # unexpectedly, since that might indicate that Breakpad was enabled
     15   # without checking that it works securely.
     16   expected_crash_dumps = 0
     17 
     18 platform_args = []
     19 if env.Bit('host_windows') and env.Bit('build_x86_64'):
     20   platform_args.append('--win64')
     21 
     22 def GetNexeByName(name):
     23   return env.File('${STAGING_DIR}/%s${PROGSUFFIX}' %
     24                   env.ProgramNameForNmf(name))
     25 
     26 
     27 # This tests that crashes in Chromium's browser process successfully
     28 # produce crash dumps via Breakpad.
     29 node = env.PPAPIBrowserTester(
     30     'breakpad_browser_process_crash_test.out',
     31     python_tester_script=env.File('crash_dump_tester.py'),
     32     browser_flags=['--crash-test'], # Tell the browser process to crash.
     33     url='browser_process_crash.html',
     34     nmf_names=[],
     35     files=[env.File('browser_process_crash.html')],
     36     args=platform_args + ['--expect_browser_process_crash',
     37                           '--expected_crash_dumps=1',
     38                           '--expected_process_type=browser'])
     39 
     40 # The test is disabled because it is flaky on Linux and Mac.
     41 # See: https://code.google.com/p/chromium/issues/detail?id=175023
     42 # Additionally, the test affects crash stats on Mac because it uploads
     43 # crash dumps on the bots for the Chrome official build.
     44 # See: https://code.google.com/p/chromium/issues/detail?id=129402
     45 env.AddNodeToTestSuite(
     46     node, ['chrome_browser_tests'], 'run_breakpad_browser_process_crash_test',
     47     is_broken=(env.PPAPIBrowserTesterIsBroken() or
     48                env.Bit('host_linux') or env.Bit('host_mac') or
     49                env.Bit('running_on_valgrind')))
     50 
     51 # This crash in trusted code should produce a crash dump.
     52 # DISABLED due to flakiness (http://crbug.com/247114).
     53 # crash_test_url = 'trusted_crash_in_startup.html'
     54 # node = env.PPAPIBrowserTester(
     55 #     'breakpad_trusted_crash_in_startup_test.out',
     56 #     python_tester_script=env.File('crash_dump_tester.py'),
     57 #     url=crash_test_url,
     58 #     nmf_names=['crash_test'],
     59 #     files=[GetNexeByName('crash_test'),
     60 #            env.File('trusted_crash_in_startup.html')],
     61 #     osenv='NACL_CRASH_TEST=1',
     62 #     args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps])
     63 # 
     64 # env.AddNodeToTestSuite(
     65 #     node,
     66 #     ['chrome_browser_tests'],
     67 #     'run_breakpad_trusted_crash_in_startup_test',
     68 #     is_broken=env.PPAPIBrowserTesterIsBroken() or
     69 #                env.Bit('running_on_valgrind'))
     70 
     71 # This tests a crash that occurs inside a syscall handler.
     72 # Ultimately this should be recognised as a crash caused by untrusted code.
     73 # See http://code.google.com/p/nativeclient/issues/detail?id=579
     74 node = env.PPAPIBrowserTester(
     75     'breakpad_crash_in_syscall_test.out',
     76     python_tester_script=env.File('crash_dump_tester.py'),
     77     url='crash_in_syscall.html',
     78     nmf_names=['crash_in_syscall'],
     79     files=[GetNexeByName('crash_in_syscall'),
     80            env.File('crash_in_syscall.html')],
     81     args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps])
     82 env.AddNodeToTestSuite(
     83     node, ['chrome_browser_tests'], 'run_breakpad_crash_in_syscall_test',
     84     # This test is currently flaky on Win 32 bit on x86, disabling there.
     85     # See bug: https://code.google.com/p/chromium/issues/detail?id=254583
     86     is_broken=env.PPAPIBrowserTesterIsBroken() or
     87                env.Bit('running_on_valgrind') or
     88                (env.Bit('host_windows') and env.Bit('build_x86_32')))
     89 
     90 # Crashes in untrusted code should not produce crash dumps.
     91 node = env.PPAPIBrowserTester(
     92     'breakpad_untrusted_crash_test.out',
     93     python_tester_script=env.File('crash_dump_tester.py'),
     94     url='untrusted_crash.html',
     95     nmf_names=['crash_test'],
     96     files=[GetNexeByName('crash_test'),
     97            env.File('untrusted_crash.html')],
     98     args=platform_args + ['--expected_crash_dumps=0'])
     99 env.AddNodeToTestSuite(
    100     node, ['chrome_browser_tests'], 'run_breakpad_untrusted_crash_test',
    101     is_broken=env.PPAPIBrowserTesterIsBroken() or
    102                env.Bit('running_on_valgrind'))
    103