blob: 8f895da95a2fd11be58fb35e0f56fa022af9f8b1 [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
Brad Bishop977dc1a2019-02-06 16:01:43 -05007from oeqa.runtime.decorator.package import OEHasPackage
Brad Bishop6e60e8b2018-02-01 10:27:11 -05008
9class ScpTest(OERuntimeTestCase):
10
11 @classmethod
12 def setUpClass(cls):
13 cls.tmp_fd, cls.tmp_path = mkstemp()
14 with os.fdopen(cls.tmp_fd, 'w') as f:
15 f.seek(2 ** 22 -1)
16 f.write(os.linesep)
17
18 @classmethod
19 def tearDownClass(cls):
20 os.remove(cls.tmp_path)
21
22 @OETestID(220)
23 @OETestDepends(['ssh.SSHTest.test_ssh'])
Brad Bishop977dc1a2019-02-06 16:01:43 -050024 @OEHasPackage(['openssh-scp', 'dropbear'])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 def test_scp_file(self):
26 dst = '/tmp/test_scp_file'
27
28 (status, output) = self.target.copyTo(self.tmp_path, dst)
29 msg = 'File could not be copied. Output: %s' % output
30 self.assertEqual(status, 0, msg=msg)
31
32 (status, output) = self.target.run('ls -la %s' % dst)
33 self.assertEqual(status, 0, msg = 'SCP test failed')
34
35 self.target.run('rm %s' % dst)