summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/ErrnoTest.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-06-22 14:18:55 +0000
committerPavel Labath <labath@google.com>2017-06-22 14:18:55 +0000
commitefd57a8aeceda4191348c15fb95502f496ea6a00 (patch)
tree2324fee864dba7f3df2b6ece7216c9a51e05a635 /llvm/unittests/Support/ErrnoTest.cpp
parent69ffba4595590d95c2aee360f36db4742b2c606c (diff)
downloadbcm5719-llvm-efd57a8aeceda4191348c15fb95502f496ea6a00.tar.gz
bcm5719-llvm-efd57a8aeceda4191348c15fb95502f496ea6a00.zip
Revert "[Support] Add RetryAfterSignal helper function" and subsequent fix
The fix in r306003 uncovered a pretty fundamental problem that libc++ implementation of std::result_of does not handle the prototype of open(2) correctly (presumably because it contains ...). This makes the whole function unusable in its current form, so I am also reverting the original commit (r305892), which introduced the function, at least until I figure out a way to solve the libc++ issue. llvm-svn: 306005
Diffstat (limited to 'llvm/unittests/Support/ErrnoTest.cpp')
-rw-r--r--llvm/unittests/Support/ErrnoTest.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/llvm/unittests/Support/ErrnoTest.cpp b/llvm/unittests/Support/ErrnoTest.cpp
deleted file mode 100644
index 888c162822d..00000000000
--- a/llvm/unittests/Support/ErrnoTest.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-//===- ErrnoTest.cpp - Error handling unit tests --------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Errno.h"
-#include "gtest/gtest.h"
-
-using namespace llvm::sys;
-
-static int *ReturnPointer() { return new int(47); }
-
-TEST(ErrnoTest, RetryAfterSignal) {
- EXPECT_EQ(1, RetryAfterSignal(-1, [] { return 1; }));
-
- EXPECT_EQ(-1, RetryAfterSignal(-1, [] {
- errno = EAGAIN;
- return -1;
- }));
- EXPECT_EQ(EAGAIN, errno);
-
- unsigned calls = 0;
- EXPECT_EQ(1, RetryAfterSignal(-1, [&calls] {
- errno = EINTR;
- ++calls;
- return calls == 1 ? -1 : 1;
- }));
- EXPECT_EQ(2u, calls);
-
- EXPECT_EQ(1, RetryAfterSignal(-1, [](int x) { return x; }, 1));
-
- std::unique_ptr<int> P{RetryAfterSignal(nullptr, ReturnPointer)};
- EXPECT_EQ(47, *P);
-}
OpenPOWER on IntegriCloud