checking for sfa steps was buggy on centos - fixed
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 22 Jun 2010 10:49:36 +0000 (12:49 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 22 Jun 2010 10:49:36 +0000 (12:49 +0200)
system/TestMain.py
system/TestPlc.py

index 27feca2..ac6edd5 100755 (executable)
@@ -34,12 +34,12 @@ class TestMain:
             utils.show_options("main options",options)
 
     def init_steps(self):
-        self.steps_message=20*'x'+" Defaut steps are\n"+TestPlc.printable_steps(TestPlc.default_steps)
-        self.steps_message += "\n"+20*'x'+" Other useful steps are\n"+TestPlc.printable_steps(TestPlc.other_steps)
+        self.steps_message  = 20*'x'+" Defaut steps are\n"+TestPlc.printable_steps(TestPlc.default_steps)
+        self.steps_message += 20*'x'+" Other useful steps are\n"+TestPlc.printable_steps(TestPlc.other_steps)
 
     def list_steps(self):
         if not self.options.verbose:
-            print self.steps_message
+            print self.steps_message,
         else:
             testplc_method_dict = __import__("TestPlc").__dict__['TestPlc'].__dict__
             scopes = [("Default steps",TestPlc.default_steps)]
@@ -125,16 +125,6 @@ steps refer to a method in TestPlc or to a step_* module
                           help="Trace file location")
         (self.options, self.args) = parser.parse_args()
 
-        # no step specified
-        if len(self.args) == 0:
-            self.options.steps=TestPlc.default_steps
-        else:
-            self.options.steps = self.args
-
-        if self.options.list_steps:
-            self.list_steps()
-            sys.exit(1)
-
         # handle defaults and option persistence
         for (recname,filename,default) in (
             ('build_url','arg-build-url',TestMain.default_build_url) ,
@@ -189,6 +179,17 @@ steps refer to a method in TestPlc or to a step_* module
         # hack : if sfa is not among the published rpms, skip these tests
         TestPlc.check_whether_build_has_sfa(self.options.arch_rpms_url)
 
+        # no step specified
+        if len(self.args) == 0:
+            self.options.steps=TestPlc.default_steps
+        else:
+            self.options.steps = self.args
+
+        if self.options.list_steps:
+            self.init_steps()
+            self.list_steps()
+            sys.exit(1)
+
         # steps
         if not self.options.steps:
             #default (all) steps
index c62d5c4..0ebb92c 100644 (file)
@@ -80,6 +80,7 @@ def slice_mapper_options_sfa (method):
     return actual
 
 SEP='<sep>'
+SEPSFA='<sep_sfa>'
 
 class TestPlc:
 
@@ -92,15 +93,12 @@ class TestPlc:
         'kill_all_qemus', 'start_node', SEP,
         # better use of time: do this now that the nodes are taking off
         'plcsh_stress_test', SEP,
-       'install_sfa', 'configure_sfa', 'import_sfa', 'start_sfa', SEP,
-        'setup_sfa', 'add_sfa', 'update_sfa', 'view_sfa', SEP,
-        'nodes_ssh_debug', 'nodes_ssh_boot', 'check_slice', 'check_initscripts', SEP,
-        # optionally run sfa later; takes longer, but checks more about nm 
-       # 'install_sfa', 'configure_sfa', 'import_sfa', 'start_sfa', SEP,
-        # 'setup_sfa', 'add_sfa', 'update_sfa', 'view_sfa', SEP,
-        'check_slice_sfa', 'delete_sfa', 'stop_sfa', SEP,
+       'install_sfa', 'configure_sfa', 'import_sfa', 'start_sfa', SEPSFA,
+        'setup_sfa', 'add_sfa', 'update_sfa', 'view_sfa', SEPSFA,
+        'nodes_ssh_debug', 'nodes_ssh_boot', 'check_slice', 'check_initscripts', SEPSFA,
+        'check_slice_sfa', 'delete_sfa', 'stop_sfa', SEPSFA,
         'check_tcp',  'check_hooks',  SEP,
-        'force_gather_logs', 'force_resources_post',
+        'force_gather_logs', 'force_resources_post', SEP,
         ]
     other_steps = [ 
         'show_boxes', 'resources_list','resources_release','resources_release_plc','resources_release_qemu',SEP,
@@ -111,12 +109,13 @@ class TestPlc:
         'populate' , SEP,
         'list_all_qemus', 'list_qemus', 'kill_qemus', SEP,
         'db_dump' , 'db_restore', SEP,
-        'standby_1 through 20',
+        'standby_1 through 20',SEP,
         ]
 
     @staticmethod
     def printable_steps (list):
-        return " ".join(list).replace(" "+SEP+" "," \\\n")
+        single_line=" ".join(list)+" "
+        return single_line.replace(" "+SEP+" "," \\\n").replace(" "+SEPSFA+" "," \\\n")
     @staticmethod
     def valid_step (step):
         return step != SEP
@@ -128,8 +127,10 @@ class TestPlc:
         retcod=os.system ("curl --silent %s/ | grep -q sfa"%rpms_url)
         # full builds are expected to return with 0 here
         if retcod!=0:
-            TestPlc.default_steps = [ step for step in TestPlc.default_steps
-                                      if step.find('sfa') < 0 ]
+            # move all steps containing 'sfa' from default_steps to other_steps
+            sfa_steps= [ step for step in TestPlc.default_steps if step.find('sfa')>=0 ]
+            TestPlc.other_steps += sfa_steps
+            for step in sfa_steps: TestPlc.default_steps.remove(step)
 
     def __init__ (self,plc_spec,options):
        self.plc_spec=plc_spec