[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:
Jonathan Hui
2018-01-29 19:30:46 +00:00
committed by GitHub
parent 0403a1baf5
commit d426d7cfbd
107 changed files with 2600 additions and 882 deletions
+5 -3
View File
@@ -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):