Skip to content

Commit d93e84b

Browse files
committed
Merge branch 'fix/ci_restart_avahi_daemon' into 'master'
fix(ci): restart avahi-daemon See merge request espressif/esp-idf!36278
2 parents 3195bdc + 508cb1f commit d93e84b

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

examples/openthread/ot_ci_function.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Unlicense OR CC0-1.0
33
# !/usr/bin/env python3
44
# this file defines some functions for testing cli and br under pytest framework
@@ -408,20 +408,21 @@ def get_host_ipv4_address() -> str:
408408
return host_ipv4_address
409409

410410

411-
def start_avahi() -> None:
412-
time.sleep(1)
413-
command = '/etc/init.d/dbus start'
411+
def restart_avahi() -> None:
412+
command = 'avahi-daemon -k'
414413
subprocess.Popen(command, shell=True)
415-
time.sleep(5)
414+
time.sleep(2)
416415
command = 'avahi-daemon'
417416
subprocess.Popen(command, shell=True)
418417
time.sleep(5)
419418

420419

421-
def host_publish_service() -> None:
422-
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
420+
def start_avahi() -> None:
421+
time.sleep(1)
422+
command = '/etc/init.d/dbus start'
423423
subprocess.Popen(command, shell=True)
424-
time.sleep(2)
424+
time.sleep(5)
425+
restart_avahi()
425426

426427

427428
def host_close_service() -> None:

examples/openthread/pytest_otbr.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Unlicense OR CC0-1.0
33
# !/usr/bin/env python3
44
import copy
@@ -447,22 +447,24 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
447447
command = 'dns browse _testxxx._udp.default.service.arpa'
448448
tmp = ocf.get_ouput_string(cli, command, 5)
449449
assert 'Port:12347' not in str(tmp)
450-
ocf.host_publish_service()
450+
ocf.restart_avahi()
451+
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
452+
sp = subprocess.Popen(command, shell=True)
453+
time.sleep(2)
451454
ocf.wait(cli, 5)
452455

453456
command = 'dns browse _testxxx._udp.default.service.arpa'
454457
tmp = ocf.get_ouput_string(cli, command, 5)
455458
assert 'response for _testxxx' in str(tmp)
456459
assert 'Port:12347' in str(tmp)
457460

458-
command = 'dns browse _testxxx._udp.default.service.arpa'
461+
command = 'dns service testxxx _testxxx._udp.default.service.arpa.'
459462
tmp = ocf.get_ouput_string(cli, command, 5)
460-
ocf.execute_command(cli, 'dns service testxxx _testxxx._udp.default.service.arpa.')
461-
tmp = cli.expect(pexpect.TIMEOUT, timeout=5)
462463
assert 'response for testxxx' in str(tmp)
463464
assert 'Port:12347' in str(tmp)
464465
finally:
465466
ocf.host_close_service()
467+
sp.terminate()
466468
ocf.execute_command(br, 'factoryreset')
467469
ocf.execute_command(cli, 'factoryreset')
468470
time.sleep(3)

0 commit comments

Comments
 (0)