Skip to content

Commit f65be24

Browse files
committed
[Tests] Create a dylib by hand instead of depending on SwiftPM
This removes the dependency on dylib being created by swift build invocation.
1 parent 468780f commit f65be24

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Tests/FunctionalTests/MiscellaneousTests.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,18 @@ class MiscellaneousTestCase: XCTestCase {
413413

414414
func testPkgConfigClangModules() throws {
415415
fixture(name: "Miscellaneous/PkgConfig") { prefix in
416-
_ = try executeSwiftBuild(prefix.appending(component: "SystemModule"))
417-
XCTAssertFileExists(prefix.appending(components: "SystemModule", ".build", "debug", "libSystemModule.\(Product.dynamicLibraryExtension)"))
416+
let systemModule = prefix.appending(component: "SystemModule")
417+
// Create a shared library.
418+
let input = systemModule.appending(components: "Sources", "SystemModule.c")
419+
let output = systemModule.appending(component: "libSystemModule.\(Product.dynamicLibraryExtension)")
420+
try systemQuietly(["clang", "-shared", input.asString, "-o", output.asString])
418421

419422
let pcFile = prefix.appending(component: "libSystemModule.pc")
420423

421424
let stream = BufferedOutputByteStream()
422-
stream <<< "prefix=\(prefix.appending(component: "SystemModule").asString)\n"
425+
stream <<< "prefix=\(systemModule.asString)\n"
423426
stream <<< "exec_prefix=${prefix}\n"
424-
stream <<< "libdir=${exec_prefix}/.build/debug\n"
427+
stream <<< "libdir=${exec_prefix}\n"
425428
stream <<< "includedir=${prefix}/Sources/include\n"
426429
stream <<< "Name: SystemModule\n"
427430
stream <<< "URL: http://127.0.0.1/\n"

Tests/XcodeprojTests/FunctionalTests.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ class FunctionalTests: XCTestCase {
4949
func testXcodeProjWithPkgConfig() {
5050
#if os(macOS)
5151
fixture(name: "Miscellaneous/PkgConfig") { prefix in
52-
XCTAssertBuilds(prefix.appending(component: "SystemModule"))
53-
XCTAssertFileExists(prefix.appending(components: "SystemModule", ".build", "debug", "libSystemModule.\(Product.dynamicLibraryExtension)"))
52+
let systemModule = prefix.appending(component: "SystemModule")
53+
// Create a shared library.
54+
let input = systemModule.appending(components: "Sources", "SystemModule.c")
55+
let output = systemModule.appending(component: "libSystemModule.\(Product.dynamicLibraryExtension)")
56+
try systemQuietly(["clang", "-shared", input.asString, "-o", output.asString])
57+
5458
let pcFile = prefix.appending(component: "libSystemModule.pc")
5559
try! write(path: pcFile) { stream in
5660
stream <<< "prefix=\(prefix.appending(component: "SystemModule").asString)\n"
5761
stream <<< "exec_prefix=${prefix}\n"
58-
stream <<< "libdir=${exec_prefix}/.build/debug\n"
62+
stream <<< "libdir=${exec_prefix}\n"
5963
stream <<< "includedir=${prefix}/Sources/include\n"
6064

6165
stream <<< "Name: SystemModule\n"

0 commit comments

Comments
 (0)