diff mbox series

[2/2] oeqa ping.py: fail test if target IP address has not been set

Message ID 20230405090848.3171132-1-mikko.rapeli@linaro.org
State New
Headers show
Series [1/2] oeqa ping.py: avoid busylooping failing ping command | expand

Commit Message

Mikko Rapeli April 5, 2023, 9:08 a.m. UTC
It is possible to call exported tests with --target-ip set to ":22"
where IP address is not set at all. Detect this case and fail the test
instead of calling ping without an IP address.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 meta/lib/oeqa/runtime/cases/ping.py | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/runtime/cases/ping.py b/meta/lib/oeqa/runtime/cases/ping.py
index fcb72d4543..f72460e7f3 100644
--- a/meta/lib/oeqa/runtime/cases/ping.py
+++ b/meta/lib/oeqa/runtime/cases/ping.py
@@ -17,6 +17,7 @@  class PingTest(OERuntimeTestCase):
     def test_ping(self):
         output = ''
         count = 0
+        self.assertNotEqual(len(self.target.ip), 0, msg="No target IP address set")
         try:
             while count < 5:
                 cmd = 'ping -c 1 %s' % self.target.ip