def Main(argv):
    """The main function."""
    # Common initializations
    ###  command_executer.InitCommandExecuter(True)
    command_executer.InitCommandExecuter()
    parser = optparse.OptionParser()
    parser.add_option('--remote',
                      dest='remote',
                      help='Remote machines to run tests on.')
    parser.add_option('--board',
                      dest='board',
                      default='x86-zgb',
                      help='The target board.')
    parser.add_option('--ebuild_version',
                      dest='ebuild_version',
                      default='',
                      help='The Chrome ebuild version to use.')
    parser.add_option('--plus_pgo',
                      dest='plus_pgo',
                      action='store_true',
                      default=False,
                      help='Build USE=+pgo.')
    parser.add_option('--minus_pgo',
                      dest='minus_pgo',
                      action='store_true',
                      default=False,
                      help='Build USE=-pgo.')
    parser.add_option('--update_pgo',
                      dest='update_pgo',
                      action='store_true',
                      default=False,
                      help='Update pgo and build Chrome with the update.')
    parser.add_option('--chromeos_root',
                      dest='chromeos_root',
                      default=False,
                      help='The chromeos root directory')
    options, _ = parser.parse_args(argv)
    if not options.board:
        print 'Please give a board.'
        return 1
    if not options.remote:
        print 'Please give at least one remote machine.'
        return 1
    if not options.chromeos_root:
        print 'Please provide the chromeos root directory.'
        return 1
    if not any((options.minus_pgo, options.plus_pgo, options.update_pgo)):
        print 'Please provide at least one build option.'
        return 1
    fc = FDOComparator(options.board, options.remote, options.ebuild_version,
                       options.plus_pgo, options.minus_pgo, options.update_pgo,
                       os.path.expanduser(options.chromeos_root))
    return fc.DoAll()
def Main(argv):
    """The main function."""
    # Common initializations
    ###  command_executer.InitCommandExecuter(True)
    command_executer.InitCommandExecuter()
    l = logger.GetLogger()
    ce = command_executer.GetCommandExecuter()
    parser = optparse.OptionParser()
    parser.add_option('--cycler',
                      dest='cycler',
                      default='alexa_us',
                      help=('Comma-separated cyclers to profile. '
                            'Example: alexa_us,moz,moz2'
                            'Use all to profile all cyclers.'))
    parser.add_option('--chromeos_root',
                      dest='chromeos_root',
                      default='../../',
                      help='Output profile directory.')
    parser.add_option('--board',
                      dest='board',
                      default='x86-zgb',
                      help='The target board.')
    parser.add_option('--remote',
                      dest='remote',
                      help=('The remote chromeos machine that'
                            ' has the profile image.'))
    parser.add_option('--profile_dir',
                      dest='profile_dir',
                      default='profile_dir',
                      help='Store profiles in this directory.')

    options, _ = parser.parse_args(argv)

    all_cyclers = [
        'alexa_us', 'bloat', 'dhtml', 'dom', 'intl1', 'intl2', 'morejs',
        'morejsnp', 'moz', 'moz2'
    ]

    if options.cycler == 'all':
        options.cycler = ','.join(all_cyclers)

    try:
        cp = CyclerProfiler(options.chromeos_root, options.board,
                            options.cycler, options.profile_dir,
                            options.remote)
        cp.DoProfile()
        retval = 0
    except Exception as e:
        retval = 1
        print e
    finally:
        print 'Exiting...'
    return retval
def Main(argv):
    """The main function."""
    # Common initializations
    ###  command_executer.InitCommandExecuter(True)
    command_executer.InitCommandExecuter()
    parser = argparse.ArgumentParser()
    parser.add_argument('--remote',
                        dest='remote',
                        help='Remote machines to run tests on.')
    parser.add_argument('--board',
                        dest='board',
                        default='x86-alex',
                        help='The target board.')
    parser.add_argument('--githashes',
                        dest='githashes',
                        default='master',
                        help='The gcc githashes to test.')
    parser.add_argument('--clean',
                        dest='clean',
                        default=False,
                        action='store_true',
                        help='Clean the chroot after testing.')
    parser.add_argument('--public',
                        dest='public',
                        default=False,
                        action='store_true',
                        help='Use the public checkout/build.')
    parser.add_argument('--force-mismatch',
                        dest='force_mismatch',
                        default='',
                        help='Force the image regardless of board mismatch')
    parser.add_argument('--noschedv2',
                        dest='noschedv2',
                        action='store_true',
                        default=False,
                        help='Pass --noschedv2 to crosperf.')
    options = parser.parse_args(argv)
    if not options.board:
        print('Please give a board.')
        return 1
    if not options.remote:
        print('Please give at least one remote machine.')
        return 1
    toolchain_configs = []
    for githash in options.githashes.split(','):
        gcc_config = GCCConfig(githash=githash)
        toolchain_config = ToolchainConfig(gcc_config=gcc_config)
        toolchain_configs.append(toolchain_config)
    fc = ToolchainComparator(options.board, options.remote, toolchain_configs,
                             options.clean, options.public,
                             options.force_mismatch, options.noschedv2)
    return fc.DoAll()
