2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2013-10-16 23:59:46 +02:00
|
|
|
//
|
2011-03-18 23:37:00 +01:00
|
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
|
2013-10-05 07:32:05 +02:00
|
|
|
#pragma once
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2017-04-22 05:41:37 +02:00
|
|
|
#ifdef OS_AIX
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#else
|
2015-03-17 22:08:00 +01:00
|
|
|
#include <gtest/gtest.h>
|
2017-04-22 05:41:37 +02:00
|
|
|
#endif
|
2015-03-17 22:08:00 +01:00
|
|
|
|
2014-10-31 23:08:10 +01:00
|
|
|
#include <string>
|
2013-08-23 17:38:13 +02:00
|
|
|
#include "rocksdb/env.h"
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2020-02-20 21:07:53 +01:00
|
|
|
namespace ROCKSDB_NAMESPACE {
|
2011-03-18 23:37:00 +01:00
|
|
|
namespace test {
|
|
|
|
|
|
|
|
// Return the directory to use for temporary storage.
|
2015-03-20 00:52:59 +01:00
|
|
|
std::string TmpDir(Env* env = Env::Default());
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2018-07-14 02:18:39 +02:00
|
|
|
// A path unique within the thread
|
|
|
|
std::string PerThreadDBPath(std::string name);
|
|
|
|
std::string PerThreadDBPath(Env* env, std::string name);
|
|
|
|
std::string PerThreadDBPath(std::string dir, std::string name);
|
|
|
|
|
2011-03-18 23:37:00 +01:00
|
|
|
// Return a randomization seed for this run. Typically returns the
|
|
|
|
// same number on repeated invocations of this binary, but automated
|
|
|
|
// runs may be able to vary the seed.
|
2015-03-20 00:52:59 +01:00
|
|
|
int RandomSeed();
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2015-03-20 01:32:43 +01:00
|
|
|
::testing::AssertionResult AssertStatus(const char* s_expr, const Status& s);
|
|
|
|
|
2020-02-20 21:07:53 +01:00
|
|
|
#define ASSERT_OK(s) \
|
|
|
|
ASSERT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s)
|
2015-03-20 01:32:43 +01:00
|
|
|
#define ASSERT_NOK(s) ASSERT_FALSE((s).ok())
|
2020-02-20 21:07:53 +01:00
|
|
|
#define EXPECT_OK(s) \
|
|
|
|
EXPECT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s)
|
2015-03-20 01:32:43 +01:00
|
|
|
#define EXPECT_NOK(s) EXPECT_FALSE((s).ok())
|
2011-03-18 23:37:00 +01:00
|
|
|
|
2011-10-31 18:22:06 +01:00
|
|
|
} // namespace test
|
2020-02-20 21:07:53 +01:00
|
|
|
} // namespace ROCKSDB_NAMESPACE
|