Skip to content

Commit e94ab93

Browse files
authored
Merge pull request #174 from owenv/owenv/swiftbuild
Test updates for SwiftPM --build-system swiftbuild
2 parents 8c438f0 + 5edfc8a commit e94ab93

12 files changed

Lines changed: 28 additions & 26 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*~
22
*.pyc
3-
3+
.DS_Store

swift-build.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
//
1717
// Verify that the tool exists and works.
1818
//
19-
// RUN: test -x %t.dir/tool/.build/debug/tool
20-
// RUN: %t.dir/tool/.build/debug/tool > %t.out
19+
// RUN: %{swift-build} --package-path %t.dir/tool --show-bin-path > %t.bin-path
20+
// RUN: sed 's|$|/tool|' %t.bin-path | xargs test -x
21+
// RUN: sed 's|$|/tool|' %t.bin-path | xargs sh -c '"$1" > %t.out' --
2122
// RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
2223
//
2324
// CHECK-TOOL-OUTPUT: HI

swift-package-init-exec.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
1818
```
1919

2020
```
21-
CHECK-BUILD-LOG: Compiling {{.*}}Project{{.*}}
22-
CHECK-BUILD-LOG: Linking {{.*}}Project
21+
CHECK-BUILD-LOG: Build complete!
2322
```
2423

2524
## Verify that the tool was built and works.
2625

2726
```
28-
RUN: test -x %t.dir/Project/.build/debug/Project
29-
RUN: %t.dir/Project/.build/debug/Project > %t.out
27+
RUN: %{swift-build} --package-path %t.dir/Project --show-bin-path > %t.bin-path
28+
RUN: sed 's|$|/Project|' %t.bin-path | xargs test -x
29+
RUN: sed 's|$|/Project|' %t.bin-path | xargs sh -c '"$1" > %t.out' --
3030
RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
3131
```
3232

swift-package-init-lib.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
1919
```
2020

2121
```
22-
CHECK-BUILD-LOG: Compiling {{.*}}Project{{.*}}
22+
CHECK-BUILD-LOG: Build complete!
2323
```
2424

2525
## Check the XCTest log.
@@ -29,7 +29,7 @@ RUN: %{FileCheck} --check-prefix CHECK-XCTEST-LOG --input-file %t.xctest-log %s
2929
```
3030

3131
```
32-
CHECK-XCTEST-LOG: Compiling {{.*}}ProjectTests{{.*}}
32+
CHECK-XCTEST-LOG: Build complete!
3333
CHECK-XCTEST-LOG: Test Suite 'All tests' passed
3434
CHECK-XCTEST-LOG-NEXT: Executed 1 test
3535
```

swift-package-with-spaces.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
//
1414
// RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
1515
//
16-
// CHECK-BUILD-LOG: swiftc{{.*}} -module-name special_tool {{.*}} '@{{.*}}/.build/{{[^/]+}}/debug/special_tool.build/sources'
16+
// CHECK-BUILD-LOG: -module-name special_tool
1717
//
1818
// Verify that the tool exists and works.
1919
//
20-
// RUN: test -x %t.dir/more\ spaces/special\ tool/.build/debug/special\ tool
21-
// RUN: %t.dir/more\ spaces/special\ tool/.build/debug/special\ tool > %t.out
20+
// RUN: %{swift-build} --package-path %t.dir/more\ spaces/special\ tool --show-bin-path > %t.bin-path
21+
// RUN: sed 's|.*|"&/special tool"|' %t.bin-path | xargs test -x
22+
// RUN: sed 's|.*|"&/special tool"|' %t.bin-path | xargs sh -c '"$1" > %t.out' --
2223
// RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
2324
//
2425
// CHECK-TOOL-OUTPUT: HI

swift-run.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.run-log %s
1818
```
1919

2020
```
21-
CHECK-BUILD-LOG: Compiling {{.*}}secho{{.*}}
22-
CHECK-BUILD-LOG: Linking {{.*}}secho
21+
CHECK-BUILD-LOG: Build {{.*}}complete!
2322
CHECK-BUILD-LOG: 1 two
2423
```

test-codecov-package/test-codecov-package.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515
// Check the exported codecov file.
1616
//
17-
// RUN: %{FileCheck} --check-prefix CHECK-CODECOV-JSON --input-file %t.dir/foo/.build/debug/codecov/foo.json %s
17+
// RUN: %{swift} test --package-path %t.dir/foo --show-codecov-path > %t.codecov-path
18+
// RUN: sed 's|^|--input-file |' %t.codecov-path | xargs %{FileCheck} --check-prefix CHECK-CODECOV-JSON %s
1819
//
1920
// CHECK-CODECOV-JSON: llvm.coverage.json.export

test-complex-xctest-package/test-xctest-package.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@
1010
//
1111
// RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
1212
//
13-
// CHECK-BUILD-LOG: swiftc{{.*}} -module-name SwiftCMixedPackageTests
1413
// CHECK-BUILD-LOG: testSwiftyFoo{{.*}} passed
1514
// CHECK-BUILD-LOG: 'SwiftyTests' passed

test-foundation-package/test-foundation-package.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
//
1717
// Verify that the tool exists and works.
1818
//
19-
// RUN: test -x %t.dir/tool/.build/debug/tool
20-
// RUN: %t.dir/tool/.build/debug/tool > %t.out
19+
// RUN: %{swift-build} --package-path %t.dir/tool --show-bin-path > %t.bin-path
20+
// RUN: sed 's|$|/tool|' %t.bin-path | xargs test -x
21+
// RUN: sed 's|$|/tool|' %t.bin-path | xargs sh -c '"$1" > %t.out' --
2122
// RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
2223
//
2324
// CHECK-TOOL-OUTPUT: Printing URL

test-snapshot-binaries/test-rpath-linux.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
# RUN: %{readelf} -d %{package_path}/usr/lib/liblldb.so | %{FileCheck} --check-prefix CHECK-LLDB %s
4141
# CHECK-LLDB: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}$ORIGIN/../lib/swift/linux
4242
#
43-
# RUN: find %{package_path} -name "lib*\.so" | xargs %{readelf} -d | %{FileCheck} --check-prefix CHECK-LIB %s
43+
# RUN: sh -c 'find %{package_path} -name "lib*\.so" | while read f; do %{readelf} -d "$f" 2>/dev/null | sed "s|^|$f: |"; done' | %{FileCheck} --check-prefix CHECK-LIB %s
4444
# CHECK-LIB-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}/home/
4545
# CHECK-LIB-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}/opt/
4646
#
47-
# RUN: find %{package_path}/usr/bin -type f | grep -Ev "\.py|\.txt|\.sh|\.cfg" | xargs %{readelf} -d | %{FileCheck} --check-prefix CHECK-BIN %s
47+
# RUN: sh -c 'find %{package_path}/usr/bin -type f | grep -Ev "\.py|\.txt|\.sh|\.cfg" | while read f; do %{readelf} -d "$f" 2>/dev/null | sed "s|^|$f: |"; done' | %{FileCheck} --check-prefix CHECK-BIN %s
4848
# CHECK-BIN-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}/home/
4949
# CHECK-BIN-NOT: {{.*}} {{\(RPATH\)|\(RUNPATH\)}} {{.*}}/opt/

0 commit comments

Comments
 (0)