X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2FTestMain.py;h=5a2ec32cd5ec3885555b08cca2d7c3876149f213;hb=a9f6256e30d99bfb087b5881e51a8520530a846b;hp=2a6a6fea38389e92862d644bcbd5831e6d6c3372;hpb=8666ae7f0291e8d115e166ef555f02abafc40fc8;p=tests.git diff --git a/system/TestMain.py b/system/TestMain.py index 2a6a6fe..5a2ec32 100755 --- a/system/TestMain.py +++ b/system/TestMain.py @@ -92,8 +92,6 @@ class Step: class TestMain: default_config = [ 'default' ] -# default_rspec_styles = [ 'pl', 'pg' ] - default_rspec_styles = [ 'pg' ] default_build_url = "git://git.onelab.eu/tests" @@ -108,7 +106,7 @@ class TestMain: def init_steps(self): self.steps_message = "" - if not self.options.bonding: + if not self.options.bonding_build: 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" + \ @@ -116,8 +114,8 @@ class TestMain: self.steps_message += 20*'x' + " Macro steps are\n" + \ " ".join(Step.list_macros()) else: - self.steps_message += 20*'x' + " Default steps with bonding are\n" + \ - TestPlc.printable_steps(TestPlc.bonding_steps) + self.steps_message += 20*'x' + " Default steps with bonding build are\n" + \ + TestPlc.printable_steps(TestPlc.default_bonding_steps) def list_steps(self): if not self.options.verbose: @@ -195,7 +193,7 @@ run with -l to see a list of available steps type=int, help="run steps only on plc numbered , starting at 1") parser.add_argument("-y", "--rspec-style", action="append", dest="rspec_styles", default=[], - help="pl is for planetlab rspecs, pg is for protogeni") + help="OBSOLETE - for compat only") parser.add_argument("-k", "--keep-going", action="store", dest="keep_going", default=False, help="proceeds even if some steps are failing") parser.add_argument("-D", "--dbname", action="store", dest="dbname", default=None, @@ -208,11 +206,29 @@ run with -l to see a list of available steps help="Show environment and exits") parser.add_argument("-t", "--trace", action="store", dest="trace_file", default=None, help="Trace file location") - parser.add_argument("-g", "--bonding", action='store', dest='bonding', default=None, + parser.add_argument("-g", "--bonding", action='store', dest='bonding_build', default=None, help="specify build to bond with") + # if we call symlink 'rung' instead of just run this is equivalent to run -G + bonding_default = 'rung' in sys.argv[0] + parser.add_argument("-G", "--bonding-env", action='store_true', dest='bonding_env', default=bonding_default, + help="get bonding build from env. variable $bonding") parser.add_argument("steps", nargs='*') self.options = parser.parse_args() + # handle -G/-g options + if self.options.bonding_env: + if 'bonding' not in os.environ: + print("env. variable $bonding must be set with --bonding-env") + sys.exit(1) + self.options.bonding_build = os.environ['bonding'] + + if self.options.bonding_build: + ## allow to pass -g ../2015.03.15--f18 so we can use bash completion + self.options.bonding_build = os.path.basename(self.options.bonding_build) + if not os.path.isdir("../{}".format(self.options.bonding_build)): + print("could not find test dir for bonding build {}".format(self.options.bonding_build)) + sys.exit(1) + # allow things like "run -c 'c1 c2' -c c3" def flatten (x): result = [] @@ -227,8 +243,8 @@ run with -l to see a list of available steps setattr(self.options, optname, flatten([arg.split() for arg in getattr(self.options, optname)])) - if not self.options.rspec_styles: - self.options.rspec_styles = TestMain.default_rspec_styles + if self.options.rspec_styles: + print("WARNING: -y option is obsolete") # handle defaults and option persistence for recname, filename, default, need_reverse in ( @@ -293,8 +309,8 @@ run with -l to see a list of available steps # initialize steps if not self.options.steps: # defaults, depends on using bonding or not - if self.options.bonding: - self.options.steps = TestPlc.bonding_steps + if self.options.bonding_build: + self.options.steps = TestPlc.default_bonding_steps else: self.options.steps = TestPlc.default_steps @@ -380,13 +396,12 @@ run with -l to see a list of available steps # populate TestBonding objects # need to wait until here as we need all_plcs - if self.options.bonding: - ## allow to pass -g ../2015.03.15--f18 so we can use bash completion - self.options.bonding = os.path.basename(self.options.bonding) - # this will fail if ../{bonding} has not the right arg- files + if self.options.bonding_build: + # this will fail if ../{bonding_build} has not the right arg- files for spec, test_plc in all_plcs: test_plc.test_bonding = TestBonding (test_plc, - onelab_bonding_spec(self.options.bonding), + onelab_bonding_spec(self.options.bonding_build), + LocalSubstrate.local_substrate, self.options) overall_result = 'SUCCESS'