mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
Merge branch 'bugfix/eth_test_app_regex' into 'master'
esp_eth/CI: Fix app-test regex for parsing DUT's MAC Closes IDFCI-989 See merge request espressif/esp-idf!16327
This commit is contained in:
commit
5c33570524
@ -4,6 +4,7 @@ import socket
|
||||
|
||||
import tiny_test_fw
|
||||
import ttfw_idf
|
||||
from tiny_test_fw import Utility
|
||||
from ttfw_idf import TestFormat
|
||||
|
||||
try:
|
||||
@ -17,14 +18,14 @@ def configure_eth_if(func): # type: (typing.Any) -> typing.Any
|
||||
# try to determine which interface to use
|
||||
netifs = os.listdir('/sys/class/net/')
|
||||
target_if = ''
|
||||
print('detected interfaces: ' + str(netifs))
|
||||
Utility.console_log('detected interfaces: ' + str(netifs))
|
||||
for netif in netifs:
|
||||
if netif.find('eth') == 0 or netif.find('enp') == 0 or netif.find('eno') == 0:
|
||||
target_if = netif
|
||||
break
|
||||
if target_if == '':
|
||||
raise Exception('no network interface found')
|
||||
print('Use ' + target_if + ' for testing')
|
||||
Utility.console_log('Use ' + target_if + ' for testing')
|
||||
so = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, 0x2222)
|
||||
so.bind((target_if, 0))
|
||||
|
||||
@ -78,8 +79,10 @@ def test_component_ut_esp_eth(env, appname): # type: (tiny_test_fw.Env, str) ->
|
||||
stdout = dut.expect("Enter next test, or 'enter' to see menu", full_stdout=True)
|
||||
ttfw_idf.ComponentUTResult.parse_result(stdout, test_format=TestFormat.UNITY_BASIC)
|
||||
dut.write('"recv_pkt"')
|
||||
expect_result = dut.expect(re.compile(r'([\s\S]*)DUT MAC: ([0-9a-zA-Z:]*)'), timeout=10)
|
||||
expect_result = dut.expect(re.compile(r'([\s\S]*)DUT MAC: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})'),
|
||||
timeout=10)
|
||||
stdout = expect_result[0]
|
||||
Utility.console_log('DUTs MAC address: {}'.format(expect_result[1]))
|
||||
send_eth_packet(bytes.fromhex('ffffffffffff')) # broadcast frame
|
||||
send_eth_packet(bytes.fromhex('010000000000')) # multicast frame
|
||||
send_eth_packet(bytes.fromhex(expect_result[1].replace(':', ''))) # unicast frame
|
||||
|
Loading…
x
Reference in New Issue
Block a user