1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 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). 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 21 namespace ROCKSDB_NAMESPACE { 22 namespace test { 23 24 // Return the directory to use for temporary storage. 25 std::string TmpDir(Env* env = Env::Default()); 26 27 // A path unique within the thread 28 std::string PerThreadDBPath(std::string name); 29 std::string PerThreadDBPath(Env* env, std::string name); 30 std::string PerThreadDBPath(std::string dir, std::string name); 31 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. 35 int RandomSeed(); 36 37 ::testing::AssertionResult AssertStatus(const char* s_expr, const Status& s); 38 39 #define ASSERT_OK(s) \ 40 ASSERT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s) 41 #define ASSERT_NOK(s) ASSERT_FALSE((s).ok()) 42 #define EXPECT_OK(s) \ 43 EXPECT_PRED_FORMAT1(ROCKSDB_NAMESPACE::test::AssertStatus, s) 44 #define EXPECT_NOK(s) EXPECT_FALSE((s).ok()) 45 46 } // namespace test 47 } // namespace ROCKSDB_NAMESPACE 48