JDevlieghere created this revision. JDevlieghere added a reviewer: LLDB. Herald added a project: LLDB.
This removes support for reading the `LLDB_TEST_ARGUMENTS` environment variable and instead requires all arguments to be specified as part of the invocation. This ensures that dotest.py invocations are easily repeatable. Repository: rLLDB LLDB https://reviews.llvm.org/D66912 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/dotest_args.py Index: lldb/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -7,32 +7,10 @@ import os import textwrap -# Third-party modules - # LLDB modules from . import configuration -class ArgParseNamespace(object): - pass - - -def parse_args(parser, argv): - """ Returns an argument object. LLDB_TEST_ARGUMENTS environment variable can - be used to pass additional arguments. - """ - args = ArgParseNamespace() - - if ('LLDB_TEST_ARGUMENTS' in os.environ): - print( - "Arguments passed through environment: '%s'" % - os.environ['LLDB_TEST_ARGUMENTS']) - args = parser.parse_args([sys.argv[0]].__add__( - os.environ['LLDB_TEST_ARGUMENTS'].split()), namespace=args) - - return parser.parse_args(args=argv, namespace=args) - - def create_parser(): parser = argparse.ArgumentParser( description='description', Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -48,6 +48,9 @@ from lldbsuite.test_event.event_builder import EventBuilder from ..support import seven +def get_dotest_invocation(): + return ' '.join(sys.argv) + def is_exe(fpath): """Returns true if fpath is an executable.""" @@ -228,9 +231,9 @@ try: parser = dotest_args.create_parser() - args = dotest_args.parse_args(parser, sys.argv[1:]) + args = parser.parse_args() except: - print(' '.join(sys.argv)) + print(get_dotest_invocation()) raise if args.unset_env_varnames: @@ -255,7 +258,7 @@ # Only print the args if being verbose. if args.v and not args.q: - print(sys.argv) + print(get_dotest_invocation()) if args.h: do_help = True @@ -824,9 +827,6 @@ 'log enable failed (check GDB_REMOTE_LOG env variable)') -def getMyCommandLine(): - return ' '.join(sys.argv) - # ======================================== # # # # Execution of the test driver starts here # @@ -1113,7 +1113,7 @@ "\nSession logs for test failures/errors/unexpected successes" " will go into directory '%s'\n" % configuration.sdir_name) - sys.stderr.write("Command invoked: %s\n" % getMyCommandLine()) + sys.stderr.write("Command invoked: %s\n" % get_dotest_invocation()) # # Invoke the default TextTestRunner to run the test suite
Index: lldb/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -7,32 +7,10 @@ import os import textwrap -# Third-party modules - # LLDB modules from . import configuration -class ArgParseNamespace(object): - pass - - -def parse_args(parser, argv): - """ Returns an argument object. LLDB_TEST_ARGUMENTS environment variable can - be used to pass additional arguments. - """ - args = ArgParseNamespace() - - if ('LLDB_TEST_ARGUMENTS' in os.environ): - print( - "Arguments passed through environment: '%s'" % - os.environ['LLDB_TEST_ARGUMENTS']) - args = parser.parse_args([sys.argv[0]].__add__( - os.environ['LLDB_TEST_ARGUMENTS'].split()), namespace=args) - - return parser.parse_args(args=argv, namespace=args) - - def create_parser(): parser = argparse.ArgumentParser( description='description', Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -48,6 +48,9 @@ from lldbsuite.test_event.event_builder import EventBuilder from ..support import seven +def get_dotest_invocation(): + return ' '.join(sys.argv) + def is_exe(fpath): """Returns true if fpath is an executable.""" @@ -228,9 +231,9 @@ try: parser = dotest_args.create_parser() - args = dotest_args.parse_args(parser, sys.argv[1:]) + args = parser.parse_args() except: - print(' '.join(sys.argv)) + print(get_dotest_invocation()) raise if args.unset_env_varnames: @@ -255,7 +258,7 @@ # Only print the args if being verbose. if args.v and not args.q: - print(sys.argv) + print(get_dotest_invocation()) if args.h: do_help = True @@ -824,9 +827,6 @@ 'log enable failed (check GDB_REMOTE_LOG env variable)') -def getMyCommandLine(): - return ' '.join(sys.argv) - # ======================================== # # # # Execution of the test driver starts here # @@ -1113,7 +1113,7 @@ "\nSession logs for test failures/errors/unexpected successes" " will go into directory '%s'\n" % configuration.sdir_name) - sys.stderr.write("Command invoked: %s\n" % getMyCommandLine()) + sys.stderr.write("Command invoked: %s\n" % get_dotest_invocation()) # # Invoke the default TextTestRunner to run the test suite
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits