rocksdb/utilities
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
..
backupable rocksdb: Replace ASSERT* with EXPECT* in functions that does not return void value 2015-03-16 20:52:32 -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 Provide a mechanism to inform Rocksdb that it is shutting down 2015-03-11 10:31:02 -07:00
document Fix compile 2015-02-26 16:56:39 -08:00
geodb rocksdb: Replace ASSERT* with EXPECT* in functions that does not return void value 2015-03-16 20:52:32 -07:00
leveldb_options Added CompatibleOptions for compatibility with LevelDB Options 2014-11-20 19:24:39 -08:00
merge_operators rocksdb: Replace ASSERT* with EXPECT* in functions that does not return void value 2015-03-16 20:52:32 -07:00
redis rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
spatialdb Add concurrency to compacting SpatialDB 2014-11-13 16:34:29 -05:00
ttl rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
write_batch_with_index rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
merge_operators.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00