Recently we've changed the test modules to be 'read only',
that is, we don't want anything to write to the test modules
dir, since autotest might be installed on a system wide
location. However, some autotest tests do have source
code directories on them, and currently they'll fail to
run, since now test.srcdir points to a different directory.

So verify whether the source code dir 'src' exists inside
the test module dir, if so, copy the source contents to
the test.srcdir temporary directory.

This patch fixes a bug where tests such as hackbench,
aio_dio_bugs and others were failing to run.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/shared/test.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/client/shared/test.py b/client/shared/test.py
index 8012087..4d98380 100644
--- a/client/shared/test.py
+++ b/client/shared/test.py
@@ -53,6 +53,10 @@ class base_test(object):
                                                        default=tmpdir)
         self.srcdir = os.path.join(output_config, 
os.path.basename(self.bindir),
                                    'src')
+        source_code_dir = os.path.join(self.bindir, 'src')
+        if os.path.isdir(source_code_dir):
+            if not os.path.isdir(self.srcdir):
+                shutil.copytree(source_code_dir, self.srcdir)
         if not os.path.isdir(self.srcdir):
             os.makedirs(self.srcdir)
         self.tmpdir = tempfile.mkdtemp("_" + self.tagged_testname,
-- 
1.7.11.2

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to