Example #1
0
 def test_valid_release_to_date(self):
     date = utils.date_of_release(8)
     self.assertEquals(date, "2011-08-16")
     date = utils.date_of_release(15)
     self.assertEquals(date, "2012-06-05")
     date = utils.date_of_release(34)
     self.assertEquals(date, "2014-09-02")
Example #2
0
 def test_valid_release_to_date(self):
     date = utils.date_of_release(8)
     self.assertEquals(date, "2011-08-16")
     date = utils.date_of_release(15)
     self.assertEquals(date, "2012-06-05")
     date = utils.date_of_release(34)
     self.assertEquals(date, "2014-09-02")
Example #3
0
def bisect_nightlies(runner, logger):
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    fetch_config = runner.fetch_config
    options = runner.options
    # TODO: currently every fetch_config is nightly aware. Shoud we test
    # for this to be sure here ?
    fetch_config.set_nightly_repo(options.repo)
    if not options.bad_release and not options.bad_date:
        options.bad_date = default_bad_date
        logger.info("No 'bad' date specified, using %s" % options.bad_date)
    elif options.bad_release and options.bad_date:
        raise MozRegressionError("Options '--bad_release' and '--bad_date'"
                                 " are incompatible.")
    elif options.bad_release:
        options.bad_date = date_of_release(options.bad_release)
        logger.info("Using 'bad' date %s for release %s"
                    % (options.bad_date, options.bad_release))
    if not options.good_release and not options.good_date:
        options.good_date = default_good_date
        logger.info("No 'good' date specified, using %s"
                    % options.good_date)
    elif options.good_release and options.good_date:
        raise MozRegressionError("Options '--good_release' and '--good_date'"
                                 " are incompatible.")
    elif options.good_release:
        options.good_date = date_of_release(options.good_release)
        logger.info("Using 'good' date %s for release %s"
                    % (options.good_date, options.good_release))

    good_date = parse_date(options.good_date)
    bad_date = parse_date(options.bad_date)
    if good_date > bad_date and not options.find_fix:
        raise MozRegressionError(("Good date %s is later than bad date %s."
                                  " Maybe you wanted to use the --find-fix"
                                  " flag ?") % (good_date, bad_date))
    elif good_date < bad_date and options.find_fix:
        raise MozRegressionError(("Bad date %s is later than good date %s."
                                  " You should not use the --find-fix flag"
                                  " in this case...") % (bad_date, good_date))

    return runner.bisect_nightlies(good_date, bad_date)
Example #4
0
def bisect_nightlies(runner, logger):
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    fetch_config = runner.fetch_config
    options = runner.options
    # TODO: currently every fetch_config is nightly aware. Shoud we test
    # for this to be sure here ?
    fetch_config.set_nightly_repo(options.repo)
    if not options.bad_release and not options.bad_date:
        options.bad_date = default_bad_date
        logger.info("No 'bad' date specified, using %s" % options.bad_date)
    elif options.bad_release and options.bad_date:
        raise MozRegressionError("Options '--bad_release' and '--bad_date'"
                                 " are incompatible.")
    elif options.bad_release:
        options.bad_date = date_of_release(options.bad_release)
        logger.info("Using 'bad' date %s for release %s"
                    % (options.bad_date, options.bad_release))
    if not options.good_release and not options.good_date:
        options.good_date = default_good_date
        logger.info("No 'good' date specified, using %s"
                    % options.good_date)
    elif options.good_release and options.good_date:
        raise MozRegressionError("Options '--good_release' and '--good_date'"
                                 " are incompatible.")
    elif options.good_release:
        options.good_date = date_of_release(options.good_release)
        logger.info("Using 'good' date %s for release %s"
                    % (options.good_date, options.good_release))

    good_date = parse_date(options.good_date)
    bad_date = parse_date(options.bad_date)
    if good_date > bad_date and not options.find_fix:
        raise MozRegressionError(("Good date %s is later than bad date %s."
                                  " Maybe you wanted to use the --find-fix"
                                  " flag ?") % (good_date, bad_date))
    elif good_date < bad_date and options.find_fix:
        raise MozRegressionError(("Bad date %s is later than good date %s."
                                  " You should not use the --find-fix flag"
                                  " in this case...") % (bad_date, good_date))

    return runner.bisect_nightlies(good_date, bad_date)
