]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/test_util/testharness.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rocksdb / test_util / testharness.h
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
2// This source code is licensed under both the GPLv2 (found in the
3// COPYING file in the root directory) and Apache 2.0 License
4// (found in the LICENSE.Apache file in the root directory).
7c673cae
FG
5//
6// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7// Use of this source code is governed by a BSD-style license that can be
8// found in the LICENSE file. See the AUTHORS file for names of contributors.
9
10#pragma once
11
12#ifdef OS_AIX
13#include "gtest/gtest.h"
14#else
15#include <gtest/gtest.h>
16#endif
17
18#include <string>
19#include "rocksdb/env.h"
20
f67539c2 21namespace ROCKSDB_NAMESPACE {
7c673cae
FG
22namespace test {
23
24// Return the directory to use for temporary storage.
25std::string TmpDir(Env* env = Env::Default());
26
11fdf7f2
TL
27// A path unique within the thread
28std::string PerThreadDBPath(std::string name);
29std::string PerThreadDBPath(Env* env, std::string name);
30std::string PerThreadDBPath(std::string dir, std::string name);
31
7c673cae
FG
32// Return a randomization seed for this run. Typically returns the
33// same number on repeated invocations of this binary, but automated
34// runs may be able to vary the seed.
35int RandomSeed();
36
37::testing::AssertionResult AssertStatus(const char* s_expr, const Status& s);
38
f67539c2
TL
39#define ASSERT_OK(s) \
40 ASSERT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s)
7c673cae 41#define ASSERT_NOK(s) ASSERT_FALSE((s).ok())
f67539c2
TL
42#define EXPECT_OK(s) \
43 EXPECT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s)
7c673cae
FG
44#define EXPECT_NOK(s) EXPECT_FALSE((s).ok())
45
46} // namespace test
f67539c2 47} // namespace ROCKSDB_NAMESPACE