diff --git a/runner b/runner
index 3582168..a02e9c9 100755
--- a/runner
+++ b/runner
@@ -7,6 +7,7 @@ from shutil import rmtree, copytree
from logging import debug, error, basicConfig, DEBUG, WARNING
from lib.argparse import ArgumentParser, RawDescriptionHelpFormatter
import json
+import tempfile
from lib.testsprops import TestProfiles, TestCollections
from lib.test_attributes import TestAttributes
@@ -214,10 +215,17 @@ class Runner():
#
def gather_test_results(self, test):
user = getenv('USER')
- result, output = sh('sudo chown -R %s.%s %s' % (user, user, self.autotest_results_root))
- result, output = sh(r'sudo find %s -type d | xargs chmod +x' % (self.autotest_results_root))
+ tmpdir = tempfile.mkdtemp()
+ try:
+ sh('sudo cp -r {} {}'.format(self.autotest_results_root, tmpdir))
+ tmp_results_dir = path.join(
+ tmpdir, path.basename(self.autotest_results_root))
+ sh('sudo chown -R {}.{} {}'.format(user, user, tmp_results_dir))
+ sh('sudo find {} -type d | xargs chmod +x'.format(tmp_results_dir))
+ copytree(tmp_results_dir, self.per_test_results_root)
+ finally:
+ rmtree(tmpdir, ignore_errors=True)
- copytree(self.autotest_results_root, self.per_test_results_root)
# install_required_packages
#