mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 07:37:47 +00:00
[test] add posix verification for OT 1.2 (#6070)
This change: 1. Adds new github action to verify posix app for OT 1.2. 2. Only enable compile flag OT_SIMULATION_VIRTUAL_TIME_UART in script/test for ot-rcp build target. 3. Allow mix use of posix node and ot-cli-mtd node by changing python test script to accept node type as parameter. 4. Remove CSL test from expect as it is covered by thread-1-2-posix tests.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/expect -f
|
||||
#
|
||||
# Copyright (c) 2020, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
source "tests/scripts/expect/_common.exp"
|
||||
source "tests/scripts/expect/_multinode.exp"
|
||||
|
||||
spawn_node 1
|
||||
|
||||
spawn_node 2 mtd
|
||||
send "csl period 5000\n"
|
||||
expect_line "Done"
|
||||
|
||||
setup_two_nodes "-" false
|
||||
|
||||
switch_node 1
|
||||
set addr [get_ipaddr "mleid"]
|
||||
|
||||
switch_node 2
|
||||
send "ping $addr\n"
|
||||
expect "16 bytes from $addr: icmp_seq=1"
|
||||
|
||||
dispose_all
|
||||
@@ -345,8 +345,13 @@ class OtCli:
|
||||
# Default command if no match below, will be overridden if below conditions are met.
|
||||
cmd = './ot-cli-%s' % (mode)
|
||||
|
||||
# For Thread 1.2 MTD node, use ot-cli-mtd build regardless of OT_CLI_PATH
|
||||
if self.version == '1.2' and mode == 'mtd' and 'top_builddir' in os.environ:
|
||||
srcdir = os.environ['top_builddir']
|
||||
cmd = '%s/examples/apps/cli/ot-cli-%s %d' % (srcdir, mode, nodeid)
|
||||
|
||||
# If Thread version of node matches the testing environment version.
|
||||
if self.version == self.env_version:
|
||||
elif self.version == self.env_version:
|
||||
# Load Thread 1.2 BBR device when testing Thread 1.2 scenarios
|
||||
# which requires device with Backbone functionality.
|
||||
if self.version == '1.2' and self.is_bbr:
|
||||
@@ -367,6 +372,7 @@ class OtCli:
|
||||
if 'RADIO_DEVICE' in os.environ:
|
||||
cmd += ' --real-time-signal=+1 -v spinel+hdlc+uart://%s?forkpty-arg=%d' % (os.environ['RADIO_DEVICE'],
|
||||
nodeid)
|
||||
self.is_posix = True
|
||||
else:
|
||||
cmd += ' %d' % nodeid
|
||||
|
||||
@@ -382,6 +388,7 @@ class OtCli:
|
||||
if 'RADIO_DEVICE_1_1' in os.environ:
|
||||
cmd += ' --real-time-signal=+1 -v spinel+hdlc+uart://%s?forkpty-arg=%d' % (
|
||||
os.environ['RADIO_DEVICE_1_1'], nodeid)
|
||||
self.is_posix = True
|
||||
else:
|
||||
cmd += ' %d' % nodeid
|
||||
|
||||
@@ -410,6 +417,7 @@ class OtCli:
|
||||
if 'RADIO_DEVICE' in os.environ:
|
||||
args = ' --real-time-signal=+1 spinel+hdlc+uart://%s?forkpty-arg=%d' % (os.environ['RADIO_DEVICE'],
|
||||
nodeid)
|
||||
self.is_posix = True
|
||||
else:
|
||||
args = ''
|
||||
|
||||
@@ -449,6 +457,7 @@ class OtCli:
|
||||
if 'RADIO_DEVICE_1_1' in os.environ:
|
||||
args = ' --real-time-signal=+1 spinel+hdlc+uart://%s?forkpty-arg=%d' % (os.environ['RADIO_DEVICE_1_1'],
|
||||
nodeid)
|
||||
self.is_posix = True
|
||||
else:
|
||||
args = ''
|
||||
|
||||
@@ -502,6 +511,7 @@ class NodeImpl:
|
||||
def __init__(self, nodeid, name=None, simulator=None, **kwargs):
|
||||
self.nodeid = nodeid
|
||||
self.name = name or ('Node%d' % nodeid)
|
||||
self.is_posix = False
|
||||
|
||||
self.simulator = simulator
|
||||
if self.simulator:
|
||||
|
||||
@@ -144,7 +144,6 @@ class VirtualTime(BaseSimulator):
|
||||
|
||||
BLOCK_TIMEOUT = 10
|
||||
|
||||
RADIO_ONLY = os.getenv('RADIO_DEVICE') is not None
|
||||
NCP_SIM = os.getenv('NODE_TYPE', 'sim') == 'ncp-sim'
|
||||
|
||||
_message_factory = None
|
||||
@@ -246,7 +245,7 @@ class VirtualTime(BaseSimulator):
|
||||
return (addr[0], addr[1] - self.BASE_PORT)
|
||||
|
||||
def _core_addr_from(self, nodeid):
|
||||
if self.RADIO_ONLY:
|
||||
if self._nodes[nodeid].is_posix:
|
||||
return ('127.0.0.1', self.BASE_PORT + self.port + nodeid)
|
||||
else:
|
||||
return ('127.0.0.1', self.port + nodeid)
|
||||
|
||||
@@ -61,6 +61,7 @@ class LowPower_5_3_01_SSEDAttachment(thread_cert.TestCase):
|
||||
SSED_1: {
|
||||
'version': '1.2',
|
||||
'name': 'SSED_1',
|
||||
'is_mtd': True,
|
||||
'mode': '-',
|
||||
'panid': 0xface,
|
||||
'allowlist': [LEADER],
|
||||
|
||||
@@ -47,6 +47,7 @@ class SSED_CslTransmission(thread_cert.TestCase):
|
||||
},
|
||||
SSED_1: {
|
||||
'version': '1.2',
|
||||
'is_mtd': True,
|
||||
'mode': '-',
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user