Skip to content

Commit ff33f3b

Browse files
committed
Added CUUID to Glibc
Necessary for SR-1756 and SE-0069
1 parent 252d437 commit ff33f3b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

stdlib/public/Platform/glibc.modulemap.gyb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,9 @@ module SwiftGlibc [system] {
391391
}
392392
}
393393
}
394+
395+
module CUUID [system] {
396+
header "${GLIBC_INCLUDE_PATH}/uuid/uuid.h"
397+
link "uuid"
398+
export *
399+
}

validation-test/stdlib/CUUID.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-run-stdlib-swift
2+
// REQUIRES: executable_test
3+
4+
// REQUIRES: OS=linux-gnu
5+
6+
import Swift
7+
import StdlibUnittest
8+
9+
10+
import CUUID
11+
12+
var CUUIDTestSuite = TestSuite("CUUID")
13+
14+
CUUIDTestSuite.test("uuid") {
15+
var uuid: uuid_t = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
16+
withUnsafeMutablePointer(&uuid) {
17+
uuid_generate_random(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self))
18+
}
19+
}
20+
21+
runAllTests()

0 commit comments

Comments
 (0)