Skip to content

Commit 7574270

Browse files
Merge pull request #10470 from adrian-prantl/openresilientfunctest-6.1
[lldb] Add a test for calling open resilient functions in expressions
2 parents d734f30 + 788e6fe commit 7574270

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
open class A {
2+
public init() {}
3+
open func foo() -> Int { return 23 }
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SWIFT_SOURCES := main.swift
2+
SWIFTFLAGS_EXTRAS := -I.
3+
LD_EXTRAS = -lLibrary -L$(BUILDDIR)
4+
all: libLibrary.dylib a.out
5+
6+
lib%.dylib: %.swift
7+
"$(MAKE)" MAKE_DSYM=NO DYLIB_ONLY=YES \
8+
DYLIB_HIDE_SWIFTMODULE=YES \
9+
DYLIB_NAME=$(shell basename $< .swift) \
10+
DYLIB_SWIFT_SOURCES=$(shell basename $<) \
11+
SWIFTFLAGS_EXTRAS=-enable-library-evolution \
12+
VPATH=$(SRCDIR) -I $(SRCDIR) -f $(MAKEFILE_RULES) all
13+
14+
include Makefile.rules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
class TestExpressionOpenResilientClass(TestBase):
7+
NO_DEBUG_INFO_TEST = True
8+
@swiftTest
9+
def test(self):
10+
"""Tests calling an open resilient function"""
11+
self.build()
12+
lldbutil.run_to_source_breakpoint(
13+
self, 'break here', lldb.SBFileSpec('main.swift'),
14+
extra_images=['Library'])
15+
16+
self.expect("expr -- a.foo()", substrs=["23"])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Library
2+
3+
func f() {
4+
let a = A()
5+
print("break here \(a)")
6+
}
7+
8+
f()

0 commit comments

Comments
 (0)