Use the cmdparser class to do processing of the special keywords: list:
Lists the available tests based on either a local ./tests directory, a global /opt/autotest/tests directory or the packages AUTODIRTEST directory. The output will list the test name and a description based on the NAME field in the control file (or None if not found). The way this works is we walk each of the above directories looking for a "*control*" file. The idea is each test has to have at least a /control file. Some times tests will have different variants. Hence the wildcard approach. run: This command takes a test (plus its normal arguments) and tries to locate it in a list of paths (./tests, /opt/autotest/tests, AUTODIRTEST). If found, it prepends the path to the test arg and returns it back to autotest for processing. Doing it this way allows autotest to function like it always has with the 'run' command acting like an alias lookup. Signed-off-by: Don Zickus <[email protected]> --- client/bin/autotest | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/client/bin/autotest b/client/bin/autotest index 391b1d7..5291808 100755 --- a/client/bin/autotest +++ b/client/bin/autotest @@ -7,18 +7,20 @@ import common from optparse import OptionParser from autotest_lib.client.bin import job from autotest_lib.client.common_lib import global_config - +from autotest_lib.client.bin import cmdparser # Use the name of the binary to find the real installation directory # aka $AUTODIR. Update our path to include the $AUTODIR/bin/tests # directory and ensure we have $AUTODIR in our environment. autodirbin = os.path.dirname(os.path.realpath(sys.argv[0])) autodir = os.path.dirname(autodirbin) +autodirtest = autodir + "/tests" sys.path.insert(0, autodirbin) os.environ['AUTODIR'] = autodir os.environ['AUTODIRBIN'] = autodirbin +os.environ['AUTODIRTEST'] = autodirtest os.environ['PYTHONPATH'] = autodirbin parser = OptionParser(usage='Usage: %prog [options] <control-file>') @@ -74,6 +76,9 @@ def usage(): options, args = parser.parse_args() +cmd_parser = cmdparser.CommandParser() +args = cmd_parser.parse_args(args) + # Check for a control file if not in prebuild mode. if len(args) != 1 and options.client_test_setup is None: print "Missing control file!" -- 1.7.7.4 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
