add time delay after a simulated node starts (#327)

This commit is contained in:
Marcin K Szczodrak
2016-08-03 13:16:45 -07:00
committed by Jonathan Hui
parent b326f01821
commit d83fea07c3
+7 -3
View File
@@ -29,6 +29,7 @@
import os
import sys
import time
import pexpect
import unittest
@@ -52,11 +53,11 @@ class Node:
def __init_sim(self, nodeid):
""" Initialize a simulation node. """
if "top_builddir" in os.environ.keys():
if "OT_CLI_PATH" in os.environ.keys():
cmd = os.environ['OT_CLI_PATH']
elif "top_builddir" in os.environ.keys():
srcdir = os.environ['top_builddir']
cmd = '%s/examples/apps/cli/ot-cli' % srcdir
elif "OT_CLI_PATH" in os.environ.keys():
cmd = os.environ['OT_CLI_PATH']
else:
cmd = './ot-cli'
cmd += ' %d' % nodeid
@@ -64,6 +65,9 @@ class Node:
self.pexpect = pexpect.spawn(cmd, timeout=2)
# Add delay to ensure that the process is ready to receive commands.
time.sleep(0.1)
def __init_soc(self, nodeid):
""" Initialize a System-on-a-chip node connected via UART. """
import fdpexpect