pass build env : (personality x fcdistro x pldistro) to test env for vserver creation
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 18 Sep 2008 18:44:30 +0000 (18:44 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 18 Sep 2008 18:44:30 +0000 (18:44 +0000)
system/TestMain.py
system/TestPlc.py

index e9c14e8..84531a6 100755 (executable)
@@ -59,6 +59,12 @@ steps refer to a method in TestPlc or to a step_* module
         parser.add_option("-c","--config",action="callback", callback=TestMain.optparse_list, dest="config",
                           nargs=1,type="string",
                           help="Config module - can be set multiple times, or use quotes")
+        parser.add_option("-p","--personality",action="store", dest="personality", default="linux32",
+                          help="personality - as in vbuild-nightly")
+        parser.add_option("-d","--pldistro",action="store", dest="pldistro", default="planetlab",
+                          help="pldistro - as in vbuild-nightly")
+        parser.add_option("-f","--fcdistro",action="store", dest="fcdistro", default="f8",
+                          help="fcdistro - as in vbuild-nightly")
         parser.add_option("-x","--exclude",action="callback", callback=TestMain.optparse_list, dest="exclude",
                           nargs=1,type="string",default=[],
                           help="steps to exclude - can be set multiple times, or use quotes")
@@ -74,7 +80,7 @@ steps refer to a method in TestPlc or to a step_* module
                           help="Specify the set of IP addresses to use for plcs (scanning disabled)")
         parser.add_option("-1","--small",action="store_true",dest="small_test",default=False,
                           help="run a small test -- typically only one node")
-        parser.add_option("-d","--dbname",action="store",dest="dbname",default=None,
+        parser.add_option("-D","--dbname",action="store",dest="dbname",default=None,
                            help="Used by db_dump and db_restore")
         parser.add_option("-v","--verbose", action="store_true", dest="verbose", default=False, 
                           help="Run in verbose mode")
@@ -82,7 +88,7 @@ steps refer to a method in TestPlc or to a step_* module
                           help="Run in quiet mode")
         parser.add_option("-n","--dry-run", action="store_true", dest="dry_run", default=False,
                           help="Show environment and exits")
-        parser.add_option("-f","--forcenm", action="store_true", dest="forcenm", default=False, 
+        parser.add_option("-r","--restart-nm", action="store_true", dest="forcenm", default=False, 
                           help="Force the NM to restart in check_slices step")
         parser.add_option("-t","--trace", action="store", dest="trace_file", default=None,
                           #default="logs/trace-@TIME@.txt",
@@ -111,6 +117,9 @@ steps refer to a method in TestPlc or to a step_* module
             ('plc_ips','arg-plc-ips',[]) , 
             ('config','arg-config',TestMain.default_config) , 
             ('arch_rpms_url','arg-arch-rpms-url',"") , 
+            ('personality','arg-personality',"linux32"),
+            ('pldistro','arg-pldistro',"planetlab"),
+            ('fcdistro','arg-fcdistro','f8'),
             ) :
 #            print 'handling',recname
             path=filename
@@ -146,9 +155,12 @@ steps refer to a method in TestPlc or to a step_* module
             fsave.close()
 #            utils.header('Saved %s into %s'%(recname,filename))
 
-        self.options.arch = "i386"
-        if self.options.arch_rpms_url.find("x86_64") >= 0:
-            self.options.arch="x86_64"
+        if self.options.personality == "linux32":
+            self.options.arch = "i386"
+        elif self.options.personality == "linux64":
+            self.options.arch = "x86_64"
+        else:
+            raise Exception, "Unsupported personality %r"%self.options.personality
         # steps
         if not self.options.steps:
             #default (all) steps
index cd9f222..ede174e 100644 (file)
@@ -337,10 +337,11 @@ class TestPlc:
         repo_url = self.options.arch_rpms_url
         for level in [ 'arch' ]:
            repo_url = os.path.dirname(repo_url)
-        if self.options.arch == "i386":
-            personality_option="-p linux32"
-        else:
-            personality_option="-p linux64"
+        # pass the vbuild-nightly options to vtest-init-vserver
+        test_env_options=""
+        test_env_options += " -p %s"%self.options.personality
+        test_env_options += " -d %s"%self.options.pldistro
+        test_env_options += " -f %s"%self.options.fcdistro
         script="vtest-init-vserver.sh"
         vserver_name = self.vservername
         vserver_options="--netdev eth0 --interface %s"%self.vserverip
@@ -349,7 +350,7 @@ class TestPlc:
             vserver_options += " --hostname %s"%vserver_hostname
         except:
             pass
-        create_vserver="%(build_dir)s/%(script)s %(personality_option)s %(vserver_name)s %(repo_url)s -- %(vserver_options)s"%locals()
+        create_vserver="%(build_dir)s/%(script)s %(test_env_options)s %(vserver_name)s %(repo_url)s -- %(vserver_options)s"%locals()
         return self.run_in_host(create_vserver) == 0
 
     ### install_rpm