From 8cba0befb4b4151a8cde7c023ecbb786b47a8be3 Mon Sep 17 00:00:00 2001 From: Roger Ferrer Ibanez Date: Tue, 1 Nov 2016 08:11:12 +0000 Subject: [PATCH] Protect tests that expect an exception for an unknown std::random_device Skip these tests under libcpp-no-exceptions. Differential Revision: https://reviews.llvm.org/D26141 llvm-svn: 285677 --- libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp | 3 ++- libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp index 8c45bb19a0a6..ff9285b28dab 100644 --- a/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.device/ctor.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // // class random_device; @@ -44,11 +43,13 @@ void check_random_device_valid(const std::string &token) { } void check_random_device_invalid(const std::string &token) { +#ifndef TEST_HAS_NO_EXCEPTIONS try { std::random_device r(token); LIBCPP_ASSERT(false); } catch (const std::system_error&) { } +#endif } diff --git a/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp index eabcc201e068..6ecb04547e0c 100644 --- a/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp +++ b/libcxx/test/std/numerics/rand/rand.device/eval.pass.cpp @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: libcpp-no-exceptions // // class random_device; @@ -26,6 +25,7 @@ int main() std::random_device::result_type e = r(); } +#ifndef TEST_HAS_NO_EXCEPTIONS try { std::random_device r("/dev/null"); @@ -35,4 +35,5 @@ int main() catch (const std::system_error&) { } +#endif }