示例#1
0
def run(args):
    options = parser.parse_args(args)

    if options.benchmark:
        options.num_processes = 1

    if options.setup is not None:
        global_env = merge_suite_options(options)
    else:
        global_env = build.EnvironmentVariables()
        if options.timeout_multiplier is None:
            options.timeout_multiplier = 1

    setattr(options, 'global_env', global_env)

    if options.verbose and options.quiet:
        print('Can not be both quiet and verbose at the same time.')
        return 1

    check_bin = None
    if options.gdb:
        options.verbose = True
        if options.wrapper:
            print('Must not specify both a wrapper and gdb at the same time.')
            return 1
        check_bin = 'gdb'

    if options.wrapper:
        check_bin = options.wrapper[0]

    if check_bin is not None:
        exe = ExternalProgram(check_bin, silent=True)
        if not exe.found():
            sys.exit("Could not find requested program: %s" % check_bin)
    options.wd = os.path.abspath(options.wd)

    if not options.list and not options.no_rebuild:
        if not rebuild_all(options.wd):
            sys.exit(-1)

    try:
        th = TestHarness(options)
        if options.list:
            list_tests(th)
            return 0
        if not options.args:
            return th.doit()
        return th.run_special()
    except TestException as e:
        print('Meson test encountered an error:\n')
        print(e)
        return 1
示例#2
0
def run(args):
    options = parser.parse_args(args)

    if options.benchmark:
        options.num_processes = 1

    if options.setup is not None:
        global_env = merge_suite_options(options)
    else:
        global_env = build.EnvironmentVariables()
        if options.timeout_multiplier is None:
            options.timeout_multiplier = 1

    setattr(options, 'global_env', global_env)

    if options.verbose and options.quiet:
        print('Can not be both quiet and verbose at the same time.')
        return 1

    check_bin = None
    if options.gdb:
        options.verbose = True
        if options.wrapper:
            print('Must not specify both a wrapper and gdb at the same time.')
            return 1
        check_bin = 'gdb'

    if options.wrapper:
        check_bin = options.wrapper[0]

    if check_bin is not None:
        exe = ExternalProgram(check_bin, silent=True)
        if not exe.found():
            sys.exit("Could not find requested program: %s" % check_bin)
    options.wd = os.path.abspath(options.wd)

    if not options.list and not options.no_rebuild:
        if not rebuild_all(options.wd):
            sys.exit(-1)

    try:
        th = TestHarness(options)
        if options.list:
            list_tests(th)
            return 0
        if not options.args:
            return th.doit()
        return th.run_special()
    except TestException as e:
        print('Mesontest encountered an error:\n')
        print(e)
        return 1
示例#3
0
文件: dist.py 项目: z3ntu/meson
def run_dist_scripts(dist_root, dist_scripts):
    assert(os.path.isabs(dist_root))
    env = os.environ.copy()
    env['MESON_DIST_ROOT'] = dist_root
    for d in dist_scripts:
        print('Processing dist script %s.' % d)
        ddir, dname = os.path.split(d)
        ep = ExternalProgram(dname,
                             search_dir=os.path.join(dist_root, ddir),
                             silent=True)
        if not ep.found():
            sys.exit('Script %s could not be found in dist directory.' % d)
        pc = subprocess.run(ep.command, env=env)
        if pc.returncode != 0:
            sys.exit('Dist script errored out.')
示例#4
0
def run(args):
    options = buildparser().parse_args(args)

    if options.benchmark:
        options.num_processes = 1

    if options.verbose and options.quiet:
        print('Can not be both quiet and verbose at the same time.')
        return 1

    check_bin = None
    if options.gdb:
        options.verbose = True
        if options.wrapper:
            print('Must not specify both a wrapper and gdb at the same time.')
            return 1
        check_bin = 'gdb'

    if options.wrapper:
        check_bin = options.wrapper[0]

    if check_bin is not None:
        exe = ExternalProgram(check_bin, silent=True)
        if not exe.found():
            print('Could not find requested program: {!r}'.format(check_bin))
            return 1
    options.wd = os.path.abspath(options.wd)

    if not options.list and not options.no_rebuild:
        if not rebuild_all(options.wd):
            return 1

    try:
        th = TestHarness(options)
        if options.list:
            list_tests(th)
            return 0
        if not options.args:
            return th.doit()
        return th.run_special()
    except TestException as e:
        print('Meson test encountered an error:\n')
        if os.environ.get('MESON_FORCE_BACKTRACE'):
            raise e
        else:
            print(e)
        return 1
示例#5
0
文件: mtest.py 项目: thiblahute/meson
def run(args):
    options = buildparser().parse_args(args)

    if options.benchmark:
        options.num_processes = 1

    if options.verbose and options.quiet:
        print('Can not be both quiet and verbose at the same time.')
        return 1

    check_bin = None
    if options.gdb:
        options.verbose = True
        if options.wrapper:
            print('Must not specify both a wrapper and gdb at the same time.')
            return 1
        check_bin = 'gdb'

    if options.wrapper:
        check_bin = options.wrapper[0]

    if check_bin is not None:
        exe = ExternalProgram(check_bin, silent=True)
        if not exe.found():
            print('Could not find requested program: {!r}'.format(check_bin))
            return 1
    options.wd = os.path.abspath(options.wd)

    if not options.list and not options.no_rebuild:
        if not rebuild_all(options.wd):
            return 1

    try:
        th = TestHarness(options)
        if options.list:
            list_tests(th)
            return 0
        if not options.args:
            return th.doit()
        return th.run_special()
    except TestException as e:
        print('Meson test encountered an error:\n')
        if os.environ.get('MESON_FORCE_BACKTRACE'):
            raise e
        else:
            print(e)
        return 1