Skip to content

Add an integration test for debugging swiftpm products #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions test-lldb-with-c-package/CFoo/Package.swift

This file was deleted.

5 changes: 0 additions & 5 deletions test-lldb-with-c-package/CFoo/foo.c

This file was deleted.

1 change: 0 additions & 1 deletion test-lldb-with-c-package/CFoo/foo.h

This file was deleted.

5 changes: 0 additions & 5 deletions test-lldb-with-c-package/CFoo/module.modulemap

This file was deleted.

8 changes: 0 additions & 8 deletions test-lldb-with-c-package/Foo/Package.swift

This file was deleted.

3 changes: 0 additions & 3 deletions test-lldb-with-c-package/Foo/main.swift

This file was deleted.

39 changes: 0 additions & 39 deletions test-lldb-with-c-package/test-xctest-package.txt

This file was deleted.

11 changes: 11 additions & 0 deletions test-lldb-with-swiftpm/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// swift-tools-version:4.2
import PackageDescription

let package = Package(
name: "Foo",
targets: [
.target(name: "See"),
.target(name: "Core", dependencies: ["See"]),
.target(name: "exec", dependencies: ["Core"]),
]
)
24 changes: 24 additions & 0 deletions test-lldb-with-swiftpm/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Check that we can debug a Swift package.
//
// Make a sandbox dir.
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir
// RUN: cp -r %S/* %t.dir/
//
// Check the build log.
// RUN: %{swift-build} --package-path %t.dir 2>&1 | tee %t.build-log
//
// Verify that the build worked.
// RUN: test -x %t.dir/.build/debug/exec
//
// RUN: %t.dir/.build/debug/exec > %t.out
// RUN: %{FileCheck} --check-prefix CHECK-APP-OUTPUT --input-file %t.out %s
// CHECK-APP-OUTPUT: 10
// CHECK-APP-OUTPUT-NEXT: OK
//
// Try debugging the application.
// RUN: %{lldb} %t.dir/.build/debug/exec -o "b core.swift:5" -o r -o "po value" -b &> %t.lldb
// RUN: %{FileCheck} --check-prefix CHECK-LLDB-LOG --input-file %t.lldb %s
// CHECK-LLDB-LOG: (lldb) po value
// CHECK-LLDB-LOG-NEXT: 5

7 changes: 7 additions & 0 deletions test-lldb-with-swiftpm/Sources/Core/core.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import See

public func core() -> Int {
var value = Int(see())
value = value * 2
return value
}
1 change: 1 addition & 0 deletions test-lldb-with-swiftpm/Sources/See/include/see.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int see();
5 changes: 5 additions & 0 deletions test-lldb-with-swiftpm/Sources/See/see.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "see.h"

int see() {
return 5;
}
4 changes: 4 additions & 0 deletions test-lldb-with-swiftpm/Sources/exec/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Core

print(core())
print("OK")