diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 7cd1cc9dd19ff..4013994d84430 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -833,10 +833,12 @@ endif $(DYLIB_FILENAME) : $(DYLIB_OBJECTS) @echo "### Linking dynamic library $(DYLIB_NAME)" ifneq "$(EXCLUDE_WRAPPED_SWIFTMODULE)" "" - $(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) -emit-library $(DYLIB_SWIFT_FLAGS) -o $@ \ + $(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) -toolchain-stdlib-rpath \ + -emit-library $(DYLIB_SWIFT_FLAGS) -o $@ \ $(patsubst %.swiftmodule.o,,$^) else - $(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) -emit-library $(DYLIB_SWIFT_FLAGS) -o $@ $^ + $(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) -toolchain-stdlib-rpath \ + -emit-library $(DYLIB_SWIFT_FLAGS) -o $@ $^ endif ifneq "$(CODESIGN)" "" $(CODESIGN) -s - "$(DYLIB_FILENAME)" diff --git a/lldb/test/API/lang/swift/expression/objc_context/Makefile b/lldb/test/API/lang/swift/expression/objc_context/Makefile index 2611490ac76bb..d380b0da16102 100644 --- a/lldb/test/API/lang/swift/expression/objc_context/Makefile +++ b/lldb/test/API/lang/swift/expression/objc_context/Makefile @@ -1,15 +1,13 @@ -SWIFT_OBJC_INTEROP := 1 +OBJC_SOURCES := main.m +CFLAGS_EXTRAS = $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(BUILDDIR) +LD_EXTRAS = -lFoo -L$(BUILDDIR) # This test builds an Objective-C main program that imports two Swift # .dylibs with conflicting ClangImporter search paths. -include Makefile.rules +all: libFoo.dylib $(EXE) -a.out: main.m libFoo.dylib - $(CC) $(CFLAGS) $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(shell pwd) -lFoo -L$(shell pwd) -o $@ $< -ifneq "$(CODESIGN)" "" - $(CODESIGN) -s - "$@" -endif +include Makefile.rules lib%.dylib: %.swift $(MAKE) MAKE_DSYM=YES CC=$(CC) SWIFTC=$(SWIFTC) \ diff --git a/lldb/test/API/lang/swift/expression/objc_context/TestSwiftExpressionObjCContext.py b/lldb/test/API/lang/swift/expression/objc_context/TestSwiftExpressionObjCContext.py index bb44bc9b8075f..f59d9a6966c6f 100644 --- a/lldb/test/API/lang/swift/expression/objc_context/TestSwiftExpressionObjCContext.py +++ b/lldb/test/API/lang/swift/expression/objc_context/TestSwiftExpressionObjCContext.py @@ -16,7 +16,6 @@ import lldbsuite.test.lldbutil as lldbutil import os import unittest2 -import shutil class TestSwiftExpressionObjCContext(TestBase): @@ -29,20 +28,12 @@ def setUp(self): @swiftTest def test(self): self.build() - exe_name = "a.out" - exe = self.getBuildArtifact(exe_name) - - # Create the target - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) # Register shlib so it can run on-device. + target, _, _, _ = lldbutil.run_to_source_breakpoint( + self, "break here", lldb.SBFileSpec('main.m')) self.registerSharedLibrariesWithTarget(target, ['Foo']) - # Set the breakpoints - foo_breakpoint = target.BreakpointCreateBySourceRegex( - 'break here', lldb.SBFileSpec('main.m')) - process = target.LaunchSimple(None, None, os.getcwd()) # This is expected to fail because we can't yet import ObjC # modules into a Swift context. self.expect("expr -lang Swift -- Bar()", "failure", @@ -51,10 +42,4 @@ def test(self): self.expect("expr -lang Swift -- [1, 2, 3]", "context-less swift expression works", substrs=["([Int])"]) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lldb.SBDebugger.Terminate) - unittest2.main()