Beispiel #1
0
def main():
    parser = argparse.ArgumentParser(description='catapult bench runner')
    parser.add_argument('--exe-path', help='path to executables', required=True)
    parser.add_argument('--out-dir', help='directory in which to store bench output files', required=True)
    parser.add_argument('--dry-run', help='outputs desired commands without runing them', action='store_true')
    args = parser.parse_args()

    process_manager = ProcessManager(args.dry_run)
    environment_manager = EnvironmentManager(args.dry_run)

    for filepath in environment_manager.find_glob(args.exe_path, 'bench*'):
        output_filepath = Path(args.out_dir) / (filepath.name + '.json')
        process_manager.dispatch_subprocess([filepath, '--benchmark_out=' + str(output_filepath)])
Beispiel #2
0
def main():
    parser = argparse.ArgumentParser(description='catapult test runner')
    parser.add_argument('--compiler-configuration',
                        help='path to compiler configuration yaml',
                        required=True)
    parser.add_argument('--exe-path',
                        help='path to executables',
                        required=True)
    parser.add_argument('--out-dir',
                        help='directory in which to store test output files',
                        required=True)
    parser.add_argument('--verbosity',
                        help='output verbosity',
                        choices=('suite', 'test', 'max'),
                        default='max')
    parser.add_argument('--dry-run',
                        help='outputs desired commands without runing them',
                        action='store_true')
    args = parser.parse_args()

    process_manager = ProcessManager(args.dry_run)
    environment_manager = EnvironmentManager(args.dry_run)

    compiler_configuration = load_compiler_configuration(
        args.compiler_configuration)
    sanitizer_environment = SanitizerEnvironment(
        environment_manager, compiler_configuration.sanitizers)
    sanitizer_environment.prepare()

    prepare_tests(environment_manager)

    process_manager.dispatch_subprocess(['ls', '-laF', '.'])
    process_manager.dispatch_subprocess(['ls', '-laF', '/catapult-data'])
    process_manager.dispatch_subprocess(['ls', '-laF', '/catapult-src'])

    failed_test_suites = []
    for test_exe_filepath in environment_manager.find_glob(
            args.exe_path, 'tests*'):
        base_output_filepath = Path(args.out_dir) / test_exe_filepath.name

        output_filepath = '{}.xml'.format(base_output_filepath)
        test_args = [
            test_exe_filepath, '--gtest_output=xml:{}'.format(output_filepath),
            Path(args.exe_path) / '..' / 'lib'
        ]

        if process_manager.dispatch_test_subprocess(test_args, args.verbosity):
            for core_path in Path('.').glob('core*'):
                handle_core_file(process_manager, core_path, test_exe_filepath,
                                 base_output_filepath)

            failed_test_suites.append(test_exe_filepath)

        process_sanitizer_logs_all(environment_manager, Path(args.out_dir),
                                   test_exe_filepath.name)

    if failed_test_suites:
        print('test failures detected')
        for test_suite in sorted(failed_test_suites):
            print('[*] {}'.format(test_suite))

        sys.exit(len(failed_test_suites))
    else:
        print('all tests succeeded')