Skip to content

[test] Suppresses Pylint warnings in lit config scripts. #63910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/AutoDiff/compiler_crashers/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'asserts' not in config.available_features:
config.unsupported = True
9 changes: 9 additions & 0 deletions test/AutoDiff/compiler_crashers_fixed/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'asserts' not in config.available_features:
config.unsupported = True
9 changes: 9 additions & 0 deletions test/AutoDiff/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'differentiable_programming' not in config.available_features:
config.unsupported = True
9 changes: 9 additions & 0 deletions test/AutoDiff/stdlib/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# AutoDiff is not shipped in any OS and does not support backdeployment
if 'use_os_stdlib' in config.available_features or \
'back_deployment_runtime' in config.available_features:
Expand Down
9 changes: 9 additions & 0 deletions test/AutoDiff/validation-test/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# AutoDiff is not shipped in any OS and does not support backdeployment
if 'use_os_stdlib' in config.available_features or \
'back_deployment_runtime' in config.available_features:
Expand Down
9 changes: 9 additions & 0 deletions test/Demangle/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# suffixes: A list of file extensions to treat as test files.
config.suffixes.add('.test')
config.suffixes.add('.cpp')
9 changes: 9 additions & 0 deletions test/Distributed/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/Driver/LegacyDriver/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the environment.
config.environment = dict(config.environment)

Expand Down
11 changes: 11 additions & 0 deletions test/IRGen/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
import os

from lit.TestingConfig import SubstituteCaptures

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/Interop/CxxToSwiftToCxx/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.suffixes = ['.swift', '.cpp', '.mm']
9 changes: 9 additions & 0 deletions test/Interop/ObjCToSwiftToObjCxx/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.suffixes = ['.swift', '.cpp', '.mm']
9 changes: 9 additions & 0 deletions test/Interop/SwiftToC/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.suffixes = ['.swift', '.c']
9 changes: 9 additions & 0 deletions test/Interop/SwiftToCxx/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.suffixes = ['.swift', '.cpp', '.mm']
11 changes: 11 additions & 0 deletions test/Interop/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
import os

from lit.TestingConfig import SubstituteCaptures

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/Macros/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# '-enable-experimental-feature Macros' requires an asserts build.
if 'asserts' not in config.available_features:
config.unsupported = True
10 changes: 10 additions & 0 deletions test/ModuleInterface/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import os
import sys

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/PrintAsObjC/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/SILGen/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions test/Sanitizers/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'no_asan' not in config.available_features:
config.unsupported = True
8 changes: 7 additions & 1 deletion test/SourceKit/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import os
import pipes
import sys

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'sourcekit' not in config.available_features:
config.unsupported = True
Expand All @@ -19,4 +26,3 @@ else:
config.substitutions.append( ('%complete-test', '%s -module-cache-path=%r' % (config.complete_test, config.clang_module_cache_path)) )
config.substitutions.append( ('%swiftlib_dir', config.swiftlib_dir) )
config.substitutions.append( ('%sed_clean', '%s %s' % (pipes.quote(sys.executable), sk_path_sanitize) ) )

9 changes: 9 additions & 0 deletions test/StringProcessing/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

if 'string_processing' not in config.available_features:
config.unsupported = True
7 changes: 7 additions & 0 deletions test/Unit/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ import os
import lit.formats
import lit.util

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

###

# Check that the object root is known.
Expand Down
9 changes: 9 additions & 0 deletions test/api-digester/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.suffixes.add('.test')
9 changes: 9 additions & 0 deletions test/benchmark/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# suffixes: A list of file extensions to treat as test files.
config.suffixes.add('.md')
21 changes: 8 additions & 13 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ from distutils.sysconfig import get_python_lib
import lit
import lit.formats
import lit.util
from lit.TestingConfig import SubstituteCaptures

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

import site
site.addsitedir(os.path.dirname(__file__))
Expand Down Expand Up @@ -1557,22 +1565,9 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
target_specific_module_triple)
config.variant_triple = re.sub(r'androideabi', 'android', config.variant_triple)
config.target_cc_options = "-fPIE"
def get_architecture_value(**kwargs):
result = kwargs[run_cpu]
if result is None:
if run_cpu.startswith("armv7"):
result = kwargs["armv7"]
elif run_cpu == "arm64":
result = kwards["aarch64"]
return result

config.target_cxx_lib = "-lstdc++"
config.target_pic_opt = "-fPIC"

ndk_platform_tuple = get_architecture_value(armv7="armeabi-v7a",
aarch64="arm64-v8a")
ndk_platform_triple = get_architecture_value(armv7="arm-linux-androideabi",
aarch64="aarch64-linux-android")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These NDK deletions are fine, I confirmed that they're unused.

if platform.system() == 'Linux':
prebuilt_directory = 'linux-x86_64'
elif platform.system() == 'Darwin':
Expand Down
9 changes: 7 additions & 2 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
# -----------------------------------------------------------------------------

import os
import platform
import sys

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.cmake = "@CMAKE_COMMAND@"
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
Expand Down
9 changes: 9 additions & 0 deletions test/refactoring/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

config.substitutions.append((r'%refactor-check-compiles', f'{config.python} {config.refactor_check_compiles} -swift-refactor {config.swift_refactor} -swift-frontend {config.swift_frontend} -temp-dir %t {config.resource_dir_opt}'))
config.substitutions.append((r'%refactor', f'{config.swift_refactor} {config.resource_dir_opt}'))
10 changes: 10 additions & 0 deletions test/remote-run/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import os
import sys

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)

Expand Down
9 changes: 9 additions & 0 deletions validation-test/ParseableInterface/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
import os

# Tell pylint that we know config and lit_config exist somewhere.
if 'PYLINT_IMPORT' in os.environ:
from lit.LitConfig import LitConfig
from lit.TestingConfig import TestingConfig
config = TestingConfig()
lit_config = LitConfig()

# suffixes: A list of file extensions to treat as test files.
config.suffixes.add('.py')
Loading