+ scopes = [("Default steps", TestPlc.default_steps)]
+ if self.options.all_steps:
+ scopes.append ( ("Other steps", TestPlc.other_steps) )
+ # try to list macro steps as well
+ scopes.append ( ("Macro steps", Step.list_macros()) )
+ for (scope, steps) in scopes:
+ print('--------------------', scope)
+ for step in [step for step in steps if TestPlc.valid_step(step)]:
+ try:
+ (step, qualifier) = step.split('@')
+ except:
+ pass
+ stepname = step
+ for special in ['force', 'ignore']:
+ stepname = stepname.replace('_'+special, "")
+ Step(stepname).print_doc()
+
+ def run (self):
+ usage = """usage: %%prog [options] steps
+arch-rpms-url defaults to the last value used, as stored in arg-arch-rpms-url,
+ no default
+config defaults to the last value used, as stored in arg-config,
+ or {}
+ips_vnode, ips_vplc and ips_qemu defaults to the last value used,
+ as stored in arg-ips-{{bplc,vplc,bnode,vnode}},
+ default is to use IP scanning
+steps refer to a method in TestPlc or to a step_* module
+
+run with -l to see a list of available steps
+===
+""".format(TestMain.default_config)
+
+ parser = ArgumentParser(usage = usage)
+ parser.add_argument("-u", "--url", action="store", dest="arch_rpms_url",
+ help="URL of the arch-dependent RPMS area - for locating what to test")
+ parser.add_argument("-b", "--build", action="store", dest="build_url",
+ help="ignored, for legacy only")
+ parser.add_argument("-c", "--config", action="append", dest="config", default=[],
+ help="Config module - can be set multiple times, or use quotes")
+ parser.add_argument("-p", "--personality", action="store", dest="personality",
+ help="personality - as in vbuild-nightly")
+ parser.add_argument("-d", "--pldistro", action="store", dest="pldistro",
+ help="pldistro - as in vbuild-nightly")
+ parser.add_argument("-f", "--fcdistro", action="store", dest="fcdistro",
+ help="fcdistro - as in vbuild-nightly")
+ parser.add_argument("-e", "--exclude", action="append", dest="exclude", default=[],
+ help="steps to exclude - can be set multiple times, or use quotes")
+ parser.add_argument("-i", "--ignore", action="append", dest="ignore", default=[],
+ help="steps to run but ignore - can be set multiple times, or use quotes")
+ parser.add_argument("-a", "--all", action="store_true", dest="all_steps", default=False,
+ help="Run all default steps")
+ parser.add_argument("-l", "--list", action="store_true", dest="list_steps", default=False,
+ help="List known steps")
+ parser.add_argument("-V", "--vserver", action="append", dest="ips_bplc", default=[],
+ help="Specify the set of hostnames for the boxes that host the plcs")
+ parser.add_argument("-P", "--plcs", action="append", dest="ips_vplc", default=[],
+ help="Specify the set of hostname/IP's to use for vplcs")
+ parser.add_argument("-Q", "--qemus", action="append", dest="ips_bnode", default=[],
+ help="Specify the set of hostnames for the boxes that host the nodes")
+ parser.add_argument("-N", "--nodes", action="append", dest="ips_vnode", default=[],
+ help="Specify the set of hostname/IP's to use for vnodes")
+ parser.add_argument("-s", "--size", action="store", dest="size", default=1,
+ type=int,
+ help="set test size in # of plcs - default is 1")
+ parser.add_argument("-q", "--qualifier", action="store", dest="qualifier", default=None,
+ type=int,
+ help="run steps only on plc numbered <qualifier>, starting at 1")
+ parser.add_argument("-y", "--rspec-style", action="append", dest="rspec_styles", default=[],
+ 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,
+ help="Used by plc_db_dump and plc_db_restore")
+ parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", default=False,
+ help="Run in verbose mode")
+ parser.add_argument("-I", "--interactive", action="store_true", dest="interactive", default=False,
+ help="prompts before each step")
+ parser.add_argument("-n", "--dry-run", action="store_true", dest="dry_run", default=False,
+ 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_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 = []
+ for el in x:
+ if hasattr(el, "__iter__") and not isinstance(el, str):
+ result.extend(flatten(el))