Пример #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--failfast', action='store_true')
    parser.add_argument('cross_file')
    options = parser.parse_args()
    setup_commands('ninja')
    return runtests(options.cross_file, options.failfast)
Пример #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--failfast', action='store_true')
    parser.add_argument('cross_file')
    options = parser.parse_args()
    setup_commands('ninja')
    return runtests(options.cross_file, options.failfast)
Пример #3
0
def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument('case', type=pathlib.Path, help='The test case to run')
    parser.add_argument('--subtest', type=int, action='append', dest='subtests', help='which subtests to run')
    parser.add_argument('--backend', action='store', help="Which backend to use")
    parser.add_argument('--cross-file', action='store', help='File describing cross compilation environment.')
    parser.add_argument('--native-file', action='store', help='File describing native compilation environment.')
    parser.add_argument('--use-tmpdir', action='store_true', help='Use tmp directory for temporary files.')
    args = T.cast('ArgumentType', parser.parse_args())

    setup_commands(args.backend)
    detect_system_compiler(args)
    print_tool_versions()

    test = TestDef(args.case, args.case.stem, [])
    tests = load_test_json(test, False)
    if args.subtests:
        tests = [t for i, t in enumerate(tests) if i in args.subtests]

    results = [run_test(t, t.args, '', True) for t in tests]
    failed = False
    for test, result in zip(tests, results):
        if (result is None) or (('MESON_SKIP_TEST' in result.stdo) and (skippable(str(args.case.parent), test.path.as_posix()))):
            msg = mlog.yellow('SKIP:')
        elif result.msg:
            msg = mlog.red('FAIL:')
            failed = True