Example #5
0
def cli():
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    options = parse_args()
    logger = commandline.setup_logging("mozregression", options, {"mach": sys.stdout})

    fetch_config = create_config(options.app, mozinfo.os, options.bits)

    if fetch_config.is_inbound():
        # this can be useful for both inbound and nightly, because we
        # can go to inbound from nightly.
        fetch_config.set_inbound_branch(options.inbound_branch)

    if options.inbound:
        if not fetch_config.is_inbound():
            sys.exit('Unable to bissect inbound for `%s`' % fetch_config.app_name)
        if not options.last_good_revision or not options.first_bad_revision:
            sys.exit("If bisecting inbound, both --good-rev and --bad-rev"
                     " must be set")
        bisector = Bisector(fetch_config, options,
                            last_good_revision=options.last_good_revision,
                            first_bad_revision=options.first_bad_revision)
        app = bisector.bisect_inbound
    else:
        # TODO: currently every fetch_config is nightly aware. Shoud we test
        # for this to be sure here ?
        fetch_config.set_nightly_repo(options.repo)
        if not options.bad_release and not options.bad_date:
            options.bad_date = default_bad_date
            logger.info("No 'bad' date specified, using %s" % options.bad_date)
        elif options.bad_release and options.bad_date:
            sys.exit("Options '--bad_release' and '--bad_date' are"
                     " incompatible.")
        elif options.bad_release:
            options.bad_date = date_of_release(options.bad_release)
            if options.bad_date is None:
                sys.exit("Unable to find a matching date for release "
                         + str(options.bad_release))
            logger.info("Using 'bad' date %s for release %s"
                        % (options.bad_date, options.bad_release))
        if not options.good_release and not options.good_date:
            options.good_date = default_good_date
            logger.info("No 'good' date specified, using %s"
                        % options.good_date)
        elif options.good_release and options.good_date:
            sys.exit("Options '--good_release' and '--good_date'"
                     " are incompatible.")
        elif options.good_release:
            options.good_date = date_of_release(options.good_release)
            if options.good_date is None:
                sys.exit("Unable to find a matching date for release "
                         + str(options.good_release))
            logger.info("Using 'good' date %s for release %s"
                        % (options.good_date, options.good_release))

        bisector = Bisector(fetch_config, options)
        app = bisector.bisect_nightlies
    try:
        app()
    except KeyboardInterrupt:
        sys.exit("\nInterrupted.")
    except errors.MozRegressionError as exc:
        sys.exit(str(exc))
Example #6
0
 def test_invalid_release_to_date(self):
     with self.assertRaises(errors.UnavailableRelease):
         utils.date_of_release(4)
     with self.assertRaises(errors.UnavailableRelease):
         utils.date_of_release(441)
Example #7
0
 def test_invalid_release_to_date(self):
     date = utils.date_of_release(4)
     self.assertEquals(date, None)
     date = utils.date_of_release(441)
     self.assertEquals(date, None)
Example #8
0
 def test_invalid_release_to_date(self):
     with self.assertRaises(errors.UnavailableRelease):
         utils.date_of_release(4)
     with self.assertRaises(errors.UnavailableRelease):
         utils.date_of_release(441)
