From d865c6b70770d44b1b5e9230299d1597cda6422f Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 8 Dec 2015 22:15:48 +0000 Subject: [PATCH] Remove the -c option from dotest.py. This seems to be a legacy relic from days gone by where the remote test suite runner operated completely differently than it does today. git blames and comments traced this functionality back to about 2012, and nobody seems to know anything about it now. llvm-svn: 255060 --- .../TestPublicAPIHeaders.py | 4 +- .../Python/lldbsuite/test/configuration.py | 20 +---- lldb/packages/Python/lldbsuite/test/dotest.py | 78 ------------------- .../Python/lldbsuite/test/dotest_args.py | 1 - .../inferior-changed/TestInferiorChanged.py | 3 - .../Python/lldbsuite/test/lldbtest.py | 64 +-------------- 6 files changed, 6 insertions(+), 164 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py b/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py index 64687dfe6a3d..0d0507f1d70c 100644 --- a/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py +++ b/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py @@ -26,8 +26,8 @@ class SBDirCheckerCase(TestBase): """Test the SB API directory and make sure there's no unwanted stuff.""" # Only proceed if this is an Apple OS, "x86_64", and local platform. - if not (self.platformIsDarwin() and self.getArchitecture() == "x86_64" and not configuration.test_remote): - self.skipTest("This test is only for LLDB.framework built 64-bit and !configuration.test_remote") + if not (self.platformIsDarwin() and self.getArchitecture() == "x86_64"): + self.skipTest("This test is only for LLDB.framework built 64-bit") if self.getArchitecture() == "i386": self.skipTest("LLDB is 64-bit and cannot be linked to 32-bit test program.") diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index 2ef0cacc99c4..aced15add2bd 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -72,26 +72,12 @@ failuresPerCategory = {} # The path to LLDB.framework is optional. lldbFrameworkPath = None -# The config file is optional. -configFile = None - # Test suite repeat count. Can be overwritten with '-# count'. count = 1 -# The dictionary as a result of sourcing configFile. -config = {} -# The pre_flight and post_flight functions come from reading a config file. -pre_flight = None -post_flight = None -# So do the lldbtest_remote_sandbox and lldbtest_remote_shell_template variables. -test_remote = False -lldbtest_remote_sandbox = None -lldbtest_remote_shell_template = None - -# The 'archs' and 'compilers' can be specified via either command line or configFile, -# with the command line overriding the configFile. The corresponding options can be -# specified more than once. For example, "-A x86_64 -A i386" => archs=['x86_64', 'i386'] -# and "-C gcc -C clang" => compilers=['gcc', 'clang']. +# The 'archs' and 'compilers' can be specified via command line. The corresponding +# options can be specified more than once. For example, "-A x86_64 -A i386" +# => archs=['x86_64', 'i386'] and "-C gcc -C clang" => compilers=['gcc', 'clang']. archs = None # Must be initialized after option parsing compilers = None # Must be initialized after option parsing diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index eed901252128..59317e948abc 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -300,14 +300,6 @@ def parseOptionsAndInitTestdirs(): "functionality (-G lldb-mi, --skip-category lldb-mi) instead.") sys.exit(1) - if args.c: - if args.c.startswith('-'): - usage(parser) - configuration.configFile = args.c - if not os.path.isfile(configuration.configFile): - print('Config file:', configuration.configFile, 'does not exist!') - usage(parser) - if args.d: sys.stdout.write("Suspending the process %d to wait for debugger to attach...\n" % os.getpid()) sys.stdout.flush() @@ -546,38 +538,6 @@ def parseOptionsAndInitTestdirs(): #print("testdirs:", testdirs) - # Source the configFile if specified. - # The side effect, if any, will be felt from this point on. An example - # config file may be these simple two lines: - # - # sys.stderr = open("/tmp/lldbtest-stderr", "w") - # sys.stdout = open("/tmp/lldbtest-stdout", "w") - # - # which will reassign the two file objects to sys.stderr and sys.stdout, - # respectively. - # - # See also lldb-trunk/examples/test/usage-config. - if configuration.configFile: - # Pass config (a dictionary) as the locals namespace for side-effect. - execfile(configuration.configFile, globals(), configuration.config) - #print("config:", config) - if "pre_flight" in configuration.config: - configuration.pre_flight = configuration.config["pre_flight"] - if not six.callable(configuration.pre_flight): - print("fatal error: pre_flight is not callable, exiting.") - sys.exit(1) - if "post_flight" in configuration.config: - configuration.post_flight = configuration.config["post_flight"] - if not six.callable(configuration.post_flight): - print("fatal error: post_flight is not callable, exiting.") - sys.exit(1) - if "lldbtest_remote_sandbox" in configuration.config: - configuration.lldbtest_remote_sandbox = configuration.config["lldbtest_remote_sandbox"] - if "lldbtest_remote_shell_template" in configuration.config: - configuration.lldbtest_remote_shell_template = configuration.config["lldbtest_remote_shell_template"] - #print("sys.stderr:", sys.stderr) - #print("sys.stdout:", sys.stdout) - def getXcodeOutputPaths(lldbRootDirectory): result = [] @@ -1138,25 +1098,6 @@ def run_suite(): # Now that we have loaded all the test cases, run the whole test suite. # - # The pre_flight and post_flight come from reading a config file. - def getsource_if_available(obj): - """ - Return the text of the source code for an object if available. Otherwise, - a print representation is returned. - """ - import inspect - try: - return inspect.getsource(obj) - except: - return repr(obj) - - if not configuration.noHeaders: - print("configuration.pre_flight:", getsource_if_available(configuration.pre_flight)) - print("configuration.post_flight:", getsource_if_available(configuration.post_flight)) - - # If either pre_flight or post_flight is defined, set configuration.test_remote to True. - configuration.test_remote = configuration.pre_flight or configuration.post_flight - # Turn on lldb loggings if necessary. lldbLoggings() @@ -1205,15 +1146,9 @@ def run_suite(): iterArchs = False iterCompilers = False - if not configuration.archs and "archs" in configuration.config: - configuration.archs = configuration.config["archs"] - if isinstance(configuration.archs, list) and len(configuration.archs) >= 1: iterArchs = True - if not configuration.compilers and "compilers" in configuration.config: - configuration.compilers = configuration.config["compilers"] - # # Add some intervention here to sanity check that the compilers requested are sane. # If found not to be an executable program, the invalid one is dropped from the list. @@ -1276,19 +1211,6 @@ def run_suite(): tbl = str.maketrans(' ', '-') configPostfix = configString.translate(tbl) - # Check whether we need to split stderr/stdout into configuration - # specific files. - if old_stderr.name != '' and configuration.config.get('split_stderr'): - if new_stderr: - new_stderr.close() - new_stderr = open("%s.%s" % (old_stderr.name, configPostfix), "w") - sys.stderr = new_stderr - if old_stdout.name != '' and configuration.config.get('split_stdout'): - if new_stdout: - new_stdout.close() - new_stdout = open("%s.%s" % (old_stdout.name, configPostfix), "w") - sys.stdout = new_stdout - # If we specified a relocated directory to run the test suite, do # the extra housekeeping to copy the testdirs to a configStringified # directory and to update sys.path before invoking the test runner. diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py index 63857c21fb47..b8186fb3c3c9 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest_args.py +++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -68,7 +68,6 @@ def create_parser(): # Configuration options group = parser.add_argument_group('Configuration options') - group.add_argument('-c', metavar='config-file', help='Read a config file specified after this option') # FIXME: additional doc. group.add_argument('--framework', metavar='framework-path', help='The path to LLDB.framework') group.add_argument('--executable', metavar='executable-path', help='The path to the lldb executable') group.add_argument('--libcxx', metavar='directory', help='The path to custom libc++ library') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py b/lldb/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py index 8b6c1cdb1ca9..830c7f69355f 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py @@ -55,9 +55,6 @@ class ChangedInferiorTestCase(TestBase): def inferior_not_crashing(self): """Test lldb reloads the inferior after it was changed during the session.""" self.runCmd("process kill") - # Prod the lldb-platform that we have a newly built inferior ready. - if configuration.lldbtest_remote_sandbox: - self.runCmd("file " + self.exe, CURRENT_EXECUTABLE_SET) self.runCmd("run", RUN_SUCCEEDED) self.runCmd("process status") diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index c83246aef6b9..f45f00f4a5cd 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -617,7 +617,7 @@ def not_remote_testsuite_ready(func): raise Exception("@not_remote_testsuite_ready can only be used to decorate a test method") @wraps(func) def wrapper(self, *args, **kwargs): - if configuration.lldbtest_remote_sandbox or lldb.remote_platform: + if lldb.remote_platform: self.skipTest("not ready for remote testsuite") return func(self, *args, **kwargs) @@ -2429,31 +2429,6 @@ class TestBase(Base): if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ: self.timeWaitNextLaunch = float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"]) - # - # Warning: MAJOR HACK AHEAD! - # If we are running testsuite remotely (by checking lldb.lldbtest_remote_sandbox), - # redefine the self.dbg.CreateTarget(filename) method to execute a "file filename" - # command, instead. See also runCmd() where it decorates the "file filename" call - # with additional functionality when running testsuite remotely. - # - if configuration.lldbtest_remote_sandbox: - def DecoratedCreateTarget(arg): - self.runCmd("file %s" % arg) - target = self.dbg.GetSelectedTarget() - # - # SBtarget.LaunchSimple () currently not working for remote platform? - # johnny @ 04/23/2012 - # - def DecoratedLaunchSimple(argv, envp, wd): - self.runCmd("run") - return target.GetProcess() - target.LaunchSimple = DecoratedLaunchSimple - - return target - self.dbg.CreateTarget = DecoratedCreateTarget - if self.TraceOn(): - print("self.dbg.Create is redefined to:\n%s" % getsource_if_available(DecoratedCreateTarget)) - # We want our debugger to be synchronous. self.dbg.SetAsync(False) @@ -2465,10 +2440,6 @@ class TestBase(Base): # And the result object. self.res = lldb.SBCommandReturnObject() - # Run global pre-flight code, if defined via the config file. - if configuration.pre_flight: - configuration.pre_flight(self) - if lldb.remote_platform and configuration.lldb_platform_working_dir: remote_test_dir = lldbutil.join_remote_paths( configuration.lldb_platform_working_dir, @@ -2594,10 +2565,6 @@ class TestBase(Base): for target in targets: self.dbg.DeleteTarget(target) - # Run global post-flight code, if defined via the config file. - if configuration.post_flight: - configuration.post_flight(self) - # Do this last, to make sure it's in reverse order from how we setup. Base.tearDown(self) @@ -2631,37 +2598,8 @@ class TestBase(Base): trace = (True if traceAlways else trace) - # This is an opportunity to insert the 'platform target-install' command if we are told so - # via the settig of lldb.lldbtest_remote_sandbox. if cmd.startswith("target create "): cmd = cmd.replace("target create ", "file ") - if cmd.startswith("file ") and configuration.lldbtest_remote_sandbox: - with recording(self, trace) as sbuf: - the_rest = cmd.split("file ")[1] - # Split the rest of the command line. - atoms = the_rest.split() - # - # NOTE: This assumes that the options, if any, follow the file command, - # instead of follow the specified target. - # - target = atoms[-1] - # Now let's get the absolute pathname of our target. - abs_target = os.path.abspath(target) - print("Found a file command, target (with absolute pathname)=%s" % abs_target, file=sbuf) - fpath, fname = os.path.split(abs_target) - parent_dir = os.path.split(fpath)[0] - platform_target_install_command = 'platform target-install %s %s' % (fpath, configuration.lldbtest_remote_sandbox) - print("Insert this command to be run first: %s" % platform_target_install_command, file=sbuf) - self.ci.HandleCommand(platform_target_install_command, self.res) - # And this is the file command we want to execute, instead. - # - # Warning: SIDE EFFECT AHEAD!!! - # Populate the remote executable pathname into the lldb namespace, - # so that test cases can grab this thing out of the namespace. - # - remote_sandboxed_executable = abs_target.replace(parent_dir, configuration.lldbtest_remote_sandbox) - cmd = "file -P %s %s %s" % (remote_sandboxed_executable, the_rest.replace(target, ''), abs_target) - print("And this is the replaced file command: %s" % cmd, file=sbuf) running = (cmd.startswith("run") or cmd.startswith("process launch"))