blob: ee97b8ef66cb7852ad3fb38bd32245001bdbb434 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
Patrick Williams92b42cb2022-09-03 06:53:57 -05002# Copyright OpenEmbedded Contributors
3#
Brad Bishopc342db32019-05-15 21:57:59 -04004# SPDX-License-Identifier: MIT
5#
6
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007import os
8from tempfile import mkstemp
9
10from oeqa.runtime.case import OERuntimeTestCase
11from oeqa.core.decorator.depends import OETestDepends
Brad Bishop977dc1a2019-02-06 16:01:43 -050012from oeqa.runtime.decorator.package import OEHasPackage
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013
14class ScpTest(OERuntimeTestCase):
15
16 @classmethod
17 def setUpClass(cls):
18 cls.tmp_fd, cls.tmp_path = mkstemp()
19 with os.fdopen(cls.tmp_fd, 'w') as f:
20 f.seek(2 ** 22 -1)
21 f.write(os.linesep)
22
23 @classmethod
24 def tearDownClass(cls):
25 os.remove(cls.tmp_path)
26
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 @OETestDepends(['ssh.SSHTest.test_ssh'])
Andrew Geissler615f2f12022-07-15 14:00:58 -050028 @OEHasPackage(['openssh-scp'])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 def test_scp_file(self):
30 dst = '/tmp/test_scp_file'
31
32 (status, output) = self.target.copyTo(self.tmp_path, dst)
33 msg = 'File could not be copied. Output: %s' % output
34 self.assertEqual(status, 0, msg=msg)
35
36 (status, output) = self.target.run('ls -la %s' % dst)
37 self.assertEqual(status, 0, msg = 'SCP test failed')
38
39 self.target.run('rm %s' % dst)