Пример #1
0
def update_fuzz_blocker_label(policy, testcase, issue,
                              top_crashes_by_project_and_platform_map):
  """Add top crash label to issue."""
  fuzz_blocker_label = policy.label('fuzz_blocker')
  if not fuzz_blocker_label:
    return

  if not issue:
    return

  if not testcase.open:
    return

  top_crash_platforms = get_top_crash_platforms(
      testcase, top_crashes_by_project_and_platform_map)
  if not top_crash_platforms:
    # Not a top crasher, bail out.
    return

  if issue_tracker_utils.was_label_added(issue, fuzz_blocker_label):
    # Issue was already marked a top crasher, bail out.
    return

  if len(top_crash_platforms) == 1:
    platform_message = '%s platform' % top_crash_platforms[0]
  else:
    platform_message = '%s and %s platforms' % (', '.join(
        top_crash_platforms[:-1]), top_crash_platforms[-1])

  fuzzer_name = (
      testcase.get_metadata('fuzzer_binary_name') or testcase.fuzzer_name)
  update_message = (
      'This crash occurs very frequently on %s and is likely preventing the '
      'fuzzer %s from making much progress. Fixing this will allow more bugs '
      'to be found.' % (platform_message, fuzzer_name))
  if utils.is_oss_fuzz():
    update_message += OSS_FUZZ_INCORRECT_COMMENT
  elif utils.is_chromium():
    update_message += '\n\nMarking this bug as a blocker for next Beta release.'
    update_message = _append_generic_incorrect_comment(
        update_message,
        policy,
        issue,
        ' and remove the {label_text}.'.format(
            label_text=issue.issue_tracker.label_text(
                data_types.CHROMIUM_ISSUE_RELEASEBLOCK_BETA_LABEL)))
    issue.labels.add(data_types.CHROMIUM_ISSUE_RELEASEBLOCK_BETA_LABEL)

    # Update with the next beta for trunk, and remove existing milestone label.
    beta_milestone_label = (
        'M-%d' % build_info.get_release_milestone('head', testcase.platform))
    if beta_milestone_label not in issue.labels:
      issue.labels.remove_by_prefix('M-')
      issue.labels.add(beta_milestone_label)

  logs.log(update_message)
  issue.labels.add(fuzz_blocker_label)
  issue.save(new_comment=update_message, notify=True)
Пример #2
0
def update_fuzz_blocker_label(testcase, issue,
                              top_crashes_by_project_and_platform_map):
    """Add top crash label to issue."""
    if not issue:
        return

    if not testcase.open:
        return

    top_crash_platforms = get_top_crash_platforms(
        testcase, top_crashes_by_project_and_platform_map)
    if not top_crash_platforms:
        # Not a top crasher, bail out.
        return

    if issue.has_comment_with_label(data_types.ISSUE_FUZZ_BLOCKER_LABEL):
        # Issue was already marked a top crasher, bail out.
        return

    if len(top_crash_platforms) == 1:
        platform_message = '%s platform' % top_crash_platforms[0]
    else:
        platform_message = '%s and %s platforms' % (', '.join(
            top_crash_platforms[:-1]), top_crash_platforms[-1])

    fuzzer_name = (testcase.get_metadata('fuzzer_binary_name')
                   or testcase.fuzzer_name)
    update_message = (
        'This crash occurs very frequently on %s and is likely preventing the '
        'fuzzer %s from making much progress. Fixing this will allow more bugs '
        'to be found.' % (platform_message, fuzzer_name))
    if utils.is_oss_fuzz():
        update_message += OSS_FUZZ_INCORRECT_COMMENT
    else:
        update_message += '\n\nMarking this bug as a blocker for next Beta release.'
        update_message += INTERNAL_INCORRECT_COMMENT
        update_message += (' and remove the %s label.' %
                           data_types.ISSUE_RELEASEBLOCK_BETA_LABEL)
        issue.add_label(data_types.ISSUE_RELEASEBLOCK_BETA_LABEL)

        # Update with the next beta for trunk, and remove existing milestone label.
        beta_milestone_label = (
            'M-%d' %
            build_info.get_release_milestone('head', testcase.platform))
        if not issue.has_label(beta_milestone_label):
            issue.remove_label_by_prefix('M-')
            issue.add_label(beta_milestone_label)

    logs.log(update_message)
    issue.add_label(data_types.ISSUE_FUZZ_BLOCKER_LABEL)
    issue.comment = update_message
    issue.save(send_email=True)
Пример #3
0
 def test_get_milestone_for_release(self):
   """Tests get_milestone_for_release."""
   for platform in ['android', 'linux', 'mac', 'windows']:
     self.assertEqual(build_info.get_release_milestone('stable', platform), 60)
     self.assertEqual(build_info.get_release_milestone('beta', platform), 61)
     self.assertEqual(build_info.get_release_milestone('head', platform), 62)