1eb8dc403SDave Cobbleyimport os 2eb8dc403SDave Cobbleyfrom tempfile import mkstemp 3eb8dc403SDave Cobbley 4eb8dc403SDave Cobbleyfrom oeqa.runtime.case import OERuntimeTestCase 5eb8dc403SDave Cobbleyfrom oeqa.core.decorator.depends import OETestDepends 6eb8dc403SDave Cobbleyfrom oeqa.core.decorator.oeid import OETestID 7*977dc1acSBrad Bishopfrom oeqa.runtime.decorator.package import OEHasPackage 8eb8dc403SDave Cobbley 9eb8dc403SDave Cobbleyclass ScpTest(OERuntimeTestCase): 10eb8dc403SDave Cobbley 11eb8dc403SDave Cobbley @classmethod 12eb8dc403SDave Cobbley def setUpClass(cls): 13eb8dc403SDave Cobbley cls.tmp_fd, cls.tmp_path = mkstemp() 14eb8dc403SDave Cobbley with os.fdopen(cls.tmp_fd, 'w') as f: 15eb8dc403SDave Cobbley f.seek(2 ** 22 -1) 16eb8dc403SDave Cobbley f.write(os.linesep) 17eb8dc403SDave Cobbley 18eb8dc403SDave Cobbley @classmethod 19eb8dc403SDave Cobbley def tearDownClass(cls): 20eb8dc403SDave Cobbley os.remove(cls.tmp_path) 21eb8dc403SDave Cobbley 22eb8dc403SDave Cobbley @OETestID(220) 23eb8dc403SDave Cobbley @OETestDepends(['ssh.SSHTest.test_ssh']) 24*977dc1acSBrad Bishop @OEHasPackage(['openssh-scp', 'dropbear']) 25eb8dc403SDave Cobbley def test_scp_file(self): 26eb8dc403SDave Cobbley dst = '/tmp/test_scp_file' 27eb8dc403SDave Cobbley 28eb8dc403SDave Cobbley (status, output) = self.target.copyTo(self.tmp_path, dst) 29eb8dc403SDave Cobbley msg = 'File could not be copied. Output: %s' % output 30eb8dc403SDave Cobbley self.assertEqual(status, 0, msg=msg) 31eb8dc403SDave Cobbley 32eb8dc403SDave Cobbley (status, output) = self.target.run('ls -la %s' % dst) 33eb8dc403SDave Cobbley self.assertEqual(status, 0, msg = 'SCP test failed') 34eb8dc403SDave Cobbley 35eb8dc403SDave Cobbley self.target.run('rm %s' % dst) 36