Skip to content

Commit ad837f7

Browse files
test(rapl): assert non-power domains keep their own name
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent cb38949 commit ad837f7

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎tests/test_rapl_parameters.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,26 @@ def test_rapl_parameters_stored_correctly(tmp_path):
524524
)
525525
assert rapl_true.rapl_include_dram is True
526526
assert rapl_true.rapl_prefer_psys is True
527+
528+
529+
@pytest.mark.skipif(not sys.platform.lower().startswith("lin"), reason="requires Linux")
530+
def test_rapl_non_power_domain_keeps_its_own_name(tmp_path):
531+
"""
532+
When no package/psys/dram domain exists, the remaining domains are used as a
533+
fallback but must not be renamed into the aggregated "Processor Energy" total.
534+
"""
535+
base = tmp_path
536+
rapl_provider = base / "intel-rapl"
537+
rapl_provider.mkdir()
538+
539+
d_core = rapl_provider / "intel-rapl:0"
540+
d_core.mkdir()
541+
(d_core / "name").write_text("core")
542+
(d_core / "energy_uj").write_text("1000000")
543+
(d_core / "max_energy_range_uj").write_text("262143328850")
544+
545+
rapl = IntelRAPL(rapl_dir=str(base))
546+
547+
names = [f.name for f in rapl._rapl_files]
548+
assert names, "Fallback should still expose the available domain"
549+
assert not any("Processor Energy" in name for name in names), names

0 commit comments

Comments
 (0)