Initial cut at infastructure for fuzzing support for OSS-fuzz

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314940 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2017-10-04 22:23:03 +00:00
parent 8a29c9d39b
commit 29ae2ba656
8 changed files with 483 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===----------------------- nth_element.cpp ------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===-------------------------- partial_sort.cpp --------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===--------------------------- partition.cpp ----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===--------------------------- sort.cpp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===--------------------- stable_partition.cpp ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}

View File

@@ -0,0 +1,38 @@
// -*- C++ -*-
//===------------------------ stable_sort.cpp ----------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// 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 ()
{
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;
}