Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | import os |
| 8 | from tempfile import mkstemp |
| 9 | |
| 10 | from oeqa.runtime.case import OERuntimeTestCase |
| 11 | from oeqa.core.decorator.depends import OETestDepends |
Brad Bishop | 977dc1a | 2019-02-06 16:01:43 -0500 | [diff] [blame] | 12 | from oeqa.runtime.decorator.package import OEHasPackage |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | |
| 14 | class 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 27 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 28 | @OEHasPackage(['openssh-scp']) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 29 | 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) |