Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

76 lines
2.2 KiB
Python

#!/usr/bin/env python
"""
Update reference results for static analyzer.
"""
import SATestBuild
from ProjectMap import ProjectInfo, ProjectMap
import os
import shutil
import sys
from subprocess import check_call
Verbose = 0
def update_reference_results(project: ProjectInfo, git: bool = False):
test_info = SATestBuild.TestInfo(project)
tester = SATestBuild.ProjectTester(test_info)
project_dir = tester.get_project_dir()
tester.is_reference_build = True
ref_results_path = tester.get_output_dir()
tester.is_reference_build = False
created_results_path = tester.get_output_dir()
if not os.path.exists(created_results_path):
print(
f"Skipping project '{project.name}', " f"it doesn't have newer results.",
file=sys.stderr,
)
return
build_log_path = SATestBuild.get_build_log_path(ref_results_path)
build_log_dir = os.path.dirname(os.path.abspath(build_log_path))
os.makedirs(build_log_dir)
with open(build_log_path, "w+") as build_log_file:
def run_cmd(command: str):
if Verbose:
print(f"Executing {command}")
check_call(command, shell=True, stdout=build_log_file)
# Remove reference results: in git, and then again for a good measure
# with rm, as git might not remove things fully if there are empty
# directories involved.
if git:
run_cmd(f"git rm -r -q '{ref_results_path}'")
shutil.rmtree(ref_results_path)
# Replace reference results with a freshly computed once.
shutil.copytree(created_results_path, ref_results_path, symlinks=True)
# Run cleanup script.
SATestBuild.run_cleanup_script(project_dir, build_log_file)
SATestBuild.normalize_reference_results(
project_dir, ref_results_path, project.mode
)
# Clean up the generated difference results.
SATestBuild.cleanup_reference_results(ref_results_path)
if git:
run_cmd(f"git add '{ref_results_path}'")
if __name__ == "__main__":
print("SATestUpdateDiffs.py should not be used on its own.")
print("Please use 'SATest.py update' instead")
sys.exit(1)