test.srcdir was still writing into the test module directory,
breaking our assumptions of read only test modules. So
let's fix this by allowing the src dir to be in the
configurable test_output_dir, or default to the client
tmpdir if that is not set.

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

diff --git a/client/shared/test.py b/client/shared/test.py
index 0770e70..e5435a6 100644
--- a/client/shared/test.py
+++ b/client/shared/test.py
@@ -46,7 +46,15 @@ class base_test(object):
         else:
             self.crash_handling_enabled = False
         self.bindir = bindir
-        self.srcdir = os.path.join(self.bindir, 'src')
+        autodir = os.path.abspath(os.environ['AUTODIR'])
+        tmpdir = os.path.join(autodir, 'tmp')
+        output_config = GLOBAL_CONFIG.get_config_value('COMMON',
+                                                       'test_output_dir',
+                                                       default=tmpdir)
+        self.srcdir = os.path.join(output_config, 
os.path.basename(self.bindir),
+                                   'src')
+        if not os.path.isdir(self.srcdir):
+            os.makedirs(self.srcdir)
         self.tmpdir = tempfile.mkdtemp("_" + self.tagged_testname,
                                        dir=job.tmpdir)
         self._keyvals = []
-- 
1.7.10.2

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to