Пример #1
0
def get_kernel_name():
    """Returns the kernel name for the device, since some kernels are shared."""
    product_name = settings.get_product_name()
    build_product = settings.get_build_product()

    # Strip _kasan off of the end as we will add it later if needed.
    utils.strip_from_right(product_name, '_kasan')

    # Some devices have a different kernel name than product_name, if so use the
    # kernel name.
    return constants.PRODUCT_TO_KERNEL.get(build_product, product_name)
Пример #2
0
def chrome_dsym_hints(binary):
    """Construct a path to the .dSYM bundle for the given binary.
  There are three possible cases for binary location in Chromium:
  1. The binary is a standalone executable or dynamic library in the product
     dir, the debug info is in "binary.dSYM" in the product dir.
  2. The binary is a standalone framework or .app bundle, the debug info is in
     "Framework.framework.dSYM" or "App.app.dSYM" in the product dir.
  3. The binary is a framework or an .app bundle within another .app bundle
     (e.g. Outer.app/Contents/Versions/1.2.3.4/Inner.app), and the debug info
     is in Inner.app.dSYM in the product dir.
  The first case is handled by llvm-symbolizer, so we only need to construct
  .dSYM paths for .app bundles and frameworks.
  We're assuming that there're no more than two nested bundles in the binary
  path. Only one of these bundles may be a framework and frameworks cannot
  contain other bundles."""
    path_parts = binary.split(os.path.sep)
    app_positions = []
    framework_positions = []
    for index, part in enumerate(path_parts):
        if part.endswith('.app'):
            app_positions.append(index)
        elif part.endswith('.framework'):
            framework_positions.append(index)

    bundle_positions = app_positions + framework_positions
    bundle_positions.sort()
    assert len(bundle_positions) <= 2, \
        'The path contains more than two nested bundles: %s' % binary
    if len(bundle_positions) == 0:
        # Case 1: this is a standalone executable or dylib.
        return []
    assert (not (len(app_positions) == 1 and
                 len(framework_positions) == 1 and
                 app_positions[0] > framework_positions[0])), \
        'The path contains an app bundle inside a framework: %s' % binary
    # Cases 2 and 3. The outermost bundle (which is the only bundle in the case 2)
    # is located in the product dir.
    outermost_bundle = bundle_positions[0]
    product_dir = path_parts[:outermost_bundle]
    # In case 2 this is the same as |outermost_bundle|.
    innermost_bundle = bundle_positions[-1]
    innermost_bundle_dir = path_parts[innermost_bundle]
    innermost_bundle_dir = utils.strip_from_right(innermost_bundle_dir, '.app')
    innermost_bundle_dir = utils.strip_from_right(innermost_bundle_dir,
                                                  '.framework')
    dsym_path = product_dir + [innermost_bundle_dir]
    result = '%s.dSYM' % os.path.sep.join(dsym_path)
    return [result]
Пример #3
0
def setup_additional_args_for_app():
    """Select additional args for the specified app at random."""
    if environment.is_engine_fuzzer_job():
        # Not applicable to engine fuzzers.
        return

    app_name = environment.get_value('APP_NAME')
    if not app_name:
        return

    # Convert the app_name to lowercase. Case may vary by platform.
    app_name = app_name.lower()

    # Hack: strip file extensions that may be appended on various platforms.
    extensions_to_strip = ['.exe', '.apk']
    for extension in extensions_to_strip:
        app_name = utils.strip_from_right(app_name, extension)

    trials = data_types.Trial.query(data_types.Trial.app_name == app_name)
    trials = [trial for trial in trials if random.random() < trial.probability]
    if not trials:
        return

    app_args = environment.get_value('APP_ARGS', '') + ' ' + trials[0].app_args
    trial_app_args = trials[0].app_args
    for trial in trials[1:]:
        app_args += ' ' + trial.app_args
        trial_app_args += ' ' + trial.app_args

    environment.set_value('APP_ARGS', app_args)
    environment.set_value('TRIAL_APP_ARGS', trial_app_args)
Пример #4
0
    def __init__(self):
        self.trials = []

        app_name = environment.get_value('APP_NAME')
        if not app_name:
            return

        # Convert the app_name to lowercase. Case may vary by platform.
        app_name = app_name.lower()

        # Hack: strip file extensions that may be appended on various platforms.
        extensions_to_strip = ['.exe', '.apk']
        for extension in extensions_to_strip:
            app_name = utils.strip_from_right(app_name, extension)

        self.trials = list(
            data_types.Trial.query(data_types.Trial.app_name == app_name))
Пример #5
0
def setup_additional_args_for_app():
    """Select additional args for the specified app at random."""
    # Convert the app_name to lowercase. Case may vary by platform.
    app_name = environment.get_value('APP_NAME', '').lower()

    # Hack: strip file extensions that may be appended on various platforms.
    extensions_to_strip = ['.exe', '.apk']
    for extension in extensions_to_strip:
        app_name = utils.strip_from_right(app_name, extension)

    trials = data_types.Trial.query(data_types.Trial.app_name == app_name)
    trial = select_trial(trials)
    if not trial or not trial.app_args:
        return

    current_app_args = environment.get_value('APP_ARGS', '').rstrip()
    environment.set_value('APP_ARGS',
                          '%s %s' % (current_app_args, trial.app_args))

    environment.set_value('TRIAL_APP_ARGS', trial.app_args)