* [PATCH 0/3] oeqa: cleaner testimage log
@ 2013-09-05 15:52 Mihai Lindner
2013-09-05 15:52 ` [PATCH 1/3] oeqa/oetest: oeRuntimeTest: enable long messages Mihai Lindner
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mihai Lindner @ 2013-09-05 15:52 UTC (permalink / raw)
To: openembedded-core
The following changes since commit f41b7a7d4d0463a0dfafe6621d01680b81798019:
bitbake: hob: remove PACKAGE_INSTALL variable setting from hob (2013-09-04 14:18:49 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib mihai/tests
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mihai/tests
Mihai Lindner (3):
oeqa/oetest: oeRuntimeTest: enable long messages
oeqa/utils/sshcontrol: tweak ssh options
oeqa/runtime/scp: replace dd call
meta/lib/oeqa/oetest.py | 2 ++
meta/lib/oeqa/runtime/scp.py | 19 +++++++++----------
meta/lib/oeqa/runtime/smart.py | 2 --
meta/lib/oeqa/utils/sshcontrol.py | 23 ++++++++++++-----------
4 files changed, 23 insertions(+), 23 deletions(-)
--
1.8.3.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] oeqa/oetest: oeRuntimeTest: enable long messages
2013-09-05 15:52 [PATCH 0/3] oeqa: cleaner testimage log Mihai Lindner
@ 2013-09-05 15:52 ` Mihai Lindner
2013-09-05 15:52 ` [PATCH 2/3] oeqa/utils/sshcontrol: tweak ssh options Mihai Lindner
2013-09-05 15:52 ` [PATCH 3/3] oeqa/runtime/scp: replace dd call Mihai Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Mihai Lindner @ 2013-09-05 15:52 UTC (permalink / raw)
To: openembedded-core
Set longMessage to True for all tests derived from oeRuntimeTest, in
order to have somewhat info on assertions with cryptic or no messages.
Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com>
---
meta/lib/oeqa/oetest.py | 2 ++
meta/lib/oeqa/runtime/smart.py | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index c9dc5dc..529abdc 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -37,6 +37,8 @@ def runTests(tc):
class oeRuntimeTest(unittest.TestCase):
+
+ longMessage = True
testFailures = []
testSkipped = []
testErrors = []
diff --git a/meta/lib/oeqa/runtime/smart.py b/meta/lib/oeqa/runtime/smart.py
index 59083ca..468e047 100644
--- a/meta/lib/oeqa/runtime/smart.py
+++ b/meta/lib/oeqa/runtime/smart.py
@@ -12,8 +12,6 @@ def setUpModule():
class SmartTest(oeRuntimeTest):
- longMessage = True
-
@skipUnlessPassed('test_smart_help')
def smart(self, command, expected = 0):
command = 'smart %s' % command
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] oeqa/utils/sshcontrol: tweak ssh options
2013-09-05 15:52 [PATCH 0/3] oeqa: cleaner testimage log Mihai Lindner
2013-09-05 15:52 ` [PATCH 1/3] oeqa/oetest: oeRuntimeTest: enable long messages Mihai Lindner
@ 2013-09-05 15:52 ` Mihai Lindner
2013-09-05 15:52 ` [PATCH 3/3] oeqa/runtime/scp: replace dd call Mihai Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Mihai Lindner @ 2013-09-05 15:52 UTC (permalink / raw)
To: openembedded-core
Add ssh_options to be used, the same, by ssh and scp:
Decrease LogLevel to ERROR, to suppress warnings (e.g. ssh host
verifications, two warnings in case of having openssh with hpn patches);
We no longer presume that the first line is a warning.
Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com>
---
meta/lib/oeqa/utils/sshcontrol.py | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py
index 7de7c3e..643d0ad 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -6,7 +6,6 @@
# running commands and copying files to/from a target.
# It's used by testimage.bbclass and tests in lib/oeqa/runtime.
-
import subprocess
import time
import os
@@ -19,6 +18,12 @@ class SSHControl(object):
self._out = ''
self._ret = 126
self.logfile = logfile
+ self.ssh_options = [
+ '-o', 'UserKnownHostsFile=/dev/null',
+ '-o', 'StrictHostKeyChecking=no',
+ '-o', 'LogLevel=ERROR'
+ ]
+ self.ssh = ['ssh', '-l', 'root'] + self.ssh_options
def log(self, msg):
if self.logfile:
@@ -28,7 +33,7 @@ class SSHControl(object):
def _internal_run(self, cmd):
# We need this for a proper PATH
cmd = ". /etc/profile; " + cmd
- command = ['ssh', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-l', 'root', self.host, cmd ]
+ command = self.ssh + [self.host, cmd]
self.log("[Running]$ %s" % " ".join(command))
# ssh hangs without os.setsid
proc = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid)
@@ -40,8 +45,6 @@ class SSHControl(object):
if time is 0 will let cmd run until it finishes.
Time can be passed to here or can be set per class instance."""
-
-
if self.host:
sshconn = self._internal_run(cmd)
else:
@@ -70,15 +73,14 @@ class SSHControl(object):
else:
self._out = sshconn.stdout.read()
self._ret = sshconn.poll()
- # remove first line from output which is always smth like (unless return code is 255 - which is a ssh error):
- # Warning: Permanently added '192.168.7.2' (RSA) to the list of known hosts.
- if self._ret != 255:
- self._out = '\n'.join(self._out.splitlines()[1:])
+ # strip the last LF so we can test the output
+ self._out = self._out.rstrip()
self.log("%s" % self._out)
self.log("[SSH command returned]: %s" % self._ret)
return (self._ret, self._out)
def _internal_scp(self, cmd):
+ cmd = ['scp'] + self.ssh_options + cmd
self.log("[Running SCP]$ %s" % " ".join(cmd))
scpconn = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid)
out = scpconn.communicate()[0]
@@ -90,12 +92,11 @@ class SSHControl(object):
return (ret, out)
def copy_to(self, localpath, remotepath):
- actualcmd = ['scp', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', localpath, 'root@%s:%s' % (self.host, remotepath)]
+ actualcmd = [localpath, 'root@%s:%s' % (self.host, remotepath)]
return self._internal_scp(actualcmd)
-
def copy_from(self, remotepath, localpath):
- actualcmd = ['scp', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', 'root@%s:%s' % (self.host, remotepath), localpath]
+ actualcmd = ['root@%s:%s' % (self.host, remotepath), localpath]
return self._internal_scp(actualcmd)
def get_status(self):
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] oeqa/runtime/scp: replace dd call
2013-09-05 15:52 [PATCH 0/3] oeqa: cleaner testimage log Mihai Lindner
2013-09-05 15:52 ` [PATCH 1/3] oeqa/oetest: oeRuntimeTest: enable long messages Mihai Lindner
2013-09-05 15:52 ` [PATCH 2/3] oeqa/utils/sshcontrol: tweak ssh options Mihai Lindner
@ 2013-09-05 15:52 ` Mihai Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Mihai Lindner @ 2013-09-05 15:52 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Mihai Lindner <mihaix.lindner@linux.intel.com>
---
meta/lib/oeqa/runtime/scp.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/meta/lib/oeqa/runtime/scp.py b/meta/lib/oeqa/runtime/scp.py
index b914802..03095bf 100644
--- a/meta/lib/oeqa/runtime/scp.py
+++ b/meta/lib/oeqa/runtime/scp.py
@@ -1,22 +1,21 @@
-import subprocess
-import unittest
import os
-from oeqa.oetest import oeRuntimeTest
-from oeqa.utils.decorators import *
+from oeqa.oetest import oeRuntimeTest, skipModule
+from oeqa.utils.decorators import skipUnlessPassed
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')
+ def test_scp_file(self):
+ test_log_dir = oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True)
+ test_file_path = os.path.join(test_log_dir, 'test_scp_file')
+ with open(test_file_path, 'w') as test_scp_file:
+ test_scp_file.seek(2 ** 22 - 1)
+ test_scp_file.write(os.linesep)
+ (status, output) = self.target.copy_to(test_file_path, '/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")
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-09-05 15:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-05 15:52 [PATCH 0/3] oeqa: cleaner testimage log Mihai Lindner
2013-09-05 15:52 ` [PATCH 1/3] oeqa/oetest: oeRuntimeTest: enable long messages Mihai Lindner
2013-09-05 15:52 ` [PATCH 2/3] oeqa/utils/sshcontrol: tweak ssh options Mihai Lindner
2013-09-05 15:52 ` [PATCH 3/3] oeqa/runtime/scp: replace dd call Mihai Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox