summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-12-11 15:45:48 -0500
committerEric Fiselier <eric@efcs.ca>2019-12-11 15:47:06 -0500
commitdaacf57032450079b44b8a7f9b976700d3bc38f8 (patch)
tree484a46b13aa7c9c5a385203c7a6a38d58ad19845 /libcxx/test
parentfe593fe15f780517a703c4c108fc162028f180bb (diff)
downloadbcm5719-llvm-daacf57032450079b44b8a7f9b976700d3bc38f8.tar.gz
bcm5719-llvm-daacf57032450079b44b8a7f9b976700d3bc38f8.zip
[libc++] Add fuzzing tests for parts of <random>.
This patch also re-names the existing fuzzing unit tests so they actually run.
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/libcxx/fuzzing/fuzzer_test.h46
-rw-r--r--libcxx/test/libcxx/fuzzing/geometric_distribution.pass.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/nth_element.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/nth_element.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/partial_sort.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/partial_sort.pass.cpp30
-rw-r--r--libcxx/test/libcxx/fuzzing/partial_sort_copy.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/partial_sort_copy.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/partition.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/partition.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/partition_copy.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/partition_copy.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_ECMAScript.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_ECMAScript.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_POSIX.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_POSIX.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_awk.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_awk.pass.cpp12
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_egrep.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_egrep.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_extended.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_extended.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_grep.cpp36
-rw-r--r--libcxx/test/libcxx/fuzzing/regex_grep.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/sort.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/sort.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/stable_partition.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/stable_partition.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/stable_sort.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/stable_sort.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/unique.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/unique.pass.cpp11
-rw-r--r--libcxx/test/libcxx/fuzzing/unique_copy.cpp37
-rw-r--r--libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp11
34 files changed, 279 insertions, 586 deletions
diff --git a/libcxx/test/libcxx/fuzzing/fuzzer_test.h b/libcxx/test/libcxx/fuzzing/fuzzer_test.h
new file mode 100644
index 00000000000..9b9a23feb69
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/fuzzer_test.h
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_LIBCXX_FUZZER_TEST_H
+#define TEST_LIBCXX_FUZZER_TEST_H
+
+#include <cstddef>
+#include <cassert>
+
+#include "../../../fuzzing/fuzzing.h"
+#include "../../../fuzzing/fuzzing.cpp"
+
+const char* TestCaseSetOne[] = {"", "s", "bac",
+ "bacasf"
+ "lkajseravea",
+ "adsfkajdsfjkas;lnc441324513,34535r34525234",
+ "b*c",
+ "ba?sf"
+ "lka*ea",
+ "adsf*kas;lnc441[0-9]1r34525234"};
+
+using FuzzerFuncType = int(const uint8_t*, size_t);
+
+template <size_t NumCases>
+inline void RunFuzzingTest(FuzzerFuncType *to_test, const char* (&test_cases)[NumCases]) {
+ for (const char* TC : test_cases) {
+ const size_t size = std::strlen(TC);
+ const uint8_t* data = (const uint8_t*)TC;
+ int result = to_test(data, size);
+ assert(result == 0);
+ }
+}
+
+#define FUZZER_TEST(FuncName) \
+int main() { \
+ RunFuzzingTest(FuncName, TestCaseSetOne); \
+} \
+extern int require_semi
+
+#endif // TEST_LIBCXX_FUZZER_TEST_H
diff --git a/libcxx/test/libcxx/fuzzing/geometric_distribution.pass.cpp b/libcxx/test/libcxx/fuzzing/geometric_distribution.pass.cpp
new file mode 100644
index 00000000000..acb07ef875a
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/geometric_distribution.pass.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===------------------------ unique_copy.cpp -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <random>
+#include <cstdint>
+
+#include "fuzzer_test.h"
+
+template <class Distribution>
+int random_distribution_helper(const uint8_t *data, size_t size) {
+ std::mt19937 engine;
+ using ParamT = typename Distribution::param_type;
+ if (size < sizeof(double))
+ return 0;
+ double Arg;
+ memcpy(&Arg, data, sizeof(double));
+ ParamT p(Arg);
+ Distribution d(p);
+ for (int I=0; I < 1000; ++I) {
+ volatile auto res = d(engine);
+ ((void)res);
+ }
+ return 0;
+}
+
+int FuzzRandom(const uint8_t *Data, size_t Size) {
+ return random_distribution_helper<std::geometric_distribution<std::int16_t>>(Data, Size);
+}
+FUZZER_TEST(FuzzRandom);
+
+
diff --git a/libcxx/test/libcxx/fuzzing/nth_element.cpp b/libcxx/test/libcxx/fuzzing/nth_element.cpp
deleted file mode 100644
index 482aeb65ffe..00000000000
--- a/libcxx/test/libcxx/fuzzing/nth_element.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===----------------------- nth_element.cpp ------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::nth_element(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/nth_element.pass.cpp b/libcxx/test/libcxx/fuzzing/nth_element.pass.cpp
new file mode 100644
index 00000000000..580c5593e90
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/nth_element.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===----------------------- nth_element.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::nth_element);
diff --git a/libcxx/test/libcxx/fuzzing/partial_sort.cpp b/libcxx/test/libcxx/fuzzing/partial_sort.cpp
deleted file mode 100644
index 4f357666330..00000000000
--- a/libcxx/test/libcxx/fuzzing/partial_sort.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- partial_sort.cpp --------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::partial_sort(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/partial_sort.pass.cpp b/libcxx/test/libcxx/fuzzing/partial_sort.pass.cpp
new file mode 100644
index 00000000000..08fa1a38de1
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/partial_sort.pass.cpp
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//===-------------------------- partial_sort.cpp --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <cassert>
+#include <cstring> // for strlen
+
+#include "../fuzzing/fuzzing.h"
+#include "../fuzzing/fuzzing.cpp"
+
+const char* test_cases[] = {"", "s", "bac",
+ "bacasf"
+ "lkajseravea",
+ "adsfkajdsfjkas;lnc441324513,34535r34525234"};
+
+const size_t k_num_tests = sizeof(test_cases) / sizeof(test_cases[0]);
+
+int main(int, char**) {
+ for (size_t i = 0; i < k_num_tests; ++i) {
+ const size_t size = std::strlen(test_cases[i]);
+ const uint8_t* data = (const uint8_t*)test_cases[i];
+ assert(0 == fuzzing::partial_sort(data, size));
+ }
+ return 0;
+}
diff --git a/libcxx/test/libcxx/fuzzing/partial_sort_copy.cpp b/libcxx/test/libcxx/fuzzing/partial_sort_copy.cpp
deleted file mode 100644
index b569f55ebd8..00000000000
--- a/libcxx/test/libcxx/fuzzing/partial_sort_copy.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===----------------------- partial_sort_copy.cpp ------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::partial_sort_copy(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/partial_sort_copy.pass.cpp b/libcxx/test/libcxx/fuzzing/partial_sort_copy.pass.cpp
new file mode 100644
index 00000000000..42bc4addfd1
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/partial_sort_copy.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===----------------------- partial_sort_copy.cpp ------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::partial_sort_copy);
diff --git a/libcxx/test/libcxx/fuzzing/partition.cpp b/libcxx/test/libcxx/fuzzing/partition.cpp
deleted file mode 100644
index 0833e38e211..00000000000
--- a/libcxx/test/libcxx/fuzzing/partition.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===--------------------------- partition.cpp ----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::partition(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/partition.pass.cpp b/libcxx/test/libcxx/fuzzing/partition.pass.cpp
new file mode 100644
index 00000000000..15bdcf43ce2
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/partition.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===--------------------------- partition.cpp ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::partition);
diff --git a/libcxx/test/libcxx/fuzzing/partition_copy.cpp b/libcxx/test/libcxx/fuzzing/partition_copy.cpp
deleted file mode 100644
index f336a14cab6..00000000000
--- a/libcxx/test/libcxx/fuzzing/partition_copy.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===------------------------ partition_copy.cpp --------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::partition_copy(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/partition_copy.pass.cpp b/libcxx/test/libcxx/fuzzing/partition_copy.pass.cpp
new file mode 100644
index 00000000000..b026e7c1920
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/partition_copy.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===------------------------ partition_copy.cpp --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::partition_copy);
diff --git a/libcxx/test/libcxx/fuzzing/regex_ECMAScript.cpp b/libcxx/test/libcxx/fuzzing/regex_ECMAScript.cpp
deleted file mode 100644
index ca9a7dae521..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_ECMAScript.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===--------------------- regex_ECMAScript.cpp ---------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_ECMAScript(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_ECMAScript.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_ECMAScript.pass.cpp
new file mode 100644
index 00000000000..d0e1cf87b1e
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_ECMAScript.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===--------------------- regex_ECMAScript.cpp ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_ECMAScript);
diff --git a/libcxx/test/libcxx/fuzzing/regex_POSIX.cpp b/libcxx/test/libcxx/fuzzing/regex_POSIX.cpp
deleted file mode 100644
index 69f40de6d19..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_POSIX.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===----------------------- regex_POSIX.cpp ------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_POSIX(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_POSIX.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_POSIX.pass.cpp
new file mode 100644
index 00000000000..db1d760a718
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_POSIX.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===----------------------- regex_POSIX.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_POSIX);
diff --git a/libcxx/test/libcxx/fuzzing/regex_awk.cpp b/libcxx/test/libcxx/fuzzing/regex_awk.cpp
deleted file mode 100644
index ca9a7dae521..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_awk.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===--------------------- regex_ECMAScript.cpp ---------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_ECMAScript(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_awk.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_awk.pass.cpp
new file mode 100644
index 00000000000..d3630594e29
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_awk.pass.cpp
@@ -0,0 +1,12 @@
+// -*- C++ -*-
+//===------------------------- regex_awk.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_awk);
diff --git a/libcxx/test/libcxx/fuzzing/regex_egrep.cpp b/libcxx/test/libcxx/fuzzing/regex_egrep.cpp
deleted file mode 100644
index f350f63e334..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_egrep.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===------------------------ regex_egrep.cpp -----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_egrep(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_egrep.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_egrep.pass.cpp
new file mode 100644
index 00000000000..840fd71f2ca
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_egrep.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===------------------------ regex_egrep.cpp -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_egrep);
diff --git a/libcxx/test/libcxx/fuzzing/regex_extended.cpp b/libcxx/test/libcxx/fuzzing/regex_extended.cpp
deleted file mode 100644
index ae55f5bb837..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_extended.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===---------------------- regex_extended.cpp ----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_extended(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_extended.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_extended.pass.cpp
new file mode 100644
index 00000000000..fe81d263a3c
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_extended.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===---------------------- regex_extended.cpp ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_extended);
diff --git a/libcxx/test/libcxx/fuzzing/regex_grep.cpp b/libcxx/test/libcxx/fuzzing/regex_grep.cpp
deleted file mode 100644
index ac497b3a9fc..00000000000
--- a/libcxx/test/libcxx/fuzzing/regex_grep.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// -*- C++ -*-
-//===------------------------ regex_grep.cpp ------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "b*c",
- "ba?sf"
- "lka*ea",
- "adsf*kas;lnc441[0-9]1r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::regex_grep(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/regex_grep.pass.cpp b/libcxx/test/libcxx/fuzzing/regex_grep.pass.cpp
new file mode 100644
index 00000000000..321c7297e3a
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/regex_grep.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===------------------------ regex_grep.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::regex_grep);
diff --git a/libcxx/test/libcxx/fuzzing/sort.cpp b/libcxx/test/libcxx/fuzzing/sort.cpp
deleted file mode 100644
index 43b9064de03..00000000000
--- a/libcxx/test/libcxx/fuzzing/sort.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===--------------------------- sort.cpp ---------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::sort(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/sort.pass.cpp b/libcxx/test/libcxx/fuzzing/sort.pass.cpp
new file mode 100644
index 00000000000..3de5fe46329
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/sort.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===--------------------------- sort.cpp ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::sort);
diff --git a/libcxx/test/libcxx/fuzzing/stable_partition.cpp b/libcxx/test/libcxx/fuzzing/stable_partition.cpp
deleted file mode 100644
index b236190cbf2..00000000000
--- a/libcxx/test/libcxx/fuzzing/stable_partition.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===--------------------- stable_partition.cpp ---------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::stable_partition(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/stable_partition.pass.cpp b/libcxx/test/libcxx/fuzzing/stable_partition.pass.cpp
new file mode 100644
index 00000000000..ed22a36fcd9
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/stable_partition.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===--------------------- stable_partition.cpp ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::stable_partition);
diff --git a/libcxx/test/libcxx/fuzzing/stable_sort.cpp b/libcxx/test/libcxx/fuzzing/stable_sort.cpp
deleted file mode 100644
index 1c8ac490425..00000000000
--- a/libcxx/test/libcxx/fuzzing/stable_sort.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===------------------------ stable_sort.cpp ----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::stable_sort(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/stable_sort.pass.cpp b/libcxx/test/libcxx/fuzzing/stable_sort.pass.cpp
new file mode 100644
index 00000000000..130e1cab083
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/stable_sort.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===------------------------ stable_sort.cpp ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::stable_sort);
diff --git a/libcxx/test/libcxx/fuzzing/unique.cpp b/libcxx/test/libcxx/fuzzing/unique.cpp
deleted file mode 100644
index cab512eb89e..00000000000
--- a/libcxx/test/libcxx/fuzzing/unique.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===--------------------------- unique.cpp -------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::unique(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/unique.pass.cpp b/libcxx/test/libcxx/fuzzing/unique.pass.cpp
new file mode 100644
index 00000000000..d30c9666785
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/unique.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===--------------------------- unique.cpp -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::unique);
diff --git a/libcxx/test/libcxx/fuzzing/unique_copy.cpp b/libcxx/test/libcxx/fuzzing/unique_copy.cpp
deleted file mode 100644
index 311eb4cf64e..00000000000
--- a/libcxx/test/libcxx/fuzzing/unique_copy.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//===------------------------ unique_copy.cpp -----------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// XFAIL
-
-#include "fuzzing.h"
-#include <cassert>
-#include <cstring> // for strlen
-
-const char * test_cases[] = {
- "",
- "s",
- "bac",
- "bacasf"
- "lkajseravea",
- "adsfkajdsfjkas;lnc441324513,34535r34525234"
- };
-
-const size_t k_num_tests = sizeof(test_cases)/sizeof(test_cases[0]);
-
-
-int main(int, char**)
-{
- for (size_t i = 0; i < k_num_tests; ++i)
- {
- const size_t size = std::strlen(test_cases[i]);
- const uint8_t *data = (const uint8_t *) test_cases[i];
- assert(0 == fuzzing::unique_copy(data, size));
- }
- return 0;
-}
diff --git a/libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp b/libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp
new file mode 100644
index 00000000000..78fed979950
--- /dev/null
+++ b/libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp
@@ -0,0 +1,11 @@
+// -*- C++ -*-
+//===------------------------ unique_copy.cpp -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "fuzzer_test.h"
+FUZZER_TEST(fuzzing::unique_copy);
OpenPOWER on IntegriCloud