From a6a3402d922d8b748ecf78b6d4d9a0e57a08505f Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Sun, 9 Aug 2026 14:03:02 +0100 Subject: [PATCH] =?UTF-8?q?test:=20H1=20=E2=80=94=20root-port=20unplug=20a?= =?UTF-8?q?nd=20replug=20(hot-plug=20matrix)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tearDownPort path, exercised for the first time with a real removal and return: QEMU raises no root-port change events, so the bus's 250 ms reconcile tick notices the PORTSC change alone — and it does. Reap, re-add, rebind, second generation binds on the same port. Discrimination: against the pre-reap manager (4a2df58~1) the case fails at the dedupe wall. --- test/qemu_test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/qemu_test.py b/test/qemu_test.py index b4dfa0a..e6d35c0 100644 --- a/test/qemu_test.py +++ b/test/qemu_test.py @@ -984,6 +984,31 @@ CASES = [ r"[\s\S]*device-manager: delegated device \d+ to /system/drivers/usb-hid-keyboard" r"[\s\S]*usb-hid-keyboard: ok)", "fail": r"DANOS-TEST-RESULT: FAIL"}, + # Hot-plug matrix H1 (docs/hot-plug-matrix-plan.md): ROOT-port unplug and + # replug on the same port. Different teardown path than the hub case + # (tearDownPort, not tearDownHubDevice), and QEMU raises no port-change + # events for root ports — the bus's 250 ms reconcile tick must notice the + # PORTSC change on its own. The ordered tail (removed → reaping → delegated + # → ok) can only be the second generation: every boot device's ok precedes + # the unplug. + {"name": "usb-root-replug", + "build_case": "usb-hid", + "smp": 4, + "timeout": 150, + "qemu_extra": ["-device", "qemu-xhci,id=xhci2", + "-device", "usb-kbd,bus=xhci2.0,port=2,id=rkbd"], + "qmp_sequence": [ + {"delay": 8, "command": "device_del", "arguments": {"id": "rkbd"}}, + {"delay": 14, "command": "device_add", + "arguments": {"driver": "usb-kbd", "bus": "xhci2.0", "port": "2", "id": "rkbd2"}}, + ], + "expect": r"(?s)(?=.*usb-hid-keyboard: ok \(device (\d+)\b" + r"[\s\S]*port \d+ disconnected" + r"[\s\S]*device-manager: child removed" + r"[\s\S]*device-manager: reaping \S*usb-hid-keyboard" + r"[\s\S]*device-manager: delegated device \d+ to /system/drivers/usb-hid-keyboard" + r"[\s\S]*usb-hid-keyboard: ok)", + "fail": r"DANOS-TEST-RESULT: FAIL"}, # The kernel VFS root (M-F): the mount table serves the initrd at /system — # path resolution, node status/read (an ELF magic), and directory listing, # asserted kernel-side.