Example #9
0
def cli():
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    parser = OptionParser()
    parser.add_option("-b",
                      "--bad",
                      dest="bad_date",
                      help="first known bad nightly build, default is today",
                      metavar="YYYY-MM-DD",
                      default=None)
    parser.add_option("-g",
                      "--good",
                      dest="good_date",
                      help="last known good nightly build",
                      metavar="YYYY-MM-DD",
                      default=None)
    parser.add_option("--bad-release",
                      dest="bad_release",
                      type=int,
                      help="first known bad nightly build. This option is "
                      "incompatible with --bad.")
    parser.add_option("--good-release",
                      dest="good_release",
                      type=int,
                      help="last known good nightly build. This option is "
                      "incompatible with --good.")
    parser.add_option("-e",
                      "--addon",
                      dest="addons",
                      help="an addon to install; repeat for multiple addons",
                      metavar="PATH1",
                      default=[],
                      action="append")
    parser.add_option("-p",
                      "--profile",
                      dest="profile",
                      help="profile to use with nightlies",
                      metavar="PATH")
    parser.add_option(
        "-a",
        "--arg",
        dest="cmdargs",
        help="a command-line argument to pass to the application;"
        " repeat for multiple arguments",
        metavar="ARG1",
        default=[],
        action="append")
    parser.add_option("-n",
                      "--app",
                      dest="app",
                      help="application name  (firefox, fennec,"
                      " thunderbird or b2g)",
                      metavar="[firefox|fennec|thunderbird|b2g]",
                      default="firefox")
    parser.add_option("--inbound-branch",
                      dest="inbound_branch",
                      help="inbound branch name on ftp.mozilla.org",
                      metavar="[tracemonkey|mozilla-1.9.2]",
                      default=None)
    parser.add_option("--bits",
                      dest="bits",
                      help="force 32 or 64 bit version (only applies to"
                      " x86_64 boxes)",
                      choices=("32", "64"),
                      default=mozinfo.bits)
    parser.add_option("--persist",
                      dest="persist",
                      help="the directory in which files are to persist ie."
                      " /Users/someuser/Documents")
    parser.add_option("--inbound",
                      action="store_true",
                      dest="inbound",
                      help="use inbound instead of nightlies (use --good-rev"
                      " and --bad-rev options")
    parser.add_option("--bad-rev",
                      dest="first_bad_revision",
                      help="first known bad revision (use with --inbound)")
    parser.add_option("--good-rev",
                      dest="last_good_revision",
                      help="last known good revision (use with --inbound)")
    parser.add_option("--version",
                      dest="version",
                      action="store_true",
                      help="print the mozregression version number and exits")

    (options, args) = parser.parse_args()

    if options.version:
        print __version__
        sys.exit(0)

    options.bits = parse_bits(options.bits)

    inbound_runner = None
    if options.app in ("firefox", "fennec", "b2g"):
        inbound_runner = InboundRunner(appname=options.app,
                                       addons=options.addons,
                                       inbound_branch=options.inbound_branch,
                                       profile=options.profile,
                                       cmdargs=options.cmdargs,
                                       bits=options.bits,
                                       persist=options.persist)

    if options.inbound:
        if not options.last_good_revision or not options.first_bad_revision:
            print "If bisecting inbound, both --good-rev and --bad-rev " \
                " must be set"
            sys.exit(1)
        bisector = Bisector(None,
                            inbound_runner,
                            appname=options.app,
                            last_good_revision=options.last_good_revision,
                            first_bad_revision=options.first_bad_revision)
        app = bisector.bisect_inbound
    else:
        if not options.bad_release and not options.bad_date:
            options.bad_date = default_bad_date
            print "No 'bad' date specified, using " + options.bad_date
        elif options.bad_release and options.bad_date:
            raise Exception("Options '--bad_release' and '--bad_date' "
                            "are incompatible.")
        elif options.bad_release:
            options.bad_date = date_of_release(options.bad_release)
            if options.bad_date is None:
                raise Exception("Unable to find a matching date for release " +
                                str(options.bad_release))
            print "Using 'bad' date " + options.bad_date + " for release " + \
                  str(options.bad_release)
        if not options.good_release and not options.good_date:
            options.good_date = default_good_date
            print "No 'good' date specified, using " + options.good_date
        elif options.good_release and options.good_date:
            raise Exception("Options '--good_release' and '--good_date' "
                            "are incompatible.")
        elif options.good_release:
            options.good_date = date_of_release(options.good_release)
            if options.good_date is None:
                raise Exception("Unable to find a matching date for release " +
                                str(options.good_release))
            print "Using 'good' date " + options.good_date + " for release " + \
                  str(options.good_release)

        nightly_runner = NightlyRunner(appname=options.app,
                                       addons=options.addons,
                                       inbound_branch=options.inbound_branch,
                                       profile=options.profile,
                                       cmdargs=options.cmdargs,
                                       bits=options.bits,
                                       persist=options.persist)
        bisector = Bisector(nightly_runner,
                            inbound_runner,
                            appname=options.app)
        app = lambda: bisector.bisect_nightlies(get_date(options.good_date),
                                                get_date(options.bad_date))
    try:
        app()
    except KeyboardInterrupt:
        sys.exit("\nInterrupted.")
    except errors.MozRegressionError as exc:
        sys.exit(str(exc))
