Skip to content

Commit 7f821d0

Browse files
committed
fix(chip): keep source-only riscv checks clean
1 parent 83a5939 commit 7f821d0

7 files changed

Lines changed: 115 additions & 5 deletions

packages/chip/benchmarks/parsers/tests/test_parsers_hypothesis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
HYPOTHESIS_AVAILABLE = True
3232
except ImportError: # pragma: no cover - skip when hypothesis is absent
3333
HYPOTHESIS_AVAILABLE = False
34+
raise unittest.SkipTest("hypothesis is not installed")
3435

3536
from benchmarks.parsers import ( # noqa: E402
3637
ParseError,

packages/chip/scripts/check_linux_external_bsp.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,24 @@ def main(argv: list[str]) -> int:
220220
parser.add_argument("linux_tree", nargs="?")
221221
parser.add_argument("--json", action="store_true")
222222
parser.add_argument("--require-pass", action="store_true")
223+
parser.add_argument(
224+
"--report",
225+
default=str(REPORT),
226+
help=f"status report path (default: {rel(REPORT)})",
227+
)
223228
args = parser.parse_args(argv)
224229

230+
report_path = Path(args.report).expanduser()
231+
if not report_path.is_absolute():
232+
report_path = ROOT / report_path
225233
report = build_report(candidate_linux_tree(args.linux_tree))
226-
REPORT.parent.mkdir(parents=True, exist_ok=True)
227-
REPORT.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
234+
report_path.parent.mkdir(parents=True, exist_ok=True)
235+
report_path.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
228236
if args.json:
229237
print(json.dumps(report, indent=2, sort_keys=True))
230238
else:
231239
print(f"STATUS: {report['status'].upper()} linux.external_bsp_status")
232-
print(f" report: {rel(REPORT)}")
240+
print(f" report: {rel(report_path)}")
233241
for key, value in report["producer_commands"].items():
234242
print(f" command.{key}: {value}")
235243
for blocker in report["blockers"]:

packages/chip/scripts/check_minimum_linux_target.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
DOC = ROOT / "docs/project/minimum-linux-npu-target.md"
1515
REPORT = ROOT / "build/reports/minimum-linux-kernel-target.json"
1616
LINUX_DTS = ROOT / "sw/linux/dts/eliza-e1.dts"
17-
LINUX_EXTERNAL_STATUS = ROOT / "docs/evidence/linux/linux-external-bsp-status.json"
17+
LINUX_EXTERNAL_STATUS = ROOT / "build/reports/linux-external-bsp-status.json"
1818

1919
REQUIRED_LOCAL_ARTIFACTS = {
2020
"linux_bsp_readme": "docs/sw/linux/README.md",
@@ -151,7 +151,12 @@ def collect() -> dict[str, Any]:
151151
errors.append(f"Linux DTS missing {name}: {REQUIRED_DTS_TOKENS[name]}")
152152

153153
subprocess.run(
154-
[sys.executable, "scripts/check_linux_external_bsp.py"],
154+
[
155+
sys.executable,
156+
"scripts/check_linux_external_bsp.py",
157+
"--report",
158+
str(LINUX_EXTERNAL_STATUS),
159+
],
155160
cwd=ROOT,
156161
text=True,
157162
stdout=subprocess.PIPE,

packages/chip/scripts/test_check_cocotb_coverage_hypothesis.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
HYPOTHESIS_AVAILABLE = True
4141
except ImportError: # pragma: no cover - skip when hypothesis is absent
4242
HYPOTHESIS_AVAILABLE = False
43+
raise unittest.SkipTest("hypothesis is not installed")
4344

4445

4546
def _make_block_payload(

packages/chip/scripts/test_check_cpu_2028_target.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,45 @@
4646
except ImportError: # pragma: no cover - skip when hypothesis is absent
4747
HYPOTHESIS_AVAILABLE = False
4848

49+
class _MissingHealthCheck:
50+
too_slow = "too_slow"
51+
function_scoped_fixture = "function_scoped_fixture"
52+
53+
class _MissingStrategy:
54+
def filter(self, *_args: object, **_kwargs: object) -> "_MissingStrategy":
55+
return self
56+
57+
class _MissingStrategies:
58+
def sampled_from(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
59+
return _MissingStrategy()
60+
61+
def lists(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
62+
return _MissingStrategy()
63+
64+
def text(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
65+
return _MissingStrategy()
66+
67+
def characters(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
68+
return _MissingStrategy()
69+
70+
def integers(self, *_args: object, **_kwargs: object) -> _MissingStrategy:
71+
return _MissingStrategy()
72+
73+
def given(*_args: object, **_kwargs: object):
74+
def decorator(fn):
75+
return fn
76+
77+
return decorator
78+
79+
def settings(*_args: object, **_kwargs: object):
80+
def decorator(fn):
81+
return fn
82+
83+
return decorator
84+
85+
HealthCheck = _MissingHealthCheck
86+
st = _MissingStrategies()
87+
4988

5089
def minimal_valid_spec() -> dict[str, Any]:
5190
return {

packages/chip/scripts/test_generate_e1_phone_cad.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
#!/usr/bin/env python3
22
import importlib.util
33
import json
4+
import unittest
45
from pathlib import Path
56

7+
_required_modules = ("matplotlib", "numpy", "trimesh", "yaml")
8+
_missing_modules = [
9+
module for module in _required_modules if importlib.util.find_spec(module) is None
10+
]
11+
if _missing_modules:
12+
raise unittest.SkipTest(
13+
"optional E1 phone CAD dependencies are not installed: "
14+
+ ", ".join(_missing_modules)
15+
)
16+
617
import generate_e1_phone_cad as cad
718
import pytest
819

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
from __future__ import annotations
3+
4+
import json
5+
import subprocess
6+
import sys
7+
import tempfile
8+
import unittest
9+
from pathlib import Path
10+
11+
ROOT = Path(__file__).resolve().parents[1]
12+
DEFAULT_REPORT = ROOT / "docs/evidence/linux/linux-external-bsp-status.json"
13+
14+
15+
class LinuxExternalBspReportTests(unittest.TestCase):
16+
def test_custom_report_path_keeps_tracked_evidence_unchanged(self) -> None:
17+
before = DEFAULT_REPORT.read_bytes()
18+
with tempfile.TemporaryDirectory() as tmp:
19+
report = Path(tmp) / "linux-external-bsp-status.json"
20+
completed = subprocess.run(
21+
[
22+
sys.executable,
23+
"scripts/check_linux_external_bsp.py",
24+
"--report",
25+
str(report),
26+
],
27+
cwd=ROOT,
28+
text=True,
29+
stdout=subprocess.PIPE,
30+
stderr=subprocess.STDOUT,
31+
check=False,
32+
)
33+
34+
self.assertEqual(completed.returncode, 0, completed.stdout)
35+
self.assertIn("STATUS: BLOCKED linux.external_bsp_status", completed.stdout)
36+
self.assertTrue(report.is_file())
37+
self.assertEqual(DEFAULT_REPORT.read_bytes(), before)
38+
39+
payload = json.loads(report.read_text(encoding="utf-8"))
40+
self.assertEqual(payload["schema"], "eliza.linux_external_bsp_status.v1")
41+
self.assertEqual(payload["status"], "blocked")
42+
43+
44+
if __name__ == "__main__":
45+
unittest.main()

0 commit comments

Comments
 (0)