rmaprath created this revision.
rmaprath added reviewers: EricWF, mclow.lists.
rmaprath added a subscriber: cfe-commits.

When we added support for the no-exceptions build of `libc++`, all the tests 
that used exceptions got a blanket XFAIL for the no-exceptions variety.

Previously, we tried to fix-up these tests with an elaborate setjmp/longjmp 
hackery (see D14653), which was rejected on the grounds of being too 
complicated / obtrusive.

The current patch is a representative fix that does the most obvious thing 
instead: use pre-processor macros to exclude just the bits of the test that use 
exceptions. Unlike in the previous patch, this means we are not trying to 
associate / verify a particular behaviour of the no-exceptions library with 
respect to exceptional situations (like calling abort). Here we simply save the 
parts of the test that has nothing to do with exceptions, I think this is a 
fair compromise.

We could also split the test file into two; one that uses exceptions and one 
that does not, though I can't think of any added benefits of that approach.

If this patch is approved I'll go ahead and update the rest of the tests (~150) 
to follow the same.

https://reviews.llvm.org/D24562

Files:
  test/std/re/re.alg/re.alg.search/grep.pass.cpp

Index: test/std/re/re.alg/re.alg.search/grep.pass.cpp
===================================================================
--- test/std/re/re.alg/re.alg.search/grep.pass.cpp
+++ test/std/re/re.alg/re.alg.search/grep.pass.cpp
@@ -7,7 +7,6 @@
 //
 
//===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <regex>
 
 // template <class BidirectionalIterator, class Allocator, class charT, class 
traits>
@@ -23,6 +22,7 @@
 #include "test_macros.h"
 #include "test_iterators.h"
 
+#ifndef TEST_HAS_NO_EXCEPTIONS
 extern "C" void LLVMFuzzerTestOneInput(const char *data)
 {
     size_t size = strlen(data);
@@ -47,6 +47,7 @@
     
LLVMFuzzerTestOneInput(R"XX(Õ)_%()()((\8'_%()_%()_%()_%(()_%()_%()_%(.t;)()¥f()_%()(.)_%;)()!¥f(((()()XX");
 #endif
 }
+#endif
 
 int main()
 {
@@ -82,5 +83,7 @@
         assert(m.position(0) == 0);
         assert(m.str(0) == "");
     }
+#ifndef TEST_HAS_NO_EXCEPTIONS
     fuzz_tests();
+#endif
 }


Index: test/std/re/re.alg/re.alg.search/grep.pass.cpp
===================================================================
--- test/std/re/re.alg/re.alg.search/grep.pass.cpp
+++ test/std/re/re.alg/re.alg.search/grep.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// XFAIL: libcpp-no-exceptions
 // <regex>
 
 // template <class BidirectionalIterator, class Allocator, class charT, class traits>
@@ -23,6 +22,7 @@
 #include "test_macros.h"
 #include "test_iterators.h"
 
+#ifndef TEST_HAS_NO_EXCEPTIONS
 extern "C" void LLVMFuzzerTestOneInput(const char *data)
 {
     size_t size = strlen(data);
@@ -47,6 +47,7 @@
     LLVMFuzzerTestOneInput(R"XX(Õ)_%()()((\8'_%()_%()_%()_%(()_%()_%()_%(.t;)()¥f()_%()(.)_%;)()!¥f(((()()XX");
 #endif
 }
+#endif
 
 int main()
 {
@@ -82,5 +83,7 @@
         assert(m.position(0) == 0);
         assert(m.str(0) == "");
     }
+#ifndef TEST_HAS_NO_EXCEPTIONS
     fuzz_tests();
+#endif
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to