chromium/ppapi/native_client/tests/breakpad_crash_test/nacl.scons

# -*- python -*-
# Copyright 2012 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

Import('env')

if env.Bit('host_windows') or env.Bit('host_mac'):
  expected_crash_dumps = 1
else:
  # We are also checking that crash dumping does not work
  # unexpectedly, since that might indicate that Breakpad was enabled
  # without checking that it works securely.
  expected_crash_dumps = 0

platform_args = []
if env.Bit('host_windows') and env.Bit('build_x86_64'):
  platform_args.append('--win64')

def GetNexeByName(name):
  return env.File('${STAGING_DIR}/%s${PROGSUFFIX}' %
                  env.ProgramNameForNmf(name))


# This tests that crashes in Chromium's browser process successfully
# produce crash dumps via Breakpad.
node = env.PPAPIBrowserTester(
    'breakpad_browser_process_crash_test.out',
    python_tester_script=env.File('crash_dump_tester.py'),
    browser_flags=['--crash-test'], # Tell the browser process to crash.
    url='browser_process_crash.html',
    nmf_names=[],
    files=[env.File('browser_process_crash.html')],
    args=platform_args + ['--expect_browser_process_crash',
                          '--expected_crash_dumps=1',
                          '--expected_process_type=browser'])

# The test is disabled because it is flaky on Linux and Mac.
# See: https://code.google.com/p/chromium/issues/detail?id=175023
# Additionally, the test affects crash stats on Mac because it uploads
# crash dumps on the bots for the Chrome official build.
# See: https://code.google.com/p/chromium/issues/detail?id=129402
env.AddNodeToTestSuite(
    node, ['chrome_browser_tests'], 'run_breakpad_browser_process_crash_test',
    is_broken=(env.PPAPIBrowserTesterIsBroken() or
               env.Bit('host_linux') or env.Bit('host_mac') or
               env.Bit('running_on_valgrind')))

# This crash in trusted code should produce a crash dump.
# DISABLED due to flakiness (http://crbug.com/247114).
# crash_test_url = 'trusted_crash_in_startup.html'
# node = env.PPAPIBrowserTester(
#     'breakpad_trusted_crash_in_startup_test.out',
#     python_tester_script=env.File('crash_dump_tester.py'),
#     url=crash_test_url,
#     nmf_names=['crash_test'],
#     files=[GetNexeByName('crash_test'),
#            env.File('trusted_crash_in_startup.html')],
#     osenv='NACL_CRASH_TEST=1',
#     args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps])
# 
# env.AddNodeToTestSuite(
#     node,
#     ['chrome_browser_tests'],
#     'run_breakpad_trusted_crash_in_startup_test',
#     is_broken=env.PPAPIBrowserTesterIsBroken() or
#                env.Bit('running_on_valgrind'))

# This tests a crash that occurs inside a syscall handler.
# Ultimately this should be recognised as a crash caused by untrusted code.
# See http://code.google.com/p/nativeclient/issues/detail?id=579
# DISABLED due to flakiness (http://crbug.com/332331)
# node = env.PPAPIBrowserTester(
#     'breakpad_crash_in_syscall_test.out',
#     python_tester_script=env.File('crash_dump_tester.py'),
#     url='crash_in_syscall.html',
#     nmf_names=['crash_in_syscall'],
#     files=[GetNexeByName('crash_in_syscall'),
#            env.File('crash_in_syscall.html')],
#     args=platform_args + ['--expected_crash_dumps=%i' % expected_crash_dumps])
# env.AddNodeToTestSuite(
#     node, ['chrome_browser_tests'], 'run_breakpad_crash_in_syscall_test',
#     # This test is currently flaky on Win 32 bit on x86, disabling there.
#     # See bug: https://code.google.com/p/chromium/issues/detail?id=254583
#     is_broken=env.PPAPIBrowserTesterIsBroken() or
#                env.Bit('running_on_valgrind') or
#                (env.Bit('host_windows') and env.Bit('build_x86_32')))

# Crashes in untrusted code should not produce crash dumps.
node = env.PPAPIBrowserTester(
    'breakpad_untrusted_crash_test.out',
    python_tester_script=env.File('crash_dump_tester.py'),
    url='untrusted_crash.html',
    nmf_names=['crash_test'],
    files=[GetNexeByName('crash_test'),
           env.File('untrusted_crash.html')],
    args=platform_args + ['--expected_crash_dumps=0'])
env.AddNodeToTestSuite(
    node, ['chrome_browser_tests'], 'run_breakpad_untrusted_crash_test',
    # This currently reliably fails in linux_aura configurations, probably for
    # the same reasons that the previous test fails.
    #
    # See bug: https://code.google.com/p/chromium/issues/detail?id=303342
    is_broken=env.PPAPIBrowserTesterIsBroken() or
               env.Bit('running_on_valgrind') or
               env.Bit('host_linux'))