From a8fef54bf65c11be7d3ae276d4f86f291b304ba0 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Thu, 20 Mar 2025 21:30:49 +0800 Subject: [PATCH] [tests] improves the accuracy of service status check (#11352) Previously, the code relied on the return code of the `service radvd status` command to determine if `radvd` was running. This was unreliable because the command could succeed even if the service was not actually active. The `is_radvd_running` function now parses the output of `service radvd status` and specifically checks for the line "running" to confirm that the service is truly running. --- tests/scripts/thread-cert/node.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py index ea0e53f69..d4bf71b6c 100755 --- a/tests/scripts/thread-cert/node.py +++ b/tests/scripts/thread-cert/node.py @@ -4084,6 +4084,15 @@ class LinuxHost(): service['addresses'] = addresses return service or None + def _start_radvd_and_verify(self): + self.bash('service radvd start') + + output = self.bash('service radvd status') + for line in output: + if "running" in line: + return + raise Exception("Failed to start radvd service") + def start_radvd_service(self, prefix, slaac): self.bash("""cat >/etc/radvd.conf </etc/radvd.conf <