summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorMihai Lindner <mihaix.lindner@linux.intel.com>2013-09-05 18:52:42 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-06 23:03:23 +0100
commitfaed110e665628aeb0582259b3a1a6606b031c87 (patch)
tree9f878a73c129d8e34b35016ce6984bced428d54f /meta/lib/oeqa/runtime
parentfbb3e5e11f41de0dd8643a5593f262f1c93bb37a (diff)
downloadpoky-faed110e665628aeb0582259b3a1a6606b031c87.tar.gz
oeqa/runtime/scp: replace dd call
Use a file object to generate a our test file instead of calling `dd`; removes dd's output from testimage.log, keeps unittest output clean. Also remove unused imports. (From OE-Core rev: 6ac48ffbab29a37b0eada533191878aeae3c91f0) Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/scp.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/meta/lib/oeqa/runtime/scp.py b/meta/lib/oeqa/runtime/scp.py
index b914802095..03095bf966 100644
--- a/meta/lib/oeqa/runtime/scp.py
+++ b/meta/lib/oeqa/runtime/scp.py
@@ -1,22 +1,21 @@
1import subprocess
2import unittest
3import os 1import os
4from oeqa.oetest import oeRuntimeTest 2from oeqa.oetest import oeRuntimeTest, skipModule
5from oeqa.utils.decorators import * 3from oeqa.utils.decorators import skipUnlessPassed
6 4
7def setUpModule(): 5def setUpModule():
8 if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")): 6 if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
9 skipModule("No ssh package in image") 7 skipModule("No ssh package in image")
10 8
11
12class ScpTest(oeRuntimeTest): 9class ScpTest(oeRuntimeTest):
13 10
14 def setUp(self):
15 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)
16
17 @skipUnlessPassed('test_ssh') 11 @skipUnlessPassed('test_ssh')
18 def test_scp(self): 12 def test_scp_file(self):
19 (status, output) = self.target.copy_to(os.path.join(oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True), 'test_scp_file'), '/tmp/test_scp_file') 13 test_log_dir = oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True)
14 test_file_path = os.path.join(test_log_dir, 'test_scp_file')
15 with open(test_file_path, 'w') as test_scp_file:
16 test_scp_file.seek(2 ** 22 - 1)
17 test_scp_file.write(os.linesep)
18 (status, output) = self.target.copy_to(test_file_path, '/tmp/test_scp_file')
20 self.assertEqual(status, 0, msg = "File could not be copied. Output: %s" % output) 19 self.assertEqual(status, 0, msg = "File could not be copied. Output: %s" % output)
21 (status, output) = self.target.run("ls -la /tmp/test_scp_file") 20 (status, output) = self.target.run("ls -la /tmp/test_scp_file")
22 self.assertEqual(status, 0, msg = "SCP test failed") 21 self.assertEqual(status, 0, msg = "SCP test failed")