[Lldb-commits] [lldb] e20a3b9 - [lldb][tests][NFC] Unify variable naming convention

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 10 06:38:15 PST 2020


Author: Tatyana Krasnukha
Date: 2020-01-10T17:37:55+03:00
New Revision: e20a3b9b6c028ef3fea92ddb19e98db45e3d0509

URL: https://github.com/llvm/llvm-project/commit/e20a3b9b6c028ef3fea92ddb19e98db45e3d0509
DIFF: https://github.com/llvm/llvm-project/commit/e20a3b9b6c028ef3fea92ddb19e98db45e3d0509.diff

LOG: [lldb][tests][NFC] Unify variable naming convention

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/configuration.py
    lldb/packages/Python/lldbsuite/test/dotest.py
    lldb/packages/Python/lldbsuite/test/dotest_args.py
    lldb/packages/Python/lldbsuite/test/lldbtest.py
    lldb/packages/Python/lldbsuite/test/test_result.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 494af7e2acd4..21d527a90478 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -25,16 +25,16 @@
 suite = unittest2.TestSuite()
 
 # The list of categories we said we care about
-categoriesList = None
+categories_list = None
 # set to true if we are going to use categories for cherry-picking test cases
-useCategories = False
+use_categories = False
 # Categories we want to skip
-skipCategories = ["darwin-log"]
+skip_categories = ["darwin-log"]
 # use this to track per-category failures
-failuresPerCategory = {}
+failures_per_category = {}
 
 # The path to LLDB.framework is optional.
-lldbFrameworkPath = None
+lldb_framework_path = None
 
 # Test suite repeat count.  Can be overwritten with '-# count'.
 count = 1
@@ -131,12 +131,12 @@
 all_tests = set()
 
 def shouldSkipBecauseOfCategories(test_categories):
-    if useCategories:
+    if use_categories:
         if len(test_categories) == 0 or len(
-                categoriesList & set(test_categories)) == 0:
+                categories_list & set(test_categories)) == 0:
             return True
 
-    for category in skipCategories:
+    for category in skip_categories:
         if category in test_categories:
             return True
 

diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 3d67b45c1d9d..e3f204828271 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -318,17 +318,17 @@ def parseOptionsAndInitTestdirs():
     else:
         configuration.arch = platform_machine
 
-    if args.categoriesList:
-        configuration.categoriesList = set(
+    if args.categories_list:
+        configuration.categories_list = set(
             test_categories.validate(
-                args.categoriesList, False))
-        configuration.useCategories = True
+                args.categories_list, False))
+        configuration.use_categories = True
     else:
-        configuration.categoriesList = []
+        configuration.categories_list = []
 
-    if args.skipCategories:
-        configuration.skipCategories += test_categories.validate(
-            args.skipCategories, False)
+    if args.skip_categories:
+        configuration.skip_categories += test_categories.validate(
+            args.skip_categories, False)
 
     if args.E:
         os.environ['CFLAGS_EXTRAS'] = args.E
@@ -352,7 +352,7 @@ def parseOptionsAndInitTestdirs():
         configuration.filters.extend(args.f)
 
     if args.framework:
-        configuration.lldbFrameworkPath = args.framework
+        configuration.lldb_framework_path = args.framework
 
     if args.executable:
         # lldb executable is passed explicitly
@@ -565,21 +565,21 @@ def setupSysPath():
         if not configuration.shouldSkipBecauseOfCategories(["lldb-vscode"]):
             print(
                 "The 'lldb-vscode' executable cannot be located.  The lldb-vscode tests can not be run as a result.")
-            configuration.skipCategories.append("lldb-vscode")
+            configuration.skip_categories.append("lldb-vscode")
 
     lldbPythonDir = None  # The directory that contains 'lldb/__init__.py'
-    if not configuration.lldbFrameworkPath and os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")):
-        configuration.lldbFrameworkPath = os.path.join(lldbLibDir, "LLDB.framework")
-    if configuration.lldbFrameworkPath:
-        lldbtest_config.lldbFrameworkPath = configuration.lldbFrameworkPath
+    if not configuration.lldb_framework_path and os.path.exists(os.path.join(lldbLibDir, "LLDB.framework")):
+        configuration.lldb_framework_path = os.path.join(lldbLibDir, "LLDB.framework")
+    if configuration.lldb_framework_path:
+        lldbtest_config.lldb_framework_path = configuration.lldb_framework_path
         candidatePath = os.path.join(
-            configuration.lldbFrameworkPath, 'Resources', 'Python')
+            configuration.lldb_framework_path, 'Resources', 'Python')
         if os.path.isfile(os.path.join(candidatePath, 'lldb/__init__.py')):
             lldbPythonDir = candidatePath
         if not lldbPythonDir:
             print(
                 'Resources/Python/lldb/__init__.py was not found in ' +
-                configuration.lldbFrameworkPath)
+                configuration.lldb_framework_path)
             sys.exit(-1)
     else:
         # If our lldb supports the -P option, use it to find the python path:
@@ -867,10 +867,10 @@ def checkLibcxxSupport():
     result, reason = canRunLibcxxTests()
     if result:
         return # libc++ supported
-    if "libc++" in configuration.categoriesList:
+    if "libc++" in configuration.categories_list:
         return # libc++ category explicitly requested, let it run.
     print("Libc++ tests will not be run because: " + reason)
