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
94 lines
4.0 KiB
Python
94 lines
4.0 KiB
Python
#!/usr/bin/env python
|
|
|
|
"""
|
|
Static Analyzer qualification infrastructure: adding a new project to
|
|
the Repository Directory.
|
|
|
|
Add a new project for testing: build it and add to the Project Map file.
|
|
Assumes it's being run from the Repository Directory.
|
|
The project directory should be added inside the Repository Directory and
|
|
have the same name as the project ID
|
|
|
|
The project should use the following files for set up:
|
|
- cleanup_run_static_analyzer.sh - prepare the build environment.
|
|
Ex: make clean can be a part of it.
|
|
- run_static_analyzer.cmd - a list of commands to run through scan-build.
|
|
Each command should be on a separate line.
|
|
Choose from: configure, make, xcodebuild
|
|
- download_project.sh - download the project into the CachedSource/
|
|
directory. For example, download a zip of
|
|
the project source from GitHub, unzip it,
|
|
and rename the unzipped directory to
|
|
'CachedSource'. This script is not called
|
|
when 'CachedSource' is already present,
|
|
so an alternative is to check the
|
|
'CachedSource' directory into the
|
|
repository directly.
|
|
- CachedSource/ - An optional directory containing the source of the
|
|
project being analyzed. If present,
|
|
download_project.sh will not be called.
|
|
- changes_for_analyzer.patch - An optional patch file for any local
|
|
changes
|
|
(e.g., to adapt to newer version of clang)
|
|
that should be applied to CachedSource
|
|
before analysis. To construct this patch,
|
|
run the download script to download
|
|
the project to CachedSource, copy the
|
|
CachedSource to another directory (for
|
|
example, PatchedSource) and make any
|
|
needed modifications to the copied
|
|
source.
|
|
Then run:
|
|
diff -ur CachedSource PatchedSource \
|
|
> changes_for_analyzer.patch
|
|
"""
|
|
import SATestBuild
|
|
from ProjectMap import ProjectMap, ProjectInfo
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def add_new_project(project: ProjectInfo):
|
|
"""
|
|
Add a new project for testing: build it and add to the Project Map file.
|
|
:param name: is a short string used to identify a project.
|
|
"""
|
|
|
|
test_info = SATestBuild.TestInfo(project, is_reference_build=True)
|
|
tester = SATestBuild.ProjectTester(test_info)
|
|
|
|
project_dir = tester.get_project_dir()
|
|
if not os.path.exists(project_dir):
|
|
print(f"Error: Project directory is missing: {project_dir}")
|
|
sys.exit(-1)
|
|
|
|
# Build the project.
|
|
tester.test()
|
|
|
|
# Add the project name to the project map.
|
|
project_map = ProjectMap(should_exist=False)
|
|
|
|
if is_existing_project(project_map, project):
|
|
print(
|
|
f"Warning: Project with name '{project.name}' already exists.",
|
|
file=sys.stdout,
|
|
)
|
|
print("Reference output has been regenerated.", file=sys.stdout)
|
|
else:
|
|
project_map.projects.append(project)
|
|
project_map.save()
|
|
|
|
|
|
def is_existing_project(project_map: ProjectMap, project: ProjectInfo) -> bool:
|
|
return any(
|
|
existing_project.name == project.name
|
|
for existing_project in project_map.projects
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("SATestAdd.py should not be used on its own.")
|
|
print("Please use 'SATest.py add' instead")
|
|
sys.exit(1)
|