Files
poky/meta/lib/oeqa/runtime/cases/scp.py
Jose Quaresma d954ed621f oeqa/runtime/scp: requires openssh-sftp-server
The SCP protocol was deprecated in favor of the SFTP.
For the legacy SCP protocol scp should be run with "-O".
Instead of adding "-O" on the scp_options ssh oeqa we can
require the openssh-sftp-server to be instaled on the target.

This way the test will work more deterministic regardless of
the host machine client used.
For the old fashion clients still using legacy SCP protocol
the openssh-sshd server will be used, for the new ones using
the SFTP the openssh-sftp-server will be picked.

(From OE-Core rev: 2f43da91ba20d18bc419bca7651bb383a51f20af)

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-23 11:54:37 +01:00

40 lines
1.1 KiB
Python

#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
import os
from tempfile import mkstemp
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.runtime.decorator.package import OEHasPackage
class ScpTest(OERuntimeTestCase):
@classmethod
def setUpClass(cls):
cls.tmp_fd, cls.tmp_path = mkstemp()
with os.fdopen(cls.tmp_fd, 'w') as f:
f.seek(2 ** 22 -1)
f.write(os.linesep)
@classmethod
def tearDownClass(cls):
os.remove(cls.tmp_path)
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage({'openssh-scp', 'openssh-sftp-server'})
def test_scp_file(self):
dst = '/tmp/test_scp_file'
(status, output) = self.target.copyTo(self.tmp_path, dst)
msg = 'File could not be copied. Output: %s' % output
self.assertEqual(status, 0, msg=msg)
(status, output) = self.target.run('ls -la %s' % dst)
self.assertEqual(status, 0, msg = 'SCP test failed')
self.target.run('rm %s' % dst)