Skip to content

Commit 42b2d8b

Browse files
authored
Merge pull request #3107 from colemancda/master
2 parents bafbbfc + 9230864 commit 42b2d8b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %target-run-simple-swift
2+
// REQUIRES: executable_test
3+
4+
// REQUIRES: OS=linux-gnu
5+
6+
import StdlibUnittest
7+
import CUUID
8+
9+
/// Make sure that the module map for the uuid.h header works
10+
var CUUIDTestSuite = TestSuite("CUUID")
11+
12+
/// Generates a random UUID
13+
CUUIDTestSuite.test("uuid") {
14+
var uuid: uuid_t = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
15+
withUnsafeMutablePointer(&uuid) {
16+
uuid_generate_random(unsafeBitCast($0, to: UnsafeMutablePointer<UInt8>.self))
17+
}
18+
}
19+
20+
runAllTests()

0 commit comments

Comments
 (0)