CI: input ssid password depends on sdkconfig

This commit is contained in:
Chen Yudong
2022-07-04 16:15:40 +08:00
parent 472ac26712
commit 4313ff4655
5 changed files with 24 additions and 29 deletions

View File

@@ -15,7 +15,6 @@ from pytest_embedded import Dut
def test_get_time_from_sntp_server(dut: Dut) -> None:
dut.expect('Time is not set yet. Connecting to WiFi and getting time over NTP.')
if dut.app.sdkconfig.get('EXAMPLE_WIFI_SSID_PWD_FROM_STDIN') is True:
# get env config
env_config = get_env_config('wifi_nearby')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']

View File

@@ -88,11 +88,6 @@ def test_examples_protocol_socket_tcpclient(env, extra_data):
2. have the board connect to the server
3. send and receive data
"""
# get env config
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1 = env.get_dut('tcp_client', 'examples/protocols/sockets/tcp_client', dut_class=ttfw_idf.ESP32DUT)
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, 'tcp_client.bin')
@@ -101,8 +96,12 @@ def test_examples_protocol_socket_tcpclient(env, extra_data):
# start test
dut1.start_app()
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
if dut1.app.get_sdkconfig_config_value('CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN'):
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
ipv4 = dut1.expect(re.compile(r' IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'), timeout=30)[0]
ipv6_r = r':'.join((r'[0-9a-fA-F]{4}',) * 8) # expect all 8 octets from IPv6 (assumes it's printed in the long form)

View File

@@ -55,11 +55,6 @@ def test_examples_protocol_socket_tcpserver(env, extra_data):
2. have the board connect to the server
3. send and receive data
"""
# get env config
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1 = env.get_dut('tcp_client', 'examples/protocols/sockets/tcp_server', dut_class=ttfw_idf.ESP32DUT)
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, 'tcp_server.bin')
@@ -68,8 +63,12 @@ def test_examples_protocol_socket_tcpserver(env, extra_data):
# start test
dut1.start_app()
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
if dut1.app.get_sdkconfig_config_value('CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN'):
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
ipv4 = dut1.expect(re.compile(r' IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'), timeout=30)[0]
ipv6_r = r':'.join((r'[0-9a-fA-F]{4}',) * 8) # expect all 8 octets from IPv6 (assumes it's printed in the long form)

View File

@@ -81,11 +81,6 @@ def test_examples_protocol_socket_udpclient(env, extra_data):
2. have the board connect to the server
3. send and receive data
"""
# get env config
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1 = env.get_dut('udp_client', 'examples/protocols/sockets/udp_client', dut_class=ttfw_idf.ESP32DUT)
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, 'udp_client.bin')
@@ -94,8 +89,12 @@ def test_examples_protocol_socket_udpclient(env, extra_data):
# start test
dut1.start_app()
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
if dut1.app.get_sdkconfig_config_value('CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN'):
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
ipv4 = dut1.expect(re.compile(r' IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'), timeout=30)[0]
ipv6_r = r':'.join((r'[0-9a-fA-F]{4}',) * 8) # expect all 8 octets from IPv6 (assumes it's printed in the long form)

View File

@@ -59,11 +59,6 @@ def test_examples_protocol_socket_udpserver(env, extra_data):
2. have the board connect to the server
3. send and receive data
"""
# get env config
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1 = env.get_dut('udp_server', 'examples/protocols/sockets/udp_server', dut_class=ttfw_idf.ESP32DUT)
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, 'udp_server.bin')
@@ -72,8 +67,12 @@ def test_examples_protocol_socket_udpserver(env, extra_data):
# start test
dut1.start_app()
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
if dut1.app.get_sdkconfig_config_value('CONFIG_EXAMPLE_WIFI_SSID_PWD_FROM_STDIN'):
env_config = get_env_config('wifi_router')
ap_ssid = env_config['ap_ssid']
ap_password = env_config['ap_password']
dut1.expect('Please input ssid password:')
dut1.write(' '.join([ap_ssid, ap_password]))
ipv4 = dut1.expect(re.compile(r' IPv4 address: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'), timeout=30)[0]
ipv6_r = r':'.join((r'[0-9a-fA-F]{4}',) * 8) # expect all 8 octets from IPv6 (assumes it's printed in the long form)