kopia lustrzana https://github.com/espressif/esp-idf
CI: Use Console.logs instead of prints in eth test apps
rodzic
caae336f6e
commit
d1dee48b2d
|
@ -4,6 +4,7 @@ import socket
|
||||||
|
|
||||||
import tiny_test_fw
|
import tiny_test_fw
|
||||||
import ttfw_idf
|
import ttfw_idf
|
||||||
|
from tiny_test_fw import Utility
|
||||||
from ttfw_idf import TestFormat
|
from ttfw_idf import TestFormat
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -17,14 +18,14 @@ def configure_eth_if(func): # type: (typing.Any) -> typing.Any
|
||||||
# try to determine which interface to use
|
# try to determine which interface to use
|
||||||
netifs = os.listdir('/sys/class/net/')
|
netifs = os.listdir('/sys/class/net/')
|
||||||
target_if = ''
|
target_if = ''
|
||||||
print('detected interfaces: ' + str(netifs))
|
Utility.console_log('detected interfaces: ' + str(netifs))
|
||||||
for netif in netifs:
|
for netif in netifs:
|
||||||
if netif.find('eth') == 0 or netif.find('enp') == 0 or netif.find('eno') == 0:
|
if netif.find('eth') == 0 or netif.find('enp') == 0 or netif.find('eno') == 0:
|
||||||
target_if = netif
|
target_if = netif
|
||||||
break
|
break
|
||||||
if target_if == '':
|
if target_if == '':
|
||||||
raise Exception('no network interface found')
|
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 = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, 0x2222)
|
||||||
so.bind((target_if, 0))
|
so.bind((target_if, 0))
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ def test_component_ut_esp_eth(env, appname): # type: (tiny_test_fw.Env, str) ->
|
||||||
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})'),
|
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)
|
timeout=10)
|
||||||
stdout = expect_result[0]
|
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('ffffffffffff')) # broadcast frame
|
||||||
send_eth_packet(bytes.fromhex('010000000000')) # multicast frame
|
send_eth_packet(bytes.fromhex('010000000000')) # multicast frame
|
||||||
send_eth_packet(bytes.fromhex(expect_result[1].replace(':', ''))) # unicast frame
|
send_eth_packet(bytes.fromhex(expect_result[1].replace(':', ''))) # unicast frame
|
||||||
|
|
Ładowanie…
Reference in New Issue