summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/dotest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/dotest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py215
1 files changed, 87 insertions, 128 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 122c51432fc..22b02900a22 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -274,22 +274,21 @@ def parseOptionsAndInitTestdirs():
if args.h:
do_help = True
- if args.compilers:
- configuration.compilers = args.compilers
+ if args.compiler:
+ configuration.compiler = args.compiler
else:
# Use a compiler appropriate appropriate for the Apple SDK if one was
# specified
if platform_system == 'Darwin' and args.apple_sdk:
- configuration.compilers = [
- seven.get_command_output(
- 'xcrun -sdk "%s" -find clang 2> /dev/null' %
- (args.apple_sdk))]
+ configuration.compiler = seven.get_command_output(
+ 'xcrun -sdk "%s" -find clang 2> /dev/null' %
+ (args.apple_sdk))
else:
# 'clang' on ubuntu 14.04 is 3.4 so we try clang-3.5 first
candidateCompilers = ['clang-3.5', 'clang', 'gcc']
for candidate in candidateCompilers:
if which(candidate):
- configuration.compilers = [candidate]
+ configuration.compiler = candidate
break
if args.channels:
@@ -304,18 +303,17 @@ def parseOptionsAndInitTestdirs():
'xcrun --sdk "%s" --show-sdk-path 2> /dev/null' %
(args.apple_sdk))
- if args.archs:
- configuration.archs = args.archs
- for arch in configuration.archs:
- if arch.startswith(
- 'arm') and platform_system == 'Darwin' and not args.apple_sdk:
+ if args.arch:
+ configuration.arch = args.arch
+ if configuration.arch.startswith(
+ 'arm') and platform_system == 'Darwin' and not args.apple_sdk:
+ os.environ['SDKROOT'] = seven.get_command_output(
+ 'xcrun --sdk iphoneos.internal --show-sdk-path 2> /dev/null')
+ if not os.path.exists(os.environ['SDKROOT']):
os.environ['SDKROOT'] = seven.get_command_output(
- 'xcrun --sdk iphoneos.internal --show-sdk-path 2> /dev/null')
- if not os.path.exists(os.environ['SDKROOT']):
- os.environ['SDKROOT'] = seven.get_command_output(
- 'xcrun --sdk iphoneos --show-sdk-path 2> /dev/null')
+ 'xcrun --sdk iphoneos --show-sdk-path 2> /dev/null')
else:
- configuration.archs = [platform_machine]
+ configuration.arch = platform_machine
if args.categoriesList:
configuration.categoriesList = set(
@@ -1028,6 +1026,26 @@ def setDefaultTripleForPlatform():
return {}
+def checkCompiler():
+ # Add some intervention here to sanity check that the compiler requested is sane.
+ # If found not to be an executable program, we abort.
+ c = configuration.compiler
+ if which(c):
+ return
+
+ if not sys.platform.startswith("darwin"):
+ raise Exception(c + " is not a valid compiler")
+
+ pipe = subprocess.Popen(
+ ['xcrun', '-find', c], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ cmd_output = pipe.stdout.read()
+ if not cmd_output or "not found" in cmd_output:
+ raise Exception(c + " is not a valid compiler")
+
+ configuration.compiler = cmd_output.split('\n')[0]
+ print("'xcrun -find %s' returning %s" % (c, configuration.compiler))
+
+
def run_suite():
# On MacOS X, check to make sure that domain for com.apple.DebugSymbols defaults
# does not exist before proceeding to running the test suite.
@@ -1177,124 +1195,65 @@ def run_suite():
raise
#
- # Invoke the default TextTestRunner to run the test suite, possibly iterating
- # over different configurations.
+ # Invoke the default TextTestRunner to run the test suite
#
+ checkCompiler()
- iterArchs = False
- iterCompilers = False
+ if not configuration.parsable:
+ print("compiler=%s" % configuration.compiler)
- if isinstance(configuration.archs, list) and len(configuration.archs) >= 1:
- iterArchs = True
+ # Iterating over all possible architecture and compiler combinations.
+ os.environ["ARCH"] = configuration.arch
+ os.environ["CC"] = configuration.compiler
+ configString = "arch=%s compiler=%s" % (configuration.arch,
+ configuration.compiler)
+
+ # Translate ' ' to '-' for pathname component.
+ if six.PY2:
+ import string
+ tbl = string.maketrans(' ', '-')
+ else:
+ tbl = str.maketrans(' ', '-')
+ configPostfix = configString.translate(tbl)
- #
- # 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.
- for i in range(len(configuration.compilers)):
- c = configuration.compilers[i]
- if which(c):
- continue
- else:
- if sys.platform.startswith("darwin"):
- pipe = subprocess.Popen(
- ['xcrun', '-find', c], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- cmd_output = pipe.stdout.read()
- if cmd_output:
- if "not found" in cmd_output:
- print("dropping %s from the compilers used" % c)
- configuration.compilers.remove(i)
- else:
- configuration.compilers[i] = cmd_output.split('\n')[0]
- print(
- "'xcrun -find %s' returning %s" %
- (c, configuration.compilers[i]))
+ # Output the configuration.
+ if not configuration.parsable:
+ sys.stderr.write("\nConfiguration: " + configString + "\n")
+ # First, write out the number of collected test cases.
if not configuration.parsable:
- print("compilers=%s" % str(configuration.compilers))
-
- if not configuration.compilers or len(configuration.compilers) == 0:
- print("No eligible compiler found, exiting.")
- exitTestSuite(1)
-
- if isinstance(
- configuration.compilers,
- list) and len(
- configuration.compilers) >= 1:
- iterCompilers = True
-
- # If we iterate on archs or compilers, there is a chance we want to split
- # stderr/stdout.
- if iterArchs or iterCompilers:
- old_stderr = sys.stderr
- old_stdout = sys.stdout
- new_stderr = None
- new_stdout = None
+ sys.stderr.write(configuration.separator + "\n")
+ sys.stderr.write(
+ "Collected %d test%s\n\n" %
+ (configuration.suite.countTestCases(),
+ configuration.suite.countTestCases() != 1 and "s" or ""))
- # Iterating over all possible architecture and compiler combinations.
- for ia in range(len(configuration.archs) if iterArchs else 1):
- archConfig = ""
- if iterArchs:
- os.environ["ARCH"] = configuration.archs[ia]
- archConfig = "arch=%s" % configuration.archs[ia]
- for ic in range(len(configuration.compilers) if iterCompilers else 1):
- if iterCompilers:
- os.environ["CC"] = configuration.compilers[ic]
- configString = "%s compiler=%s" % (
- archConfig, configuration.compilers[ic])
- else:
- configString = archConfig
-
- if iterArchs or iterCompilers:
- # Translate ' ' to '-' for pathname component.
- if six.PY2:
- import string
- tbl = string.maketrans(' ', '-')
- else:
- tbl = str.maketrans(' ', '-')
- configPostfix = configString.translate(tbl)
-
- # Output the configuration.
- if not configuration.parsable:
- sys.stderr.write("\nConfiguration: " + configString + "\n")
-
- #print("sys.stderr name is", sys.stderr.name)
- #print("sys.stdout name is", sys.stdout.name)
-
- # First, write out the number of collected test cases.
- if not configuration.parsable:
- sys.stderr.write(configuration.separator + "\n")
- sys.stderr.write(
- "Collected %d test%s\n\n" %
- (configuration.suite.countTestCases(),
- configuration.suite.countTestCases() != 1 and "s" or ""))
-
- if configuration.parsable:
- v = 0
- else:
- v = configuration.verbose
-
- # Invoke the test runner.
- if configuration.count == 1:
- result = unittest2.TextTestRunner(
- stream=sys.stderr,
- verbosity=v,
- resultclass=test_result.LLDBTestResult).run(
- configuration.suite)
- else:
- # We are invoking the same test suite more than once. In this case,
- # mark __ignore_singleton__ flag as True so the signleton pattern is
- # not enforced.
- test_result.LLDBTestResult.__ignore_singleton__ = True
- for i in range(configuration.count):
-
- result = unittest2.TextTestRunner(
- stream=sys.stderr,
- verbosity=v,
- resultclass=test_result.LLDBTestResult).run(
- configuration.suite)
-
- configuration.failed = configuration.failed or not result.wasSuccessful()
+ if configuration.parsable:
+ v = 0
+ else:
+ v = configuration.verbose
+
+ # Invoke the test runner.
+ if configuration.count == 1:
+ result = unittest2.TextTestRunner(
+ stream=sys.stderr,
+ verbosity=v,
+ resultclass=test_result.LLDBTestResult).run(
+ configuration.suite)
+ else:
+ # We are invoking the same test suite more than once. In this case,
+ # mark __ignore_singleton__ flag as True so the signleton pattern is
+ # not enforced.
+ test_result.LLDBTestResult.__ignore_singleton__ = True
+ for i in range(configuration.count):
+
+ result = unittest2.TextTestRunner(
+ stream=sys.stderr,
+ verbosity=v,
+ resultclass=test_result.LLDBTestResult).run(
+ configuration.suite)
+
+ configuration.failed = not result.wasSuccessful()
if configuration.sdir_has_content and not configuration.parsable:
sys.stderr.write(
OpenPOWER on IntegriCloud