@@ -35,22 +35,22 @@ import TSCBasic
35
35
///
36
36
final class IncrementalBuildTests : XCTestCase {
37
37
38
- func testIncrementalSingleModuleCLibraryInSources( ) {
39
- fixture ( name: " CFamilyTargets/CLibrarySources " ) { prefix in
38
+ func testIncrementalSingleModuleCLibraryInSources( ) throws {
39
+ try fixture ( name: " CFamilyTargets/CLibrarySources " ) { fixturePath in
40
40
// Build it once and capture the log (this will be a full build).
41
- let ( fullLog, _) = try executeSwiftBuild ( prefix )
41
+ let ( fullLog, _) = try executeSwiftBuild ( fixturePath )
42
42
43
43
// Check various things that we expect to see in the full build log.
44
44
// FIXME: This is specific to the format of the log output, which
45
45
// is quite unfortunate but not easily avoidable at the moment.
46
46
XCTAssertMatch ( fullLog, . contains( " Compiling CLibrarySources Foo.c " ) )
47
47
48
- let llbuildManifest = prefix . appending ( components: " .build " , " debug.yaml " )
48
+ let llbuildManifest = fixturePath . appending ( components: " .build " , " debug.yaml " )
49
49
50
50
// Modify the source file in a way that changes its size so that the low-level
51
51
// build system can detect the change (the timestamp change might be too small
52
52
// for the granularity of the file system to represent as distinct values).
53
- let sourceFile = prefix . appending ( components: " Sources " , " Foo.c " )
53
+ let sourceFile = fixturePath . appending ( components: " Sources " , " Foo.c " )
54
54
let sourceStream = BufferedOutputByteStream ( )
55
55
sourceStream <<< ( try localFileSystem. readFileContents ( sourceFile) ) <<< " \n "
56
56
try localFileSystem. writeFileContents ( sourceFile, bytes: sourceStream. bytes)
@@ -59,15 +59,15 @@ final class IncrementalBuildTests: XCTestCase {
59
59
let llbuildContents1 : String = try localFileSystem. readFileContents ( llbuildManifest)
60
60
61
61
// Now build again. This should be an incremental build.
62
- let ( log2, _) = try executeSwiftBuild ( prefix )
62
+ let ( log2, _) = try executeSwiftBuild ( fixturePath )
63
63
XCTAssertMatch ( log2, . contains( " Compiling CLibrarySources Foo.c " ) )
64
64
65
65
// Read the second llbuild manifest.
66
66
let llbuildContents2 : String = try localFileSystem. readFileContents ( llbuildManifest)
67
67
68
68
// Now build again without changing anything. This should be a null
69
69
// build.
70
- let ( log3, _) = try executeSwiftBuild ( prefix )
70
+ let ( log3, _) = try executeSwiftBuild ( fixturePath )
71
71
XCTAssertNoMatch ( log3, . contains( " Compiling CLibrarySources Foo.c " ) )
72
72
73
73
// Read the third llbuild manifest.
@@ -79,22 +79,22 @@ final class IncrementalBuildTests: XCTestCase {
79
79
// Modify the header file in a way that changes its size so that the low-level
80
80
// build system can detect the change (the timestamp change might be too small
81
81
// for the granularity of the file system to represent as distinct values).
82
- let headerFile = prefix . appending ( components: " Sources " , " include " , " Foo.h " )
82
+ let headerFile = fixturePath . appending ( components: " Sources " , " include " , " Foo.h " )
83
83
let headerStream = BufferedOutputByteStream ( )
84
84
headerStream <<< ( try localFileSystem. readFileContents ( headerFile) ) <<< " \n "
85
85
try localFileSystem. writeFileContents ( headerFile, bytes: headerStream. bytes)
86
86
87
87
// Now build again. This should be an incremental build.
88
- let ( log4, _) = try executeSwiftBuild ( prefix )
88
+ let ( log4, _) = try executeSwiftBuild ( fixturePath )
89
89
XCTAssertMatch ( log4, . contains( " Compiling CLibrarySources Foo.c " ) )
90
90
}
91
91
}
92
92
93
- func testBuildManifestCaching( ) {
94
- fixture ( name: " ValidLayouts/SingleModule/Library " ) { prefix in
93
+ func testBuildManifestCaching( ) throws {
94
+ try fixture ( name: " ValidLayouts/SingleModule/Library " ) { fixturePath in
95
95
@discardableResult
96
96
func build( ) throws -> String {
97
- return try executeSwiftBuild ( prefix ) . stdout
97
+ return try executeSwiftBuild ( fixturePath ) . stdout
98
98
}
99
99
100
100
// Perform a full build.
@@ -110,7 +110,7 @@ final class IncrementalBuildTests: XCTestCase {
110
110
XCTAssertNoMatch ( log3, . contains( " Planning build " ) )
111
111
112
112
// Check that we do run planning when a new source file is added.
113
- let sourceFile = prefix . appending ( components: " Sources " , " Library " , " new.swift " )
113
+ let sourceFile = fixturePath . appending ( components: " Sources " , " Library " , " new.swift " )
114
114
try localFileSystem. writeFileContents ( sourceFile, bytes: " " )
115
115
let log4 = try build ( )
116
116
XCTAssertMatch ( log4, . contains( " Compiling Library " ) )
@@ -123,11 +123,11 @@ final class IncrementalBuildTests: XCTestCase {
123
123
}
124
124
}
125
125
126
- func testDisableBuildManifestCaching( ) {
127
- fixture ( name: " ValidLayouts/SingleModule/Library " ) { prefix in
126
+ func testDisableBuildManifestCaching( ) throws {
127
+ try fixture ( name: " ValidLayouts/SingleModule/Library " ) { fixturePath in
128
128
@discardableResult
129
129
func build( ) throws -> String {
130
- return try executeSwiftBuild ( prefix , extraArgs: [ " --disable-build-manifest-caching " ] ) . stdout
130
+ return try executeSwiftBuild ( fixturePath , extraArgs: [ " --disable-build-manifest-caching " ] ) . stdout
131
131
}
132
132
133
133
// Perform a full build.
0 commit comments