| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | import os | 
|  | 2 | from tempfile import mkstemp | 
|  | 3 |  | 
|  | 4 | from oeqa.runtime.case import OERuntimeTestCase | 
|  | 5 | from oeqa.core.decorator.depends import OETestDepends | 
|  | 6 | from oeqa.core.decorator.oeid import OETestID | 
| Brad Bishop | 977dc1a | 2019-02-06 16:01:43 -0500 | [diff] [blame^] | 7 | from oeqa.runtime.decorator.package import OEHasPackage | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 |  | 
|  | 9 | class 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 Bishop | 977dc1a | 2019-02-06 16:01:43 -0500 | [diff] [blame^] | 24 | @OEHasPackage(['openssh-scp', 'dropbear']) | 
| Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | 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) |