mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
Merge branch 'fix/ci_restart_avahi_daemon' into 'master'
fix(ci): restart avahi-daemon See merge request espressif/esp-idf!36278
This commit is contained in:
commit
d93e84b65d
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
# !/usr/bin/env python3
|
# !/usr/bin/env python3
|
||||||
# this file defines some functions for testing cli and br under pytest framework
|
# this file defines some functions for testing cli and br under pytest framework
|
||||||
@ -408,20 +408,21 @@ def get_host_ipv4_address() -> str:
|
|||||||
return host_ipv4_address
|
return host_ipv4_address
|
||||||
|
|
||||||
|
|
||||||
def start_avahi() -> None:
|
def restart_avahi() -> None:
|
||||||
time.sleep(1)
|
command = 'avahi-daemon -k'
|
||||||
command = '/etc/init.d/dbus start'
|
|
||||||
subprocess.Popen(command, shell=True)
|
subprocess.Popen(command, shell=True)
|
||||||
time.sleep(5)
|
time.sleep(2)
|
||||||
command = 'avahi-daemon'
|
command = 'avahi-daemon'
|
||||||
subprocess.Popen(command, shell=True)
|
subprocess.Popen(command, shell=True)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
def host_publish_service() -> None:
|
def start_avahi() -> None:
|
||||||
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
|
time.sleep(1)
|
||||||
|
command = '/etc/init.d/dbus start'
|
||||||
subprocess.Popen(command, shell=True)
|
subprocess.Popen(command, shell=True)
|
||||||
time.sleep(2)
|
time.sleep(5)
|
||||||
|
restart_avahi()
|
||||||
|
|
||||||
|
|
||||||
def host_close_service() -> None:
|
def host_close_service() -> None:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
# !/usr/bin/env python3
|
# !/usr/bin/env python3
|
||||||
import copy
|
import copy
|
||||||
@ -447,7 +447,10 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
|||||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
command = 'dns browse _testxxx._udp.default.service.arpa'
|
||||||
tmp = ocf.get_ouput_string(cli, command, 5)
|
tmp = ocf.get_ouput_string(cli, command, 5)
|
||||||
assert 'Port:12347' not in str(tmp)
|
assert 'Port:12347' not in str(tmp)
|
||||||
ocf.host_publish_service()
|
ocf.restart_avahi()
|
||||||
|
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
|
||||||
|
sp = subprocess.Popen(command, shell=True)
|
||||||
|
time.sleep(2)
|
||||||
ocf.wait(cli, 5)
|
ocf.wait(cli, 5)
|
||||||
|
|
||||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
command = 'dns browse _testxxx._udp.default.service.arpa'
|
||||||
@ -455,14 +458,13 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
|||||||
assert 'response for _testxxx' in str(tmp)
|
assert 'response for _testxxx' in str(tmp)
|
||||||
assert 'Port:12347' in str(tmp)
|
assert 'Port:12347' in str(tmp)
|
||||||
|
|
||||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
command = 'dns service testxxx _testxxx._udp.default.service.arpa.'
|
||||||
tmp = ocf.get_ouput_string(cli, command, 5)
|
tmp = ocf.get_ouput_string(cli, command, 5)
|
||||||
ocf.execute_command(cli, 'dns service testxxx _testxxx._udp.default.service.arpa.')
|
|
||||||
tmp = cli.expect(pexpect.TIMEOUT, timeout=5)
|
|
||||||
assert 'response for testxxx' in str(tmp)
|
assert 'response for testxxx' in str(tmp)
|
||||||
assert 'Port:12347' in str(tmp)
|
assert 'Port:12347' in str(tmp)
|
||||||
finally:
|
finally:
|
||||||
ocf.host_close_service()
|
ocf.host_close_service()
|
||||||
|
sp.terminate()
|
||||||
ocf.execute_command(br, 'factoryreset')
|
ocf.execute_command(br, 'factoryreset')
|
||||||
ocf.execute_command(cli, 'factoryreset')
|
ocf.execute_command(cli, 'factoryreset')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user