Skip to content

Commit 2cb812b

Browse files
committed
[lldb/test] Refine TestSwiftProgressReporting (NFC)
This patch simplifies the inferior for TestSwiftProgressReporting, by creating a variable using a type defined in an imported module. It also improve the test by making sure it receives each kind of expected swift progress events. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 8ec7e75 commit 2cb812b

File tree

4 files changed

+16
-44
lines changed

4 files changed

+16
-44
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public struct 👻 { public init() { print("boooooo!") } }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
SWIFT_SOURCES := main.swift
22

3+
LD_EXTRAS := -L. -linvisible
4+
SWIFTFLAGS_EXTRAS := -I.
5+
6+
all: libinvisible.dylib $(EXE)
7+
38
include Makefile.rules
9+
10+
libinvisible.dylib: Invisible.swift
11+
$(MAKE) -f $(MAKEFILE_RULES) \
12+
MAKE_DSYM=YES DYLIB_ONLY=YES DYLIB_NAME=Invisible \
13+
DYLIB_SWIFT_SOURCES="Invisible.swift" \
14+
SWIFTFLAGS_EXTRAS=-I$(BUILDDIR)

lldb/test/API/functionalities/progress_reporting/swift_progress_reporting/TestSwiftProgressReporting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TestSwiftProgressReporting(EventListenerTestBase):
1616
event_data_extractor = lldb.SBDebugger.GetProgressFromEvent
1717

1818
@swiftTest
19+
@skipIf(oslist=no_match(["macosx"]))
1920
def test_swift_progress_report(self):
2021
"""Test that we are able to fetch swift type-system progress events"""
2122
self.build()
@@ -28,7 +29,7 @@ def test_swift_progress_report(self):
2829
self.assertTrue(frame, "Invalid frame.")
2930

3031
# Resolve variable to exercise the type-system
31-
self.runCmd("expr numbers")
32+
self.runCmd("expr boo")
3233

3334
self.assertGreater(len(self.events), 0)
3435

lldb/test/API/functionalities/progress_reporting/swift_progress_reporting/main.swift

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,7 @@
1-
struct IntPair {
2-
var original: Int
3-
var opposite: Int
4-
5-
init(_ value: Int) {
6-
self.original = value
7-
self.opposite = -value
8-
}
9-
}
10-
11-
enum Toggle { case On; case Off }
12-
13-
enum ColorCode {
14-
case RGB(UInt8, UInt8, UInt8)
15-
case Hex(Int)
16-
}
17-
18-
protocol Flyable {
19-
var fly : String { get }
20-
}
21-
22-
struct Bird: Flyable {
23-
var fly: String = "🦅"
24-
}
25-
26-
struct Plane: Flyable {
27-
var fly: String = "🛩"
28-
}
29-
30-
class Number<T:Numeric> {
31-
var number_value : T
32-
33-
init (number value : T) {
34-
number_value = value
35-
}
36-
}
1+
import Invisible
372

383
func main() {
39-
let structArray = [ IntPair(1), IntPair(-2), IntPair(3) ]
40-
var enumArray = [ Toggle.Off ]
41-
var colors = [ColorCode.RGB(155,219,255), ColorCode.Hex(0x4545ff)]
42-
var flyingObjects : [Flyable] = [ Bird(), Plane() ]
43-
let numbers = [ Number(number: 42), Number(number: 3.14)]
44-
let bytes = [UInt8](0...255)
45-
var bits : [UInt8] = [0,1]
4+
let boo = Invisible.👻()
465
print("break here")
476
}
487

0 commit comments

Comments
 (0)