Commit 9daf6bb2 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

Roll src/third_party/leveldatabase/src/ 2c9c80bd5..58a89bbcb (5 commits)

https://chromium.googlesource.com/external/leveldb.git/+log/2c9c80bd539c..58a89bbcb28d

This CL also adds googletest as a dependency to tests, and fixes a
fuzzer that depended on leveldb implementation details.

$ git log 2c9c80bd5..58a89bbcb --date=short --no-merges --format='%ad %ae %s'
2019-12-02 costan Add WITHOUT ROWID to SQLite benchmark.
2019-12-02 pwnall Fixup for adding the third_party/googletest submodule.
2019-11-25 no-reply Internal change.
2019-11-25 pwnall Fixup for adding the third_party/googletest submodule. (#754)
2019-11-21 costan Switch testing harness to googletest.

Created with:
  roll-dep src/third_party/leveldatabase/src

Change-Id: I3a00eb1eaa97e3c801be9de019ee25ae24fd0876
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947963
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarChris Mumford <cmumford@google.com>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721353}
parent 181af9d3
......@@ -1125,7 +1125,7 @@ deps = {
},
'src/third_party/leveldatabase/src':
Var('chromium_git') + '/external/leveldb.git' + '@' + '2c9c80bd539ca5aad5ea864ee6dd81c1ee3eb91e',
Var('chromium_git') + '/external/leveldb.git' + '@' + '58a89bbcb28d02d5704c5fff7aeb6e72f7ca2431',
'src/third_party/libFuzzer/src':
Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git' + '@' + Var('libfuzzer_revision'),
......
......@@ -198,8 +198,6 @@ if (!is_ios && !is_android) {
sources = [
"src/util/histogram.cc",
"src/util/histogram.h",
"src/util/testharness.cc",
"src/util/testharness.h",
"src/util/testutil.cc",
"src/util/testutil.h",
]
......@@ -209,6 +207,8 @@ if (!is_ios && !is_android) {
public_deps = [
":leveldb_static",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
deps = [
"//base",
......@@ -449,7 +449,5 @@ fuzzer_test("leveldb_put_get_delete_fuzzer") {
]
deps = [
":leveldatabase",
":leveldb_testutil",
"//base/test:test_support",
]
}
......@@ -4,13 +4,21 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <fuzzer/FuzzedDataProvider.h>
#include "leveldb/db.h"
#include "leveldb/env.h"
#include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
#include "util/testharness.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "third_party/leveldatabase/src/include/leveldb/env.h"
#include "third_party/leveldatabase/src/include/leveldb/options.h"
#include "third_party/leveldatabase/src/include/leveldb/slice.h"
#define FUZZING_ASSERT(condition) \
if (!(condition)) { \
fprintf(stderr, "%s\n", "Fuzzing Assertion Failure: " #condition); \
abort(); \
}
using leveldb::DB;
using leveldb::Env;
......@@ -48,11 +56,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
DB* db = nullptr;
Status open_status = DB::Open(open_opts, "leveldbfuzztest", &db);
ASSERT_TRUE(open_status.ok());
FUZZING_ASSERT(open_status.ok());
// Put a couple constant values which must be successfully written.
ASSERT_OK(db->Put(write_opts, "key1", "val1"));
ASSERT_OK(db->Put(write_opts, "key2", "val2"));
FUZZING_ASSERT(db->Put(write_opts, "key1", "val1").ok());
FUZZING_ASSERT(db->Put(write_opts, "key2", "val2").ok());
// Split the data into a sequence of (key, value) strings and put those in.
// Also collect both keys and values to be used as keys for retrieval below.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment