Skip to content

Commit 9b6e769

Browse files
author
Aleksandra Pasek
committed
testsuite: add copy_files_on_target option to run_cross call
Some tests have data files which need to be copied on target. The files are listed in a "data" field in test.yaml. Check for the data field and read its contents to copy_files_on_target. This allows run_cross' ssh.py to handle copying the given files. TN: T616-039
1 parent d9b8248 commit 9b6e769

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

testsuite/drivers/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def gprbuild(driver,
160160

161161

162162
def bin_check_call(driver, cmd, slot, test_name=None, result=None, timeout=None,
163-
env=None, cwd=None, **kwargs):
163+
env=None, cwd=None, copy_files_on_target=None, **kwargs):
164164
if cwd is None and "working_dir" in driver.test_env:
165165
cwd = driver.test_env["working_dir"]
166166
if result is None:
@@ -178,6 +178,7 @@ def bin_check_call(driver, cmd, slot, test_name=None, result=None, timeout=None,
178178
timeout=timeout,
179179
output=None,
180180
slot=slot,
181+
copy_files_on_target=copy_files_on_target,
181182
)
182183

183184
# Here process.out holds utf-8 encoded data.

testsuite/drivers/basic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ def run(self):
5252
gprbuild(self, gpr_project_path=gpr_project_path)
5353

5454
# Copy the requested data files
55+
copy_files_on_target = []
56+
5557
for data in self.test_env.get('data', []):
5658
cp(os.path.join(self.test_env['test_dir'], data),
5759
self.test_env['working_dir'], recursive=True)
60+
copy_files_on_target.append(os.path.join(self.test_env['working_dir'], data))
5861

5962
pre_test_py = os.path.join(self.test_env['test_dir'], 'pre_test.py')
6063
if os.path.isfile(pre_test_py):
@@ -67,7 +70,8 @@ def run(self):
6770
process = run_test_program(
6871
self,
6972
[os.path.join(self.test_env['working_dir'], test_exe)],
70-
self.slot,
73+
slot=self.slot,
74+
copy_files_on_target=copy_files_on_target,
7175
timeout=self.default_process_timeout)
7276
self.output += process.out.decode('utf-8')
7377

0 commit comments

Comments
 (0)