rocksdb/utilities
Igor Sugak b4b69e4f77 rocksdb: switch to gtest
Summary:
Our existing test notation is very similar to what is used in gtest. It makes it easy to adopt what is different.
In this diff I modify existing [[ https://code.google.com/p/googletest/wiki/Primer#Test_Fixtures:_Using_the_Same_Data_Configuration_for_Multiple_Te | test fixture ]] classes to inherit from `testing::Test`. Also for unit tests that use fixture class, `TEST` is replaced with `TEST_F` as required in gtest.

There are several custom `main` functions in our existing tests. To make this transition easier, I modify all `main` functions to fallow gtest notation. But eventually we can remove them and use implementation of `main` that gtest provides.

```lang=bash
% cat ~/transform
#!/bin/sh
files=$(git ls-files '*test\.cc')
for file in $files
do
  if grep -q "rocksdb::test::RunAllTests()" $file
  then
    if grep -Eq '^class \w+Test {' $file
    then
      perl -pi -e 's/^(class \w+Test) {/${1}: public testing::Test {/g' $file
      perl -pi -e 's/^(TEST)/${1}_F/g' $file
    fi
    perl -pi -e 's/(int main.*\{)/${1}::testing::InitGoogleTest(&argc, argv);/g' $file
    perl -pi -e 's/rocksdb::test::RunAllTests/RUN_ALL_TESTS/g' $file
  fi
done
% sh ~/transform
% make format
```

Second iteration of this diff contains only scripted changes.

Third iteration contains manual changes to fix last errors and make it compilable.

Test Plan:
Build and notice no errors.
```lang=bash
% USE_CLANG=1 make check -j55
```
Tests are still testing.

Reviewers: meyering, sdong, rven, igor

Reviewed By: igor

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D35157
2015-03-17 14:08:00 -07:00
..
backupable rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
checkpoint rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
compacted_db Move GetThreadList() feature under Env. 2014-12-22 12:20:17 -08:00
convenience Remove unused parameter in CancelAllBackgroundWork 2015-03-16 21:07:54 -07:00
document rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
geodb rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
leveldb_options Added CompatibleOptions for compatibility with LevelDB Options 2014-11-20 19:24:39 -08:00
merge_operators rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
redis rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
spatialdb rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
ttl rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
write_batch_with_index rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
merge_operators.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00