Patchwork [07/21] lib/oeqa/runtime: add new scp test

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

Comments

Stanacar, StefanX - Aug. 23, 2013, 3:30 p.m.
From: Alexandru Palalau <alexandrux.palalau@intel.com>

Copies a 5MB to target using scp, more of an
network test than a scp one.

Signed-off-by: Alexandru Palalau <alexandrux.palalau@intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/lib/oeqa/runtime/scp.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/scp.py

Patch

diff --git a/meta/lib/oeqa/runtime/scp.py b/meta/lib/oeqa/runtime/scp.py
new file mode 100644
index 0000000..b914802
--- /dev/null
+++ b/meta/lib/oeqa/runtime/scp.py
@@ -0,0 +1,22 @@ 
+import subprocess
+import unittest
+import os
+from oeqa.oetest import oeRuntimeTest
+from oeqa.utils.decorators import *
+
+def setUpModule():
+    if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
+        skipModule("No ssh package in image")
+
+
+class ScpTest(oeRuntimeTest):
+
+    def setUp(self):
+         subprocess.check_call("dd if=/dev/zero of=%s bs=512k count=10" % os.path.join(oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True), 'test_scp_file'), shell=True)
+
+    @skipUnlessPassed('test_ssh')
+    def test_scp(self):
+        (status, output) = self.target.copy_to(os.path.join(oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True), 'test_scp_file'), '/tmp/test_scp_file')
+        self.assertEqual(status, 0, msg = "File could not be copied. Output: %s" % output)
+        (status, output) = self.target.run("ls -la /tmp/test_scp_file")
+        self.assertEqual(status, 0, msg = "SCP test failed")