blob: f488a6175bb7bf430382281b116f5023a3465ef8 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001import os
2from tempfile import mkstemp
3
4from oeqa.runtime.case import OERuntimeTestCase
5from oeqa.core.decorator.depends import OETestDepends
6from oeqa.core.decorator.oeid import OETestID
7
8class ScpTest(OERuntimeTestCase):
9
10 @classmethod
11 def setUpClass(cls):
12 cls.tmp_fd, cls.tmp_path = mkstemp()
13 with os.fdopen(cls.tmp_fd, 'w') as f:
14 f.seek(2 ** 22 -1)
15 f.write(os.linesep)
16
17 @classmethod
18 def tearDownClass(cls):
19 os.remove(cls.tmp_path)
20
21 @OETestID(220)
22 @OETestDepends(['ssh.SSHTest.test_ssh'])
23 def test_scp_file(self):
24 dst = '/tmp/test_scp_file'
25
26 (status, output) = self.target.copyTo(self.tmp_path, dst)
27 msg = 'File could not be copied. Output: %s' % output
28 self.assertEqual(status, 0, msg=msg)
29
30 (status, output) = self.target.run('ls -la %s' % dst)
31 self.assertEqual(status, 0, msg = 'SCP test failed')
32
33 self.target.run('rm %s' % dst)