The autotest_remote code assumes the state of remote
control files is simply path/to/control + ".state". This
causes problem with our patches moving state file creation
to the test output dir set on global_config.ini, with
fall back to the autotest tmpdir area.

Fix the code, creating new attributes for the _BaseRun
class, that will make it easier to control and keep
consistency of the state file locations.

Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
---
 server/autotest_remote.py |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/server/autotest_remote.py b/server/autotest_remote.py
index d092a04..8d017d0 100644
--- a/server/autotest_remote.py
+++ b/server/autotest_remote.py
@@ -348,9 +348,9 @@ class BaseAutotest(installable_object.InstallableObject):
             pass
 
         delete_file_list = [atrun.remote_control_file,
-                            atrun.remote_control_file + '.state',
+                            atrun.remote_control_state,
                             atrun.manual_control_file,
-                            atrun.manual_control_file + '.state']
+                            atrun.manual_control_state]
         cmd = ';'.join('rm -f ' + control for control in delete_file_list)
         host.run(cmd, ignore_status=True)
 
@@ -390,7 +390,7 @@ class BaseAutotest(installable_object.InstallableObject):
 
         # Create and copy state file to remote_control_file + '.state'
         state_file = host.job.preprocess_client_state()
-        host.send_file(state_file, atrun.remote_control_file + '.init.state')
+        host.send_file(state_file, atrun.remote_control_init_state)
         os.remove(state_file)
 
         # Copy control_file to remote_control_file on the host
@@ -443,8 +443,24 @@ class _BaseRun(object):
         control = os.path.join(self.autodir, 'control')
         if tag:
             control += '.' + tag
+
+        tmpdir = os.path.join(self.autodir, 'tmp')
+        state_dir = global_config.global_config.get_config_value('COMMON',
+                                                              
'test_output_dir',
+                                                              default=tmpdir)
+
         self.manual_control_file = control
+        self.manual_control_init_state = os.path.join(state_dir,
+                                                     control + ".init.state")
+        self.manual_control_state = os.path.join(state_dir,
+                                                 control + ".state")
+
         self.remote_control_file = control + '.autoserv'
+        self.remote_control_init_state = os.path.join(state_dir,
+                                            control + ".autoserv.init.state")
+        self.remote_control_state = os.path.join(state_dir,
+                                                 control + ".autoserv.state")
+
         self.config_file = os.path.join(self.autodir, 'global_config.ini')
 
 
-- 
1.7.10.2

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to