-    configuration.skipCategories.append("libc++")
+    configuration.skip_categories.append("libc++")
 
 def canRunLibstdcxxTests():
     from lldbsuite.test import lldbplatformutil
@@ -886,10 +886,10 @@ def checkLibstdcxxSupport():
     result, reason = canRunLibstdcxxTests()
     if result:
         return # libstdcxx supported
-    if "libstdcxx" in configuration.categoriesList:
+    if "libstdcxx" in configuration.categories_list:
         return # libstdcxx category explicitly requested, let it run.
     print("libstdcxx tests will not be run because: " + reason)
-    configuration.skipCategories.append("libstdcxx")
+    configuration.skip_categories.append("libstdcxx")
 
 def canRunWatchpointTests():
     from lldbsuite.test import lldbplatformutil
@@ -912,10 +912,10 @@ def checkWatchpointSupport():
     result, reason = canRunWatchpointTests()
     if result:
         return # watchpoints supported
-    if "watchpoint" in configuration.categoriesList:
+    if "watchpoint" in configuration.categories_list:
         return # watchpoint category explicitly requested, let it run.
     print("watchpoint tests will not be run because: " + reason)
-    configuration.skipCategories.append("watchpoint")
+    configuration.skip_categories.append("watchpoint")
 
 def checkDebugInfoSupport():
     import lldb
@@ -924,11 +924,11 @@ def checkDebugInfoSupport():
     compiler = configuration.compiler
     skipped = []
     for cat in test_categories.debug_info_categories:
-        if cat in configuration.categoriesList:
+        if cat in configuration.categories_list:
             continue # Category explicitly requested, let it run.
         if test_categories.is_supported_on_platform(cat, platform, compiler):
             continue
-        configuration.skipCategories.append(cat)
+        configuration.skip_categories.append(cat)
         skipped.append(cat)
     if skipped:
         print("Skipping following debug info categories:", skipped)
@@ -1125,13 +1125,13 @@ def run_suite():
             " can be found in directory '%s'\n" %
             configuration.sdir_name)
 
-    if configuration.useCategories and len(
-            configuration.failuresPerCategory) > 0:
+    if configuration.use_categories and len(
+            configuration.failures_per_category) > 0:
         sys.stderr.write("Failures per category:\n")
-        for category in configuration.failuresPerCategory:
+        for category in configuration.failures_per_category:
             sys.stderr.write(
                 "%s - %d\n" %
-                (category, configuration.failuresPerCategory[category]))
+                (category, configuration.failures_per_category[category]))
 
     # Exiting.
     exitTestSuite(configuration.failed)

diff  --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 2d5f048d53e4..9bcebc58cd22 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -75,13 +75,13 @@ def create_parser():
         '--category',
         metavar='category',
         action='append',
-        dest='categoriesList',
+        dest='categories_list',
         help=textwrap.dedent('''Specify categories of test cases of interest. Can be specified more than once.'''))
     group.add_argument(
         '--skip-category',
         metavar='category',
         action='append',
-        dest='skipCategories',
+        dest='skip_categories',
         help=textwrap.dedent('''Specify categories of test cases to skip. Takes precedence over -G. Can be specified more than once.'''))
 
     # Configuration options

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 0b32fc4ef585..ffd56fcb0ed0 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -825,8 +825,8 @@ def setUp(self):
         self.darwinWithFramework = self.platformIsDarwin()
         if sys.platform.startswith("darwin"):
             # Handle the framework environment variable if it is set
-            if hasattr(lldbtest_config, 'lldbFrameworkPath'):
-                framework_path = lldbtest_config.lldbFrameworkPath
+            if hasattr(lldbtest_config, 'lldb_framework_path'):
+                framework_path = lldbtest_config.lldb_framework_path
                 # Framework dir should be the directory containing the framework
                 self.framework_dir = framework_path[:framework_path.rfind('LLDB.framework')]
             # If a framework dir was not specified assume the Xcode build

diff  --git a/lldb/packages/Python/lldbsuite/test/test_result.py b/lldb/packages/Python/lldbsuite/test/test_result.py
index 13500856e420..193a64c5168a 100644
--- a/lldb/packages/Python/lldbsuite/test/test_result.py
+++ b/lldb/packages/Python/lldbsuite/test/test_result.py
@@ -258,14 +258,14 @@ def addFailure(self, test, err):
         self.stream.write(
             "FAIL: LLDB (%s) :: %s\n" %
             (self._config_string(test), str(test)))
-        if configuration.useCategories:
+        if configuration.use_categories:
             test_categories = self.getCategoriesForTest(test)
             for category in test_categories:
-                if category in configuration.failuresPerCategory:
-                    configuration.failuresPerCategory[
-                        category] = configuration.failuresPerCategory[category] + 1
+                if category in configuration.failures_per_category:
+                    configuration.failures_per_category[
+                        category] = configuration.failures_per_category[category] + 1
                 else:
-                    configuration.failuresPerCategory[category] = 1
+                    configuration.failures_per_category[category] = 1
         if self.results_formatter:
             self.results_formatter.handle_event(
                 EventBuilder.event_for_failure(test, err))


        


More information about the lldb-commits mailing list