mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-06 14:55:14 +00:00
refactor: refactor embedded C policy and enhance warning checks
- Updated the default output path in to . - Introduced a new file to define excluded prefixes, compatibility files, and forbidden calls for embedded C sources. - Modified to improve compiler flags and source file organization. - Added scripts for checking C warnings and embedded C compliance, ensuring self-owned sources are validated against the policy. - Implemented regression tests to capture and report self-owned C compiler warnings during builds. - Created a new test suite for runtime tests of SDK utilities, ensuring deterministic behavior. - Enhanced existing test scripts to include checks for C warnings and compliance with the embedded C policy.
This commit is contained in:
206 files changed
+6338
-5471
No files matched your search
@@ -22,6 +22,7 @@ sys.path.insert(0, str(FILELIST_SCRIPT_DIR))
|
||||
from filelist import atomic_write, parse_filelists, write_filelist # noqa: E402
|
||||
from generate_filelist import generate_all # noqa: E402
|
||||
from scripts.analyze_warnings import normalize # noqa: E402
|
||||
from scripts.check_c_warnings import self_owned_warnings # noqa: E402
|
||||
from scripts.dependency_lock import LockError, load_lock # noqa: E402
|
||||
from scripts.install_toolchain import safe_extract # noqa: E402
|
||||
from scripts.setup_helpers import download_file, ensure_git_repo # noqa: E402
|
||||
@@ -398,6 +399,25 @@ def test_warning_normalization_keeps_ranges_and_removes_variant_hash(tmp_path: P
|
||||
)
|
||||
|
||||
|
||||
def test_c_warning_filter_excludes_vendored_sources(tmp_path: Path) -> None:
|
||||
policy_dir = tmp_path / "quality"
|
||||
policy_dir.mkdir()
|
||||
(policy_dir / "embedded_c_policy.json").write_text(
|
||||
(ROOT / "quality/embedded_c_policy.json").read_text(encoding="utf-8"),
|
||||
encoding="utf-8",
|
||||
)
|
||||
output = "\n".join(
|
||||
(
|
||||
f"{tmp_path}/crt/src/hal/timer.c:9:1: warning: self-owned warning",
|
||||
f"{tmp_path}/app/coremark/coremark-main/core_main.c:4:1: warning: vendor warning",
|
||||
)
|
||||
)
|
||||
|
||||
warnings = self_owned_warnings(tmp_path, output)
|
||||
|
||||
assert warnings == ["crt/src/hal/timer.c:9: warning: self-owned warning"]
|
||||
|
||||
|
||||
def test_metrics_collection_and_observe_policy(tmp_path: Path) -> None:
|
||||
variant = tmp_path / "variant"
|
||||
(variant / "sw").mkdir(parents=True)
|
||||
|
||||
Reference in new issue
Block a user