[simulation] add reliable virtual time transport (#11029)

This commit adds a reliable transport based on SEQPACKET unix socket to
simulation platform and use this for tests on simulation platform.
This commit is contained in:
Yakun Xu
2025-06-05 14:32:25 +08:00
committed by GitHub
parent a1de12fd49
commit 1662ca8001
6 changed files with 346 additions and 204 deletions
+3 -3
View File
@@ -922,11 +922,11 @@ class NodeImpl:
assert len(payload) == payload_len
return (direction, type, payload)
def send_command(self, cmd, go=True, expect_command_echo=True):
def send_command(self, cmd, go=True, expect_command_echo=True, maybeoff=False):
print("%d: %s" % (self.nodeid, cmd))
self.pexpect.send(cmd + '\n')
if go:
self.simulator.go(0, nodeid=self.nodeid)
self.simulator.go(0, nodeid=self.nodeid, maybeoff=maybeoff)
sys.stdout.flush()
if expect_command_echo:
@@ -2659,7 +2659,7 @@ class NodeImpl:
self._reset('factoryreset')
def _reset(self, cmd):
self.send_command(cmd, expect_command_echo=False)
self.send_command(cmd, expect_command_echo=False, maybeoff=True)
time.sleep(self.RESET_DELAY)
# Send a "version" command and drain the CLI output after reset
self.send_command('version', expect_command_echo=False)