Exemple #1
0
def ninja_check_all_report(step: Step, _: Report, filter_output: bool):
    print('Full log will be available in Artifacts "ninja-check-all.log"',
          flush=True)
    step.reproduce_commands.append('ninja check-all')
    with open(f'{artifacts_dir}/ninja-check-all.log', 'wb') as f:
        w = sys.stdout.buffer.write
        if filter_output:
            r = re.compile(
                r'^(\[.*] (Building|Linking|Generating)|(PASS|XFAIL|UNSUPPORTED):)'
            )
            w = partial(if_not_matches,
                        write=sys.stdout.buffer.write,
                        regexp=r)
        rc = watch_shell(partial(tee, write1=w, write2=f.write),
                         partial(tee,
                                 write1=sys.stderr.buffer.write,
                                 write2=f.write),
                         'ninja check-all',
                         cwd=build_dir)
        logging.debug(f'ninja check-all: returned {rc}')
        step.set_status_from_exit_code(rc)
    test_results_report.run(build_dir, 'test-results.xml', step, report)
    if not step.success:
        message = 'tests failed'
        f = report.test_stats['fail']
        if f == 1:
            message = '1 test failed'
        if f > 1:
            message = f'{f} tests failed'
        report.add_artifact(artifacts_dir, 'ninja-check-all.log', message)
def cmake_report(projects: str, step: Step, _: Report):
    global build_dir
    cmake_result, build_dir, cmake_artifacts = run_cmake.run(
        projects, os.getcwd())
    for file in cmake_artifacts:
        if os.path.exists(file):
            shutil.copy2(file, artifacts_dir)
    step.set_status_from_exit_code(cmake_result)
def ninja_all_report(step: Step, _: Report):
    print('Full log will be available in Artifacts "ninja-all.log"',
          flush=True)
    r = subprocess.run(
        f'ninja all | '
        f'tee {artifacts_dir}/ninja-all.log | '
        f'grep -vE "\\[.*] (Building|Linking|Linting|Copying|Generating|Creating)"',
        shell=True,
        cwd=build_dir)
    logging.debug(f'ninja all: returned {r.returncode}, stderr: "{r.stderr}"')
    step.set_status_from_exit_code(r.returncode)
def ninja_check_all_report(step: Step, _: Report):
    print('Full log will be available in Artifacts "ninja-check-all.log"',
          flush=True)
    r = subprocess.run(
        f'ninja check-all | tee {artifacts_dir}/ninja-check-all.log | '
        f'grep -vE "^\\[.*] (Building|Linking)" | '
        f'grep -vE "^(PASS|XFAIL|UNSUPPORTED):"',
        shell=True,
        cwd=build_dir)
    logging.debug(
        f'ninja check-all: returned {r.returncode}, stderr: "{r.stderr}"')
    step.set_status_from_exit_code(r.returncode)
    test_results_report.run(build_dir, 'test-results.xml', step, report)
Exemple #5
0
def ninja_all_report(step: Step, _: Report, filter_output: bool):
    print('Full log will be available in Artifacts "ninja-all.log"',
          flush=True)
    step.reproduce_commands.append('ninja all')
    with open(f'{artifacts_dir}/ninja-all.log', 'wb') as f:
        w = sys.stdout.buffer.write
        if filter_output:
            r = re.compile(
                r'^\[.*] (Building|Linking|Linting|Copying|Generating|Creating)'
            )
            w = partial(if_not_matches,
                        write=sys.stdout.buffer.write,
                        regexp=r)
        rc = watch_shell(partial(tee, write1=w, write2=f.write),
                         partial(tee,
                                 write1=sys.stderr.buffer.write,
                                 write2=f.write),
                         'ninja all',
                         cwd=build_dir)
        logging.debug(f'ninja all: returned {rc}')
        step.set_status_from_exit_code(rc)
        if not step.success:
            report.add_artifact(artifacts_dir, 'ninja-all.log', 'build failed')