[Lldb-commits] [PATCH] D85322: [lldb/test] Replace LLDB_TEST_SRC env variable with configuration
This revision was automatically updated to reflect the committed changes. Closed by commit rGf425c0442c3e: [lldb/test] Replace LLDB_TEST_SRC env variable with configuration (authored by rupprecht). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85322/new/ https://reviews.llvm.org/D85322 Files: lldb/packages/Python/lldbsuite/test/configuration.py lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/packages/Python/lldbsuite/test/plugins/builder_base.py Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py === --- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -62,12 +62,11 @@ # Construct the base make invocation. lldb_test = os.environ["LLDB_TEST"] -lldb_test_src = os.environ["LLDB_TEST_SRC"] -if not (lldb_test and lldb_test_src and configuration.test_build_dir and test_subdir and +if not (lldb_test and configuration.test_build_dir and test_subdir and test_name and (not os.path.isabs(test_subdir))): raise Exception("Could not derive test directories") build_dir = os.path.join(configuration.test_build_dir, test_subdir, test_name) -src_dir = os.path.join(lldb_test_src, test_subdir) +src_dir = os.path.join(configuration.test_src_root, test_subdir) # This is a bit of a hack to make inline testcases work. makefile = os.path.join(src_dir, "Makefile") if not os.path.isfile(makefile): Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -496,7 +496,7 @@ mydir = TestBase.compute_mydir(__file__) ''' # /abs/path/to/packages/group/subdir/mytest.py -> group/subdir -rel_prefix = test_file[len(os.environ["LLDB_TEST_SRC"]) + 1:] +rel_prefix = test_file[len(configuration.test_src_root) + 1:] return os.path.dirname(rel_prefix) def TraceOn(self): @@ -520,15 +520,11 @@ # Save old working directory. cls.oldcwd = os.getcwd() -# Change current working directory if ${LLDB_TEST_SRC} is defined. -# See also dotest.py which sets up ${LLDB_TEST_SRC}. -if ("LLDB_TEST_SRC" in os.environ): -full_dir = os.path.join(os.environ["LLDB_TEST_SRC"], -cls.mydir) -if traceAlways: -print("Change dir to:", full_dir, file=sys.stderr) -os.chdir(full_dir) -lldb.SBReproducer.SetWorkingDirectory(full_dir) +full_dir = os.path.join(configuration.test_src_root, cls.mydir) +if traceAlways: +print("Change dir to:", full_dir, file=sys.stderr) +os.chdir(full_dir) +lldb.SBReproducer.SetWorkingDirectory(full_dir) # Set platform context. cls.platformContext = lldbplatformutil.createPlatformContext() @@ -662,7 +658,7 @@ def getSourceDir(self): """Return the full path to the current test.""" -return os.path.join(os.environ["LLDB_TEST_SRC"], self.mydir) +return os.path.join(configuration.test_src_root, self.mydir) def getBuildDirBasename(self): return self.__class__.__module__ + "." + self.testMethodName @@ -1098,7 +1094,7 @@ /--.. """ -dname = os.path.join(os.environ["LLDB_TEST_SRC"], +dname = os.path.join(configuration.test_src_root, os.environ["LLDB_SESSION_DIRNAME"]) if not os.path.isdir(dname): os.mkdir(dname) Index: lldb/packages/Python/lldbsuite/test/dotest.py === --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -467,7 +467,6 @@ sys.exit(-1) os.environ["LLDB_TEST"] = scriptPath -os.environ["LLDB_TEST_SRC"] = lldbsuite.lldb_test_root # Set up the root build directory. if not configuration.test_build_dir: Index: lldb/packages/Python/lldbsuite/test/configuration.py === --- lldb/packages/Python/lldbsuite/test/configuration.py +++ lldb/packages/Python/lldbsuite/test/configuration.py @@ -103,6 +103,10 @@ # because it doesn't work under a debugger testdirs = [lldbsuite.lldb_test_root] +# The root of the test case tree (where the actual tests reside, not the test +# infrastructure). +test_src_root = lldbsuite.lldb_test_root + # Separator string. separator = '-' * 70 Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py === ---
[Lldb-commits] [PATCH] D85322: [lldb/test] Replace LLDB_TEST_SRC env variable with configuration
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85322/new/ https://reviews.llvm.org/D85322 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D85322: [lldb/test] Replace LLDB_TEST_SRC env variable with configuration
rupprecht created this revision. rupprecht added a reviewer: JDevlieghere. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. rupprecht requested review of this revision. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D85322 Files: lldb/packages/Python/lldbsuite/test/configuration.py lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/packages/Python/lldbsuite/test/plugins/builder_base.py Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py === --- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -62,12 +62,11 @@ # Construct the base make invocation. lldb_test = os.environ["LLDB_TEST"] -lldb_test_src = os.environ["LLDB_TEST_SRC"] -if not (lldb_test and lldb_test_src and configuration.test_build_dir and test_subdir and +if not (lldb_test and configuration.test_build_dir and test_subdir and test_name and (not os.path.isabs(test_subdir))): raise Exception("Could not derive test directories") build_dir = os.path.join(configuration.test_build_dir, test_subdir, test_name) -src_dir = os.path.join(lldb_test_src, test_subdir) +src_dir = os.path.join(configuration.test_src_root, test_subdir) # This is a bit of a hack to make inline testcases work. makefile = os.path.join(src_dir, "Makefile") if not os.path.isfile(makefile): Index: lldb/packages/Python/lldbsuite/test/lldbtest.py === --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -496,7 +496,7 @@ mydir = TestBase.compute_mydir(__file__) ''' # /abs/path/to/packages/group/subdir/mytest.py -> group/subdir -rel_prefix = test_file[len(os.environ["LLDB_TEST_SRC"]) + 1:] +rel_prefix = test_file[len(configuration.test_src_root) + 1:] return os.path.dirname(rel_prefix) def TraceOn(self): @@ -520,15 +520,11 @@ # Save old working directory. cls.oldcwd = os.getcwd() -# Change current working directory if ${LLDB_TEST_SRC} is defined. -# See also dotest.py which sets up ${LLDB_TEST_SRC}. -if ("LLDB_TEST_SRC" in os.environ): -full_dir = os.path.join(os.environ["LLDB_TEST_SRC"], -cls.mydir) -if traceAlways: -print("Change dir to:", full_dir, file=sys.stderr) -os.chdir(full_dir) -lldb.SBReproducer.SetWorkingDirectory(full_dir) +full_dir = os.path.join(configuration.test_src_root, cls.mydir) +if traceAlways: +print("Change dir to:", full_dir, file=sys.stderr) +os.chdir(full_dir) +lldb.SBReproducer.SetWorkingDirectory(full_dir) # Set platform context. cls.platformContext = lldbplatformutil.createPlatformContext() @@ -662,7 +658,7 @@ def getSourceDir(self): """Return the full path to the current test.""" -return os.path.join(os.environ["LLDB_TEST_SRC"], self.mydir) +return os.path.join(configuration.test_src_root, self.mydir) def getBuildDirBasename(self): return self.__class__.__module__ + "." + self.testMethodName @@ -1095,7 +1091,7 @@ /--.. """ -dname = os.path.join(os.environ["LLDB_TEST_SRC"], +dname = os.path.join(configuration.test_src_root, os.environ["LLDB_SESSION_DIRNAME"]) if not os.path.isdir(dname): os.mkdir(dname) Index: lldb/packages/Python/lldbsuite/test/dotest.py === --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -467,7 +467,6 @@ sys.exit(-1) os.environ["LLDB_TEST"] = scriptPath -os.environ["LLDB_TEST_SRC"] = lldbsuite.lldb_test_root # Set up the root build directory. if not configuration.test_build_dir: Index: lldb/packages/Python/lldbsuite/test/configuration.py === --- lldb/packages/Python/lldbsuite/test/configuration.py +++ lldb/packages/Python/lldbsuite/test/configuration.py @@ -103,6 +103,10 @@ # because it doesn't work under a debugger testdirs = [lldbsuite.lldb_test_root] +# The root of the test case tree (where the actual tests reside, not the test +# infrastructure). +test_src_root = lldbsuite.lldb_test_root + # Separator string. separator = '-' * 70 Index: lldb/packages/Python/lldbsuite/test/plugins/builder_base.py === --- lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++