mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 16:17:47 +00:00
[posix] implement virtual time and update tests to utilize virtual time (#2508)
This commit adds the following features: - Example posix drivers to support virtual time simulation, allowing tests to run faster than real time. - A python-based simulation driver that coordinates the virtual time simulations. Each alarm event and message transmission across all nodes are scheduled in a single discrete time event queue. As a result, only a single node is making forward progress at a time. - Updated tests to utilize new virtual-time simulator, allowing them to run faster than real time. - To enable virtual time feature, define VIRTUAL_TIME=1 env var and set CPPFLAGS=-DOPENTHREAD_POSIX_VIRTUAL_TIME=1.
This commit is contained in:
@@ -38,9 +38,11 @@ import unittest
|
||||
import config
|
||||
|
||||
class Node:
|
||||
def __init__(self, nodeid, is_mtd=False):
|
||||
def __init__(self, nodeid, is_mtd=False, simulator=None):
|
||||
self.simulator = simulator
|
||||
|
||||
if sys.platform != 'win32':
|
||||
self.interface = node_cli.otCli(nodeid, is_mtd)
|
||||
self.interface = node_cli.otCli(nodeid, is_mtd, simulator=simulator)
|
||||
else:
|
||||
self.interface = node_api.otApi(nodeid)
|
||||
|
||||
@@ -239,7 +241,7 @@ class Node:
|
||||
def scan(self):
|
||||
return self.interface.scan()
|
||||
|
||||
def ping(self, ipaddr, num_responses=1, size=None, timeout=5000):
|
||||
def ping(self, ipaddr, num_responses=1, size=None, timeout=5):
|
||||
return self.interface.ping(ipaddr, num_responses, size, timeout)
|
||||
|
||||
def reset(self):
|
||||
|
||||
Reference in New Issue
Block a user