rocksdb/tools
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
..
rdb first rdb commit 2014-11-20 23:33:00 -05:00
auto_sanity_test.sh Explicitly cast char to signed char in Hash() 2014-09-08 18:57:40 -07:00
benchmark.sh Switch to use_existing_db=1 for updaterandom and mergerandom 2015-03-14 08:36:57 -07:00
db_crashtest2.py Remove seek compaction 2014-06-20 10:23:02 +02:00
db_crashtest.py db_stress for dynamic options 2014-10-27 12:11:16 -07:00
db_repl_stress.cc Make db_stress built for ROCKSDB_LITE 2014-11-14 10:20:51 -08:00
db_sanity_test.cc rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
db_stress.cc rocksdb: Fixed 'Dead assignment' and 'Dead initialization' scan-build warnings 2015-02-23 14:10:09 -08:00
dbench_monitor Added simple monitoring script to monitor overusage of memory in db_bench 2015-02-11 18:40:11 -08:00
ldb_test.py Added 'dump_live_files' command to ldb tool. 2014-12-12 17:50:36 -08:00
ldb.cc Make db_stress built for ROCKSDB_LITE 2014-11-14 10:20:51 -08:00
pflag Added simple monitoring script to monitor overusage of memory in db_bench 2015-02-11 18:40:11 -08:00
reduce_levels_test.cc rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
run_flash_bench.sh add range scan test to benchmark script 2014-12-10 13:04:58 -08:00
sst_dump.cc Make db_stress built for ROCKSDB_LITE 2014-11-14 10:20:51 -08:00