Skip to content

Commit 1d075ad

Browse files
committed
Add execution test for #dsohandle: multiple images
There wasn't an execution test involving #dsohandle, so add one here. Also, the DSO handle coming from different modules should never be the same. rdar://problem/26565092
1 parent 3c11665 commit 1d075ad

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public func getFirstDSOHandle() -> UnsafeRawPointer {
2+
return #dsohandle
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public func getSecondDSOHandle() -> UnsafeRawPointer {
2+
return #dsohandle
3+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: rm -rf %t && mkdir %t
2+
3+
// RUN: (cd %t && %target-build-swift %S/Inputs/dsohandle-first.swift -emit-library -emit-module -module-name first)
4+
// RUN: (cd %t && %target-build-swift %S/Inputs/dsohandle-second.swift -emit-library -emit-module -module-name second)
5+
// RUN: %target-build-swift -I %t -L %t -lfirst -lsecond %s -o %t/main
6+
// RUN: env LD_LIBRARY_PATH=%t DYLD_LIBRARY_PATH=%t %target-run %t/main
7+
// REQUIRES: executable_test
8+
9+
import first
10+
import second
11+
12+
import StdlibUnittest
13+
14+
let DSOHandleTests = TestSuite("DSOHandle")
15+
16+
DSOHandleTests.test("Unique handles for different images") {
17+
let firstHandle = getFirstDSOHandle()
18+
let secondHandle = getSecondDSOHandle()
19+
expectNotEqual(firstHandle, secondHandle)
20+
}
21+
22+
runAllTests()

0 commit comments

Comments
 (0)