Skip to content

Commit 34cda6a

Browse files
author
Greg Parker
committed
[test] Be more verbose about errors in test Interpreter/SDK/libc.swift.
We're trying to track down an intermittent failure. rdar://26960623
1 parent ea3d691 commit 34cda6a

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

test/Interpreter/SDK/libc.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,42 @@ let errFile =
3636
open(sourcePath, O_RDONLY | O_CREAT | O_EXCL)
3737
if errFile != -1 {
3838
print("O_CREAT|O_EXCL failed to return an error")
39-
} else {
40-
print("O_CREAT|O_EXCL returned errno *\(errno)*")
39+
} else {
40+
let e = errno
41+
print("O_CREAT|O_EXCL returned errno *\(e)*")
4142
}
4243

4344
// CHECK-NOT: error
4445
// CHECK: created mode *33216* *33216*
4546
let tempFile =
4647
open(tempPath, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IXUSR)
48+
if tempFile == -1 {
49+
let e = errno
50+
print("error: open(tempPath \(tempPath)) returned -1, errno \(e)")
51+
abort()
52+
}
4753
let written = write(tempFile, bytes, 11)
48-
assert(written == 11)
54+
if (written != 11) {
55+
print("error: write(tempFile) returned \(written), errno \(errno)")
56+
abort()
57+
}
4958

5059
var err: Int32
5160
var statbuf1 = stat()
5261
err = fstat(tempFile, &statbuf1)
53-
if err != 0 {
54-
print("error: fstat returned \(err), errno \(errno)")
62+
if err != 0 {
63+
let e = errno
64+
print("error: fstat returned \(err), errno \(e)")
5565
abort()
5666
}
5767

5868
close(tempFile)
5969

6070
var statbuf2 = stat()
6171
err = stat(tempPath, &statbuf2)
62-
if err != 0 {
63-
print("error: stat returned \(err), errno \(errno)")
72+
if err != 0 {
73+
let e = errno
74+
print("error: stat returned \(err), errno \(e)")
6475
abort()
6576
}
6677

0 commit comments

Comments
 (0)