Skip to content

Commit 85aa648

Browse files
committed
Add an integration test for debugging swiftpm products
<rdar://problem/55668148>
1 parent 56fbe4f commit 85aa648

File tree

13 files changed

+52
-66
lines changed

13 files changed

+52
-66
lines changed

test-lldb-with-c-package/CFoo/Package.swift

Lines changed: 0 additions & 5 deletions
This file was deleted.

test-lldb-with-c-package/CFoo/foo.c

Lines changed: 0 additions & 5 deletions
This file was deleted.

test-lldb-with-c-package/CFoo/foo.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

test-lldb-with-c-package/CFoo/module.modulemap

Lines changed: 0 additions & 5 deletions
This file was deleted.

test-lldb-with-c-package/Foo/Package.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

test-lldb-with-c-package/Foo/main.swift

Lines changed: 0 additions & 3 deletions
This file was deleted.

test-lldb-with-c-package/test-xctest-package.txt

Lines changed: 0 additions & 39 deletions
This file was deleted.

test-lldb-with-swiftpm/Package.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// swift-tools-version:4.2
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "Foo",
6+
targets: [
7+
.target(name: "See"),
8+
.target(name: "Core", dependencies: ["See"]),
9+
.target(name: "exec", dependencies: ["Core"]),
10+
]
11+
)

test-lldb-with-swiftpm/README.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Check that we can debug a Swift package.
2+
//
3+
// Make a sandbox dir.
4+
// RUN: rm -rf %t.dir
5+
// RUN: mkdir -p %t.dir
6+
// RUN: cp -r %S/* %t.dir/
7+
//
8+
// Check the build log.
9+
// RUN: %{swift-build} --package-path %t.dir 2>&1 | tee %t.build-log
10+
//
11+
// Verify that the build worked.
12+
// RUN: test -x %t.dir/.build/debug/exec
13+
//
14+
// RUN: %t.dir/.build/debug/exec > %t.out
15+
// RUN: %{FileCheck} --check-prefix CHECK-APP-OUTPUT --input-file %t.out %s
16+
// CHECK-APP-OUTPUT: 10
17+
// CHECK-APP-OUTPUT-NEXT: OK
18+
//
19+
// Try debugging the application.
20+
// RUN: %{lldb} %t.dir/.build/debug/exec -o "b core.swift:5" -o r -o "po value" -b &> %t.lldb
21+
// RUN: %{FileCheck} --check-prefix CHECK-LLDB-LOG --input-file %t.lldb %s
22+
// CHECK-LLDB-LOG: (lldb) po value
23+
// CHECK-LLDB-LOG-NEXT: 5
24+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import See
2+
3+
public func core() -> Int {
4+
var value = Int(see())
5+
value = value * 2
6+
return value
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int see();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "see.h"
2+
3+
int see() {
4+
return 5;
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Core
2+
3+
print(core())
4+
print("OK")

0 commit comments

Comments
 (0)