def is_swift_compiler_with_thread_sanitizer(self): swiftcc = swift.getSwiftCompiler() f = tempfile.NamedTemporaryFile() cmd = "echo 'print(1)' | %s -o %s -" % (swiftcc, f.name) if os.popen(cmd).close() is not None: return None # The compiler cannot compile at all, let's *not* skip the test cmd = "echo 'print(1)' | %s -sanitize=thread -o %s -" % (swiftcc, f.name) if os.popen(cmd).close() is not None: return "Compiler cannot compile with -sanitize=thread" return None
def is_swift_compiler_with_thread_sanitizer(self): if is_running_under_asan(): return "Thread sanitizer tests are disabled when runing under ASAN" swiftc = swift.getSwiftCompiler() f = tempfile.NamedTemporaryFile() cmd = "echo 'print(1)' | %s -o %s -" % (swiftc, f.name) if os.popen(cmd).close() is not None: return None # The compiler cannot compile at all, let's *not* skip the test cmd = "echo 'print(1)' | %s -sanitize=thread -o %s -" % (swiftc, f.name) if os.popen(cmd).close() is not None: return "Compiler cannot compile with -sanitize=thread" return None
def test_simple(self): if configuration.swiftCompiler: compiler = configuration.swiftCompiler else: compiler = swift.getSwiftCompiler() version = self.getCompilerVersion(compiler) if version < '5.0': self.skipTest('Swift compiler predates stable ABI') self.build() lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec('main.swift')) # FIXME: Removing the next line breaks subsequent expressions # when the swiftmodules can't be loaded. self.expect("fr v") self.expect("fr v number", substrs=['23']) self.expect("fr v array", substrs=['1', '2', '3']) self.expect("fr v string", substrs=['"hello"']) self.expect("fr v tuple", substrs=['42', '"abc"'])
def getCCSpec(compiler): """ Helper function to return the key-value string to specify the compiler used for the make system. """ lldbLib = os.environ["LLDB_LIB_DIR"] if "LLDB_LIB_DIR" in os.environ else None cc = compiler if compiler else None if not cc and "CC" in os.environ: cc = os.environ["CC"] swiftcc = swift.getSwiftCompiler() # Note the leading space character. if cc: if swiftcc: return (" CC=" + cc + " SWIFTCC=" + swiftcc ) else: return "CC=\"%s\"" % cc return ""
def getCCSpec(compiler): """ Helper function to return the key-value string to specify the compiler used for the make system. """ lldbLib = os.environ["LLDB_LIB_DIR"] if "LLDB_LIB_DIR" in os.environ else None cc = compiler if compiler else None if not cc and "CC" in os.environ: cc = os.environ["CC"] swiftcc = swift.getSwiftCompiler() # Note the leading space character. if cc: if swiftcc: return (" CC=" + cc + " SWIFTCC=" + swiftcc + " SWIFTLIBS=\"" + swift.getSwiftLibraryPath() + "\" SWIFTSDKROOT=\"" + swift.getSwiftSDKRoot() + "\"") else: return "CC=\"{0!s}\"".format(cc) return ""
def getCCSpec(compiler): """ Helper function to return the key-value string to specify the compiler used for the make system. """ lldbLib = os.environ[ "LLDB_LIB_DIR"] if "LLDB_LIB_DIR" in os.environ else None cc = compiler if compiler else None if not cc and "CC" in os.environ: cc = os.environ["CC"] swiftcc = swift.getSwiftCompiler() # Note the leading space character. if cc: if swiftcc: return (" CC=" + cc + " SWIFTCC=" + swiftcc + " SWIFTLIBS=\"" + swift.getSwiftLibraryPath() + "\" SWIFTSDKROOT=\"" + swift.getSwiftSDKRoot() + "\"") else: return "CC=\"{0!s}\"".format(cc) return ""
# This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt for license information # See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors # # ------------------------------------------------------------------------------ import argparse import os import sys import commands sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'plugins')) import swift parser = argparse.ArgumentParser() parser.add_argument('-l', action='store_true') parser.add_argument('-s', action='store_true') args = parser.parse_args() if (args.l): print swift.getSwiftLibraryPath() elif (args.s): print swift.getSwiftSDKRoot() else: print swift.getSwiftCompiler()