[PATCH] D27252: Protect sequences test under libcpp-no-exceptions

2016-12-01 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288383: Protect sequences test under libcpp-no-exceptions 
(authored by rogfer01).

Changed prior to commit:
  https://reviews.llvm.org/D27252?vs=79717=79934#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27252

Files:
  
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp


Index: 
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
===
--- 
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ 
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -7,7 +7,6 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // iterator insert(const_iterator position, size_type n, const value_type& x);
@@ -20,6 +19,7 @@
 
 #include "min_allocator.h"
 #include "count_new.hpp"
+#include "test_macros.h"
 
 template 
 void test() {
@@ -29,6 +29,7 @@
 typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
 assert(i == next(l1.begin()));
 assert(l1 == List(a2, a2+8));
+#ifndef TEST_HAS_NO_EXCEPTIONS
 globalMemCounter.throw_after = 4;
 int save_count = globalMemCounter.outstanding_new;
 try
@@ -41,6 +42,7 @@
 }
 assert(globalMemCounter.checkOutstandingNewEq(save_count));
 assert(l1 == List(a2, a2+8));
+#endif
 }
 
 int main()
Index: 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
===
--- 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ 
libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -7,19 +7,18 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // void push_back(const value_type& x);
 
 #include 
 #include 
 
 #include "asan_testing.h"
+#include "test_macros.h"
 
 // Flag that makes the copy constructor for CMyClass throw an exception
-static bool gCopyConstructorShouldThow = false;
-
+static bool gCopyConstructorShouldThrow = false;
 
 class CMyClass {
 public: CMyClass(int tag);
@@ -52,8 +51,8 @@
 fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
 {
 // If requested, throw an exception _before_ setting fMagicValue to 
kFinishedConstructionMagicValue
-if (gCopyConstructorShouldThow) {
-throw std::exception();
+if (gCopyConstructorShouldThrow) {
+TEST_THROW(std::exception());
 }
 // Signal that the constructor has finished running
 fMagicValue = kFinishedConstructionMagicValue;
@@ -76,12 +75,15 @@
 assert(is_contiguous_container_asan_correct(vec));
 assert(is_contiguous_container_asan_correct(vec2));
 
-gCopyConstructorShouldThow = true;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+gCopyConstructorShouldThrow = true;
 try {
 vec.push_back(instance);
+assert(false);
 }
 catch (...) {
 assert(vec==vec2);
 assert(is_contiguous_container_asan_correct(vec));
 }
+#endif
 }


Index: libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
===
--- libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ libcxx/trunk/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // iterator insert(const_iterator position, size_type n, const value_type& x);
@@ -20,6 +19,7 @@
 
 #include "min_allocator.h"
 #include "count_new.hpp"
+#include "test_macros.h"
 
 template 
 void test() {
@@ -29,6 +29,7 @@
 typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
 assert(i == next(l1.begin()));
 assert(l1 == List(a2, a2+8));
+#ifndef TEST_HAS_NO_EXCEPTIONS
 globalMemCounter.throw_after = 4;
 int save_count = globalMemCounter.outstanding_new;
 try
@@ -41,6 +42,7 @@
 }
 assert(globalMemCounter.checkOutstandingNewEq(save_count));
 assert(l1 == List(a2, a2+8));
+#endif
 }
 
 int main()
Index: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
===
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ 

[PATCH] D27252: Protect sequences test under libcpp-no-exceptions

2016-11-30 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

LGTM>


https://reviews.llvm.org/D27252



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27252: Protect sequences test under libcpp-no-exceptions

2016-11-30 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: mclow.lists, EricWF, rmaprath.
rogfer01 added a subscriber: cfe-commits.

Replace throw with TEST_THROW and protect tests that do throw. Also add missing 
assert(false).


https://reviews.llvm.org/D27252

Files:
  
test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
  
test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp


Index: 
test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
===
--- 
test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ 
test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -7,19 +7,18 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // void push_back(const value_type& x);
 
 #include 
 #include 
 
 #include "asan_testing.h"
+#include "test_macros.h"
 
 // Flag that makes the copy constructor for CMyClass throw an exception
-static bool gCopyConstructorShouldThow = false;
-
+static bool gCopyConstructorShouldThrow = false;
 
 class CMyClass {
 public: CMyClass(int tag);
@@ -52,8 +51,8 @@
 fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
 {
 // If requested, throw an exception _before_ setting fMagicValue to 
kFinishedConstructionMagicValue
-if (gCopyConstructorShouldThow) {
-throw std::exception();
+if (gCopyConstructorShouldThrow) {
+TEST_THROW(std::exception());
 }
 // Signal that the constructor has finished running
 fMagicValue = kFinishedConstructionMagicValue;
@@ -76,12 +75,15 @@
 assert(is_contiguous_container_asan_correct(vec));
 assert(is_contiguous_container_asan_correct(vec2));
 
-gCopyConstructorShouldThow = true;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+gCopyConstructorShouldThrow = true;
 try {
 vec.push_back(instance);
+assert(false);
 }
 catch (...) {
 assert(vec==vec2);
 assert(is_contiguous_container_asan_correct(vec));
 }
+#endif
 }
Index: 
test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
===
--- 
test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ 
test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -7,7 +7,6 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // iterator insert(const_iterator position, size_type n, const value_type& x);
@@ -20,6 +19,7 @@
 
 #include "min_allocator.h"
 #include "count_new.hpp"
+#include "test_macros.h"
 
 template 
 void test() {
@@ -29,6 +29,7 @@
 typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
 assert(i == next(l1.begin()));
 assert(l1 == List(a2, a2+8));
+#ifndef TEST_HAS_NO_EXCEPTIONS
 globalMemCounter.throw_after = 4;
 int save_count = globalMemCounter.outstanding_new;
 try
@@ -41,6 +42,7 @@
 }
 assert(globalMemCounter.checkOutstandingNewEq(save_count));
 assert(l1 == List(a2, a2+8));
+#endif
 }
 
 int main()


Index: test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
===
--- test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
+++ test/std/containers/sequences/vector/vector.modifiers/push_back_exception_safety.pass.cpp
@@ -7,19 +7,18 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // void push_back(const value_type& x);
 
 #include 
 #include 
 
 #include "asan_testing.h"
+#include "test_macros.h"
 
 // Flag that makes the copy constructor for CMyClass throw an exception
-static bool gCopyConstructorShouldThow = false;
-
+static bool gCopyConstructorShouldThrow = false;
 
 class CMyClass {
 public: CMyClass(int tag);
@@ -52,8 +51,8 @@
 fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
 {
 // If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
-if (gCopyConstructorShouldThow) {
-throw std::exception();
+if (gCopyConstructorShouldThrow) {
+TEST_THROW(std::exception());
 }
 // Signal that the constructor has finished running
 fMagicValue = kFinishedConstructionMagicValue;
@@ -76,12 +75,15 @@
 assert(is_contiguous_container_asan_correct(vec));
 assert(is_contiguous_container_asan_correct(vec2));
 
-gCopyConstructorShouldThow = true;
+#ifndef TEST_HAS_NO_EXCEPTIONS
+gCopyConstructorShouldThrow = true;
 try {
 vec.push_back(instance);
+assert(false);
 }
 catch (...) {