Пример #4
0
def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument('case', type=pathlib.Path, help='The test case to run')
    parser.add_argument('--subtest',
                        type=int,
                        action='append',
                        dest='subtests',
                        help='which subtests to run')
    parser.add_argument('--backend',
                        action='store',
                        help="Which backend to use")
    parser.add_argument('--cross-file',
                        action='store',
                        help='File describing cross compilation environment.')
    parser.add_argument('--native-file',
                        action='store',
                        help='File describing native compilation environment.')
    parser.add_argument('--use-tmpdir',
                        action='store_true',
                        help='Use tmp directory for temporary files.')
    args = T.cast('ArgumentType', parser.parse_args())

    setup_commands(args.backend)
    detect_system_compiler(args)
    print_tool_versions()

    test = TestDef(args.case, args.case.stem, [])
    tests = load_test_json(test, False)
    if args.subtests:
        tests = [t for i, t in enumerate(tests) if i in args.subtests]

    results = [run_test(t, t.args, '', True) for t in tests]
    failed = False
    for test, result in zip(tests, results):
        if (result is None) or ('MESON_SKIP_TEST' in result.stdo):
            msg = mlog.yellow('SKIP:')
        elif result.msg:
            msg = mlog.red('FAIL:')
            failed = True
        else:
            msg = mlog.green('PASS:'******'MESON_SKIP_TEST' not in result.stdo:
            mlog.log('reason:', result.msg)
            if result.step is BuildStep.configure:
                # For configure failures, instead of printing stdout,
                # print the meson log if available since it's a superset
                # of stdout and often has very useful information.
                mlog.log(result.mlog)
            else:
                mlog.log(result.stdo)
            for cmd_res in result.cicmds:
                mlog.log(cmd_res)
            mlog.log(result.stde)

    exit(1 if failed else 0)
Пример #5
0
from run_project_tests import gather_tests, run_tests, StopException, setup_commands
from run_project_tests import failing_logs
from run_tests import setup_pythonpath


def runtests(cross_file):
    commontests = [('common', gather_tests(Path('test cases',
                                                'common')), False)]
    try:
        (passing_tests, failing_tests,
         skipped_tests) = run_tests(commontests, 'meson-cross-test-run',
                                    ['--cross', cross_file])
    except StopException:
        pass
    print('\nTotal passed cross tests:', passing_tests)
    print('Total failed cross tests:', failing_tests)
    print('Total skipped cross tests:', skipped_tests)
    if failing_tests > 0 and ('TRAVIS' in os.environ
                              or 'APPVEYOR' in os.environ):
        print('\nMesonlogs of failing tests\n')
        for l in failing_logs:
            print(l, '\n')
    sys.exit(failing_tests)


if __name__ == '__main__':
    setup_commands('ninja')
    setup_pythonpath()
    cross_file = sys.argv[1]
    runtests(cross_file)
Пример #6
0
def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument('case', type=pathlib.Path, help='The test case to run')
    parser.add_argument('--subtest',
                        type=int,
                        action='append',
                        dest='subtests',
                        help='which subtests to run')
    parser.add_argument('--backend',
                        action='store',
                        help="Which backend to use")
    parser.add_argument('--cross-file',
                        action='store',
                        help='File describing cross compilation environment.')
    parser.add_argument('--native-file',
                        action='store',
                        help='File describing native compilation environment.')
    parser.add_argument('--use-tmpdir',
                        action='store_true',
                        help='Use tmp directory for temporary files.')
    args = T.cast('ArgumentType', parser.parse_args())

    setup_commands(args.backend)
    detect_system_compiler(args)
    print_tool_versions()

    test = TestDef(args.case, args.case.stem, [])
    tests = load_test_json(test, False)
    if args.subtests:
        tests = [t for i, t in enumerate(tests) if i in args.subtests]

    def should_fail(path: pathlib.Path) -> str:
        dir_ = path.parent.stem
        # FIXME: warning tets might not be handled correctly still…
        if dir_.startswith(('failing', 'warning')):
            if ' ' in dir_:
                return dir_.split(' ')[1]
            return 'meson'
        return ''

    results = [
        run_test(t, t.args, should_fail(t.path), args.use_tmpdir)
        for t in tests
    ]
    failed = False
    for test, result in zip(tests, results):
        if result is None:
            is_skipped = True
            skip_reason = 'not run because preconditions were not met'
        else:
            for l in result.stdo.splitlines():
                if test_emits_skip_msg(l):
                    is_skipped = True
                    offset = l.index('MESON_SKIP_TEST') + 16
                    skip_reason = l[offset:].strip()
                    break
            else:
                is_skipped = False
                skip_reason = ''

        if is_skipped:
            msg = mlog.yellow('SKIP:')
        elif result.msg:
            msg = mlog.red('FAIL:')
            failed = True
        else:
            msg = mlog.green('PASS:'******'Reason:'), skip_reason)
        if result is not None and result.msg and 'MESON_SKIP_TEST' not in result.stdo:
            mlog.log('reason:', result.msg)
            if result.step is BuildStep.configure:
                # For configure failures, instead of printing stdout,
                # print the meson log if available since it's a superset
                # of stdout and often has very useful information.
                mlog.log(result.mlog)
            else:
                mlog.log(result.stdo)
            for cmd_res in result.cicmds:
                mlog.log(cmd_res)
            mlog.log(result.stde)

    exit(1 if failed else 0)
Пример #7
0
1) setup of the cross build is platform specific
2) it can be slow (e.g. when invoking test apps via wine)

Eventually migrate to something fancier.'''

import sys, os

from run_project_tests import gather_tests, run_tests, StopException, setup_commands
from run_project_tests import failing_logs

def runtests(cross_file):
    commontests = [('common', gather_tests('test cases/common'), False)]
    try:
        (passing_tests, failing_tests, skipped_tests) = run_tests(commontests, 'meson-cross-test-run', ['--cross', cross_file])
    except StopException:
        pass
    print('\nTotal passed cross tests:', passing_tests)
    print('Total failed cross tests:', failing_tests)
    print('Total skipped cross tests:', skipped_tests)
    if failing_tests > 0 and ('TRAVIS' in os.environ or 'APPVEYOR' in os.environ):
        print('\nMesonlogs of failing tests\n')
        for l in failing_logs:
            print(l, '\n')
    sys.exit(failing_tests)

if __name__ == '__main__':
    setup_commands('ninja')
    cross_file = sys.argv[1]
    runtests(cross_file)