rocksdb/tools
Igor Sugak 9fd6edf81c rocksdb: Replace ASSERT* with EXPECT* in functions that does not return void value
Summary:
gtest does not use exceptions to fail a unit test by design, and `ASSERT*`s are implemented using `return`. As a consequence we cannot use `ASSERT*` in a function that does not return `void` value ([[ https://code.google.com/p/googletest/wiki/AdvancedGuide#Assertion_Placement | 1]]), and have to fix our existing code. This diff does this in a generic way, with no manual changes.

In order to detect all existing `ASSERT*` that are used in functions that doesn't return void value, I change the code to generate compile errors for such cases.

In `util/testharness.h` I defined `EXPECT*` assertions, the same way as `ASSERT*`, and redefined `ASSERT*` to return `void`. Then executed:

```lang=bash
% USE_CLANG=1 make all -j55 -k 2> build.log
% perl -naF: -e 'print "-- -number=".$F[1]." ".$F[0]."\n" if  /: error:/' \
build.log | xargs -L 1 perl -spi -e 's/ASSERT/EXPECT/g if $. == $number'
% make format
```
After that I reverted back change to `ASSERT*` in `util/testharness.h`. But preserved introduced `EXPECT*`, which is the same as `ASSERT*`. This will be deleted once switched to gtest.

This diff is independent and contains manual changes only in `util/testharness.h`.

Test Plan:
Make sure all tests are passing.
```lang=bash
% USE_CLANG=1 make check
```

Reviewers: igor, lgalanis, sdong, yufei.zhu, rven, meyering

Reviewed By: meyering

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D33333
2015-03-16 20:52:32 -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_crashtest.py db_stress for dynamic options 2014-10-27 12:11:16 -07:00
db_crashtest2.py Remove seek compaction 2014-06-20 10:23:02 +02: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.cc Make db_stress built for ROCKSDB_LITE 2014-11-14 10:20:51 -08:00
ldb_test.py Added 'dump_live_files' command to ldb tool. 2014-12-12 17:50:36 -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: Replace ASSERT* with EXPECT* in functions that does not return void value 2015-03-16 20:52:32 -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