blob: 3a5f2921521cb4164f64ec71c3a3bf1a0180fbb6 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop6e60e8b2018-02-01 10:27:11 -05005import os
6from tempfile import mkstemp
7
8from oeqa.runtime.case import OERuntimeTestCase
9from oeqa.core.decorator.depends import OETestDepends
Brad Bishop977dc1a2019-02-06 16:01:43 -050010from oeqa.runtime.decorator.package import OEHasPackage
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011
12class ScpTest(OERuntimeTestCase):
13
14 @classmethod
15 def setUpClass(cls):
16 cls.tmp_fd, cls.tmp_path = mkstemp()
17 with os.fdopen(cls.tmp_fd, 'w') as f:
18 f.seek(2 ** 22 -1)
19 f.write(os.linesep)
20
21 @classmethod
22 def tearDownClass(cls):
23 os.remove(cls.tmp_path)
24
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 @OETestDepends(['ssh.SSHTest.test_ssh'])
Brad Bishop977dc1a2019-02-06 16:01:43 -050026 @OEHasPackage(['openssh-scp', 'dropbear'])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 def test_scp_file(self):
28 dst = '/tmp/test_scp_file'
29
30 (status, output) = self.target.copyTo(self.tmp_path, dst)
31 msg = 'File could not be copied. Output: %s' % output
32 self.assertEqual(status, 0, msg=msg)
33
34 (status, output) = self.target.run('ls -la %s' % dst)
35 self.assertEqual(status, 0, msg = 'SCP test failed')
36
37 self.target.run('rm %s' % dst)