Example #10
0
def cli():
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    options = parse_args()
    logger = commandline.setup_logging("mozregression", options,
                                       {"mach": sys.stdout})

    fetch_config = create_config(options.app, mozinfo.os, options.bits)

    if fetch_config.is_inbound():
        # this can be useful for both inbound and nightly, because we
        # can go to inbound from nightly.
        fetch_config.set_inbound_branch(options.inbound_branch)

    if options.inbound:
        if not fetch_config.is_inbound():
            sys.exit('Unable to bissect inbound for `%s`' %
                     fetch_config.app_name)
        if not options.last_good_revision or not options.first_bad_revision:
            sys.exit("If bisecting inbound, both --good-rev and --bad-rev"
                     " must be set")
        bisector = Bisector(fetch_config,
                            options,
                            last_good_revision=options.last_good_revision,
                            first_bad_revision=options.first_bad_revision)
        app = bisector.bisect_inbound
    else:
        # TODO: currently every fetch_config is nightly aware. Shoud we test
        # for this to be sure here ?
        fetch_config.set_nightly_repo(options.repo)
        if not options.bad_release and not options.bad_date:
            options.bad_date = default_bad_date
            logger.info("No 'bad' date specified, using %s" % options.bad_date)
        elif options.bad_release and options.bad_date:
            sys.exit("Options '--bad_release' and '--bad_date' are"
                     " incompatible.")
        elif options.bad_release:
            options.bad_date = date_of_release(options.bad_release)
            if options.bad_date is None:
                sys.exit("Unable to find a matching date for release " +
                         str(options.bad_release))
            logger.info("Using 'bad' date %s for release %s" %
                        (options.bad_date, options.bad_release))
        if not options.good_release and not options.good_date:
            options.good_date = default_good_date
            logger.info("No 'good' date specified, using %s" %
                        options.good_date)
        elif options.good_release and options.good_date:
            sys.exit("Options '--good_release' and '--good_date'"
                     " are incompatible.")
        elif options.good_release:
            options.good_date = date_of_release(options.good_release)
            if options.good_date is None:
                sys.exit("Unable to find a matching date for release " +
                         str(options.good_release))
            logger.info("Using 'good' date %s for release %s" %
                        (options.good_date, options.good_release))

        bisector = Bisector(fetch_config, options)
        app = bisector.bisect_nightlies
    try:
        app()
    except KeyboardInterrupt:
        sys.exit("\nInterrupted.")
    except errors.MozRegressionError as exc:
        sys.exit(str(exc))
Example #11
0
 def test_invalid_release_to_date(self):
     date = utils.date_of_release(4)
     self.assertEquals(date, None)
     date = utils.date_of_release(441)
     self.assertEquals(date, None)
Example #12
0
def cli():
    default_bad_date = str(datetime.date.today())
    default_good_date = "2009-01-01"
    options = parse_args()

    inbound_runner = None
    if options.app in ("firefox", "fennec", "b2g") and not (mozinfo.os == 'win' and options.bits == 64):
        inbound_runner = InboundRunner(appname=options.app,
                                       addons=options.addons,
                                       inbound_branch=options.inbound_branch,
                                       profile=options.profile,
                                       cmdargs=options.cmdargs,
                                       bits=options.bits,
                                       persist=options.persist)

    if options.inbound:
        if not options.last_good_revision or not options.first_bad_revision:
            sys.exit("If bisecting inbound, both --good-rev and --bad-rev"
                     " must be set")
        bisector = Bisector(None, inbound_runner, appname=options.app,
                            last_good_revision=options.last_good_revision,
                            first_bad_revision=options.first_bad_revision)
        app = bisector.bisect_inbound
    else:
        if not options.bad_release and not options.bad_date:
            options.bad_date = default_bad_date
            print "No 'bad' date specified, using " + options.bad_date
        elif options.bad_release and options.bad_date:
            sys.exit("Options '--bad_release' and '--bad_date' are"
                     " incompatible.")
        elif options.bad_release:
            options.bad_date = date_of_release(options.bad_release)
            if options.bad_date is None:
                sys.exit("Unable to find a matching date for release "
                         + str(options.bad_release))
            print "Using 'bad' date " + options.bad_date + " for release " + \
                  str(options.bad_release)
        if not options.good_release and not options.good_date:
            options.good_date = default_good_date
            print "No 'good' date specified, using " + options.good_date
        elif options.good_release and options.good_date:
            sys.exit("Options '--good_release' and '--good_date'"
                     " are incompatible.")
        elif options.good_release:
            options.good_date = date_of_release(options.good_release)
            if options.good_date is None:
                sys.exit("Unable to find a matching date for release "
                         + str(options.good_release))
            print "Using 'good' date " + options.good_date + " for release " + \
                  str(options.good_release)

        nightly_runner = NightlyRunner(appname=options.app, addons=options.addons,
                                       inbound_branch=options.inbound_branch,
                                       profile=options.profile,
                                       cmdargs=options.cmdargs,
                                       bits=options.bits,
                                       persist=options.persist)
        bisector = Bisector(nightly_runner, inbound_runner,
                            appname=options.app)
        app = lambda: bisector.bisect_nightlies(get_date(options.good_date),
                                                get_date(options.bad_date))
    try:
        app()
    except KeyboardInterrupt:
        sys.exit("\nInterrupted.")
    except errors.MozRegressionError as exc:
        sys.exit(str(exc))