예제 #4
0
def Main(argv):
    """The main function."""

    # Common initializations
    command_executer.InitCommandExecuter()
    parser = argparse.ArgumentParser()
    parser.add_argument('--remote',
                        dest='remote',
                        help='Remote machines to run tests on.')
    parser.add_argument('--board',
                        dest='board',
                        default='x86-zgb',
                        help='The target board.')
    parser.add_argument('--chromeos_root',
                        dest='chromeos_root',
                        help='The chromeos root from which to run tests.')
    parser.add_argument('--weekday',
                        default='',
                        dest='weekday',
                        help='The day of the week for which to run tests.')
    parser.add_argument('--patch',
                        dest='patches',
                        help='The patches to use for the testing, '
                        "seprate the patch numbers with ',' "
                        'for more than one patches.')
    parser.add_argument('--noschedv2',
                        dest='noschedv2',
                        action='store_true',
                        default=False,
                        help='Pass --noschedv2 to crosperf.')

    options = parser.parse_args(argv[1:])
    if not options.board:
        print('Please give a board.')
        return 1
    if not options.remote:
        print('Please give at least one remote machine.')
        return 1
    if not options.chromeos_root:
        print('Please specify the ChromeOS root directory.')
        return 1
    if options.patches:
        patches = options.patches
    else:
        patches = USE_NEXT_GCC_PATCH

    fc = ToolchainComparator(options.board, options.remote,
                             options.chromeos_root, options.weekday, patches,
                             options.noschedv2)
    return fc.DoAll()
예제 #5
0
def Main(argv):
    """The main function."""
    # Common initializations
    ###  command_executer.InitCommandExecuter(True)
    command_executer.InitCommandExecuter()
    l = logger.GetLogger()
    ce = command_executer.GetCommandExecuter()
    parser = optparse.OptionParser()
    parser.add_option(
        '--inputs',
        dest='inputs',
        help='Comma-separated input profile directories to merge.')
    parser.add_option('--output',
                      dest='output',
                      help='Output profile directory.')
    parser.add_option('--chunk_size',
                      dest='chunk_size',
                      default='50',
                      help='Chunk size to divide up the profiles into.')
    parser.add_option('--merge_program',
                      dest='merge_program',
                      default='/home/xur/bin/profile_merge_v15.par',
                      help='Merge program to use to do the actual merge.')
    parser.add_option('--multipliers',
                      dest='multipliers',
                      help='multipliers to use when merging. (optional)')

    options, _ = parser.parse_args(argv)

    if not all([options.inputs, options.output]):
        l.LogError('Must supply --inputs and --output')
        return 1

    try:
        pm = ProfileMerger(options.inputs.split(','), options.output,
                           int(options.chunk_size), options.merge_program,
                           options.multipliers)
        pm.DoMerge()
        retval = 0
    except:
        retval = 1
    finally:
        print 'My work is done...'
    return retval
def Main(argv):
    command_executer.InitCommandExecuter()
    usage = ('usage: %prog --data_dir=<dir> --cutoff=<value> '
             '--output_dir=<dir> [--keep_tmp]')
    parser = optparse.OptionParser(usage=usage)
    parser.add_option('--data_dir',
                      dest='data_dir',
                      help=('directory where the FDO (*.profile and '
                            '*.optimized) files are located'))
    parser.add_option('--cutoff',
                      dest='cutoff',
                      help='Minimum count to consider for each basic block')
    parser.add_option('--output_dir',
                      dest='output_dir',
                      help=('directory where summary data will be generated'
                            '(pre_optimized.txt, optimized.txt)'))
    parser.add_option('--keep_tmp',
                      action='store_true',
                      dest='keep_tmp',
                      default=False,
                      help=('Keep directory with temporary files'
                            '(for debugging purposes)'))
    options = parser.parse_args(argv)[0]
    if not all((options.data_dir, options.cutoff, options.output_dir)):
        parser.print_help()
        sys.exit(1)

    tempdir = tempfile.mkdtemp()

    co = Collector(options.data_dir, int(options.cutoff), options.output_dir,
                   tempdir)
    co.SummarizePreOptimized('pre_optimized.txt')
    co.SummarizeOptimized('optimized.txt')

    if not options.keep_tmp:
        shutil.rmtree(tempdir, ignore_errors=True)

    return 0
예제 #7
0
def Main(argv):
    """The main function."""

    command_executer.InitCommandExecuter()
    images = []

    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--no_unmount',
        action='store_true',
        dest='no_unmount',
        default=False,
        help='Do not unmount after finish, this is useful for debugging.')
    parser.add_argument(
        '--chromeos_root',
        dest='chromeos_root',
        default=None,
        action='store',
        help=('[Optional] Specify a chromeos tree instead of '
              'deducing it from image path so that we can compare '
              '2 images that are downloaded.'))
    parser.add_argument(
        '--mount_basename',
        dest='mount_basename',
        default=None,
        action='store',
        help=('Specify a meaningful name for the mount point. With this being '
              'set, the mount points would be "/tmp/mount_basename.x.rootfs" '
              ' and "/tmp/mount_basename.x.stateful". (x is 1 or 2).'))
    parser.add_argument('--diff_file',
                        dest='diff_file',
                        default=None,
                        help='Dumping all the diffs (if any) to the diff file')
    parser.add_argument('--image1',
                        dest='image1',
                        default=None,
                        required=True,
                        help=('Image 1 file name.'))
    parser.add_argument('--image2',
                        dest='image2',
                        default=None,
                        required=True,
                        help=('Image 2 file name.'))
    options = parser.parse_args(argv[1:])

    if options.mount_basename and options.mount_basename.find('/') >= 0:
        logger.GetLogger().LogError(
            '"--mount_basename" must be a name, not a path.')
        parser.print_help()
        return 1

    result = False
    image_comparator = None
    try:
        for i, image_path in enumerate([options.image1, options.image2],
                                       start=1):
            image_path = os.path.realpath(image_path)
            if not os.path.isfile(image_path):
                logger.getLogger().LogError(
                    '"{0}" is not a file.'.format(image_path))
                return 1

            chromeos_root = None
            if options.chromeos_root:
                chromeos_root = options.chromeos_root
            else:
                ## Deduce chromeos root from image
                t = image_path
                while t != '/':
                    if misc.IsChromeOsTree(t):
                        break
                    t = os.path.dirname(t)
                if misc.IsChromeOsTree(t):
                    chromeos_root = t

            if not chromeos_root:
                logger.GetLogger().LogError(
                    'Please provide a valid chromeos root via --chromeos_root')
                return 1

            image = CrosImage(image_path, chromeos_root, options.no_unmount)

            if options.mount_basename:
                mount_basename = '{basename}.{index}'.format(
                    basename=options.mount_basename, index=i)
            else:
                mount_basename = None

            if image.MountImage(mount_basename):
                images.append(image)
                image.FindElfFiles()

        if len(images) == 2:
            image_comparator = ImageComparator(images, options.diff_file)
            result = image_comparator.CompareImages()
    finally:
        for image in images:
            image.UnmountImage()
        if image_comparator:
            image_comparator.Cleanup()

    return 0 if result else 1
예제 #8
0
def Main(argv):
    """The main function."""

    # Common initializations
    command_executer.InitCommandExecuter()
    parser = argparse.ArgumentParser()
    parser.add_argument('--chromeos_root',
                        dest='chromeos_root',
                        help='The chromeos root from which to run tests.')
    parser.add_argument('--weekday',
                        default='',
                        dest='weekday',
                        help='The day of the week for which to run tests.')
    parser.add_argument('--board',
                        default='',
                        dest='board',
                        help='The board to test.')
    parser.add_argument('--patch',
                        dest='patches',
                        default='',
                        help='The patches to use for the testing, '
                        "seprate the patch numbers with ',' "
                        'for more than one patches.')
    parser.add_argument(
        '--compiler',
        dest='compiler',
        help='Which compiler (llvm, llvm-next or gcc) to use for '
        'testing.')

    options = parser.parse_args(argv[1:])
    if not options.chromeos_root:
        print('Please specify the ChromeOS root directory.')
        return 1
    if not options.compiler:
        print(
            'Please specify which compiler to test (gcc, llvm, or llvm-next).')
        return 1

    if options.board:
        fv = ToolchainVerifier(options.board, options.chromeos_root,
                               options.weekday, options.patches,
                               options.compiler)
        return fv.Doall()

    today = datetime.date.today()
    delta = today - START_DATE
    days = delta.days

    start_board = (days * TEST_PER_DAY) % len(TEST_BOARD)
    for i in range(TEST_PER_DAY):
        try:
            board = TEST_BOARD[(start_board + i) % len(TEST_BOARD)]
            fv = ToolchainVerifier(board, options.chromeos_root,
                                   options.weekday, options.patches,
                                   options.compiler)
            fv.DoAll()
        except SystemExit:
            logfile = os.path.join(VALIDATION_RESULT_DIR, options.compiler,
                                   board)
            with open(logfile, 'w') as f:
                f.write('Verifier got an exception, please check the log.\n')