count = 1
# The 'arch' and 'compiler' can be specified via command line.
-arch = None # Must be initialized after option parsing
-compiler = None # Must be initialized after option parsing
+arch = None
+compiler = None
+dsymutil = None
+sdkroot = None
# The overriden dwarf verison.
dwarf_version = 0
break
if args.dsymutil:
- os.environ['DSYMUTIL'] = args.dsymutil
+ configuration.dsymutil = args.dsymutil
elif platform_system == 'Darwin':
- os.environ['DSYMUTIL'] = seven.get_command_output(
+ configuration.dsymutil = seven.get_command_output(
'xcrun -find -toolchain default dsymutil')
if args.filecheck:
# Set SDKROOT if we are using an Apple SDK
if platform_system == 'Darwin' and args.apple_sdk:
- os.environ['SDKROOT'] = seven.get_command_output(
+ configuration.sdkroot = seven.get_command_output(
'xcrun --sdk "%s" --show-sdk-path 2> /dev/null' %
(args.apple_sdk))
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(
+ configuration.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(
+ if not os.path.exists(configuration.sdkroot):
+ configuration.sdkroot = seven.get_command_output(
'xcrun --sdk iphoneos --show-sdk-path 2> /dev/null')
else:
configuration.arch = platform_machine
# Set up the root build directory.
if not configuration.test_build_dir:
raise Exception("test_build_dir is not set")
- os.environ["LLDB_BUILD"] = os.path.abspath(configuration.test_build_dir)
+ configuration.test_build_dir = os.path.abspath(configuration.test_build_dir)
# Set up the LLDB_SRC environment variable, so that the tests can locate
# the LLDB source code.
# Set up the working directory.
# Note that it's not dotest's job to clean this directory.
- build_dir = configuration.test_build_dir
- lldbutil.mkdir_p(build_dir)
+ lldbutil.mkdir_p(configuration.test_build_dir)
target_platform = lldb.selected_platform.GetTriple().split('-')[2]
def getBuildDir(self):
"""Return the full path to the current test."""
- return os.path.join(os.environ["LLDB_BUILD"], self.mydir,
+ return os.path.join(configuration.test_build_dir, self.mydir,
self.getBuildDirBasename())
def getReproducerDir(self):
def makeBuildDir(self):
"""Create the test-specific working directory, deleting any previous
contents."""
- # See also dotest.py which sets up ${LLDB_BUILD}.
bdir = self.getBuildDir()
if os.path.isdir(bdir):
shutil.rmtree(bdir)
# Construct the base make invocation.
lldb_test = os.environ["LLDB_TEST"]
lldb_test_src = os.environ["LLDB_TEST_SRC"]
- lldb_build = os.environ["LLDB_BUILD"]
- if not (lldb_test and lldb_test_src and lldb_build and test_subdir and
+ if not (lldb_test and lldb_test_src 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(lldb_build, test_subdir, test_name)
+ build_dir = os.path.join(configuration.test_build_dir, test_subdir, test_name)
src_dir = os.path.join(lldb_test_src, test_subdir)
# This is a bit of a hack to make inline testcases work.
makefile = os.path.join(src_dir, "Makefile")
Helper function to return the key-value string to specify the dsymutil
used for the make system.
"""
- if "DSYMUTIL" in os.environ:
- return "DSYMUTIL={}".format(os.environ["DSYMUTIL"])
- return "";
+ if configuration.dsymutil:
+ return "DSYMUTIL={}".format(configuration.dsymutil)
+ return ""
def getSDKRootSpec():
"""
Helper function to return the key-value string to specify the SDK root
used for the make system.
"""
- if "SDKROOT" in os.environ:
- return "SDKROOT={}".format(os.environ["SDKROOT"])
- return "";
+ if configuration.sdkroot:
+ return "SDKROOT={}".format(configuration.sdkroot)
+ return ""
def getModuleCacheSpec():
"""
if configuration.clang_module_cache_dir:
return "CLANG_MODULE_CACHE_DIR={}".format(
configuration.clang_module_cache_dir)
- return "";
+ return ""
def getCmdLine(d):
"""