test(e2e): give the dynamips routers a detected idle-PC

Without one every c7200 busy-waits a full CPU core for the whole scenario
-- the tests create raw nodes and no template supplies a value (measured:
constant ~100 % per router, up to ~6 minutes per dynamips scenario).

harness.dynamips_idlepc() detects a value through the controller's
auto_idlepc endpoint (the GUI idle-PC finder path: a throwaway project
boots the image, candidate values are validated by measuring actual CPU
usage) and caches it in ~/.cache/gns3-e2e/idlepc.json keyed by the image
checksum, so the cost (~100 s here) is paid once per image, not per run.
GNS3_E2E_IDLEPC overrides detection; any failure returns None and the
scenarios run without one rather than fail on a CPU optimisation.

All four scenarios that boot c7200 routers (dynamips kernel/relay,
ethernet switch kernel/relay) pass the value at creation. Live: detected
0x60189234 for the M11 image (238 s first run including detection); the
routers drop from ~100 % during boot to 3-8 % steady (sampled per
process), and a re-run reports the cached value with no detection.
This commit is contained in:
YueGuobin committed 2026-10-06 00:21:10 +08:00
1 parent f13da59f23
commit e0329ceee6
4 files changed
+101 -10

No files matched your search

+9
View File
@@ -33,6 +33,15 @@ Either way each test creates its own project and deletes it again. Set
`GNS3_E2E_KEEP=1` to keep the project (and a started instance) on failure
and print where to look at it.
The dynamips scenarios give their routers an idle-PC: detected once per
image through the controller's `auto_idlepc` (a throwaway project and a
real CPU-usage measurement — the GUI's idle-PC finder path) and cached in
`~/.cache/gns3-e2e/idlepc.json` keyed by the image checksum. Without one,
each c7200 burns a **full CPU core** for the whole scenario — the e2e
creates raw nodes, so no template supplies a value. Set `GNS3_E2E_IDLEPC`
to skip the detection and use the given value (detection failing is never
fatal: the routers simply run without one).
`harness.py` holds the shared pieces — REST client, server lifecycle, the
IOS console driver, host-side kernel inspections (bridge membership, tap
admin state, tc qdiscs, the L2-anchor spec §E assertions) — so a new node