diff mbox series

[langdale,08/10] oeqa ping.py: fail test if target IP address has not been set

Message ID b14b8f38da9195852e9a2fd6b2e446ed8a1fa0b8.1682430831.git.steve@sakoman.com
State New
Headers show
Series [langdale,01/10] xserver-xorg: backport fix for CVE-2023-1393 | expand

Commit Message

Steve Sakoman April 25, 2023, 1:57 p.m. UTC
From: Mikko Rapeli <mikko.rapeli@linaro.org>

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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 17c995c53775b8cee279ca4ced916092067e1195)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 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