Patchwork [15/21] lib/oeqa/runtime: add vncserver for target test

login
register
mail settings
Submitter Stanacar, StefanX
Date Aug. 23, 2013, 3:30 p.m.
Message ID <b5835fdb48e6e4e871f18764ddc3eae05082fb25.1377269485.git.stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/56397/
State Accepted
Commit 3d30fd2eb06258aa2048f8fadf7b592f9844432f
Headers show

Comments

Stanacar, StefanX - Aug. 23, 2013, 3:30 p.m.
From: Mihai Prica <mihai.prica@intel.com>

Signed-off-by: Mihai Prica <mihai.prica@intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/lib/oeqa/runtime/vnc.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/vnc.py

Patch

diff --git a/meta/lib/oeqa/runtime/vnc.py b/meta/lib/oeqa/runtime/vnc.py
new file mode 100644
index 0000000..9476184
--- /dev/null
+++ b/meta/lib/oeqa/runtime/vnc.py
@@ -0,0 +1,22 @@ 
+from oeqa.oetest import oeRuntimeTest
+from oeqa.utils.decorators import *
+import re
+
+def setUpModule():
+    skipModuleUnless(oeRuntimeTest.tc.target.run('which x11vnc')[0] == 0, "No x11vnc in image")
+
+class VNCTest(oeRuntimeTest):
+
+    @skipUnlessPassed('test_ssh')
+    def test_vnc(self):
+        (status, output) = self.target.run('x11vnc -display :0.0 -bg -q')
+        self.assertEqual(status, 0, msg="x11vnc server failed to start: %s" % output)
+        port = re.search('PORT=[0-9]*', output)
+        self.assertTrue(port, msg="Listening port not specified in command output: %s" %output)
+
+        (status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [x]11vnc')
+        self.assertEqual(status, 0, msg="x11vnc process not running")
+
+        vncport = port.group(0).split('=')[1]
+        (status, output) = self.target.run('netstat -atun | grep :%s | grep LISTEN' % vncport)
+        self.assertEqual(status, 0, msg="x11vnc server not running on port %s" % vncport)