Evenly split HarnessTest.Randomized

Summary:
Currently HarnessTest.Randomized is already split but some of the splits are faster than the others. The reason is that each split takes a continuous range of the generated args and the test with later args takes longer to finish. The patch evenly split the args among splits in a round robin fashion.
Before:
```
[       OK ] HarnessTest.Randomized1n2 (2278 ms)
[       OK ] HarnessTest.Randomized3n4 (1095 ms)
[       OK ] HarnessTest.Randomized5 (658 ms)
[       OK ] HarnessTest.Randomized6 (1258 ms)
[       OK ] HarnessTest.Randomized7 (6476 ms)
[       OK ] HarnessTest.Randomized8 (8182 ms)
```
After
```
[       OK ] HarnessTest.Randomized1 (2649 ms)
[       OK ] HarnessTest.Randomized2 (2645 ms)
[       OK ] HarnessTest.Randomized3 (2577 ms)
[       OK ] HarnessTest.Randomized4 (2490 ms)
[       OK ] HarnessTest.Randomized5 (2553 ms)
[       OK ] HarnessTest.Randomized6 (2560 ms)
[       OK ] HarnessTest.Randomized7 (2501 ms)
[       OK ] HarnessTest.Randomized8 (2574 ms)
```
Closes https://github.com/facebook/rocksdb/pull/3808

Differential Revision: D7882663

Pulled By: maysamyabandeh

fbshipit-source-id: 09b749a9684b6d7d65466aa4b00c5334a49e833e
main
Maysam Yabandeh 7 years ago committed by Facebook Github Bot
parent 171f415b30
commit fc522bdb3e
  1. 35
      table/table_test.cc

@ -975,17 +975,14 @@ class HarnessTest : public testing::Test {
std::vector<TestArgs> args = GenerateArgList();
assert(part);
assert(part <= total);
size_t start_i = (part - 1) * args.size() / total;
size_t end_i = part * args.size() / total;
for (unsigned int i = static_cast<unsigned int>(start_i); i < end_i; i++) {
for (unsigned int i = 0; i < args.size(); i++) {
if ((i % total) + 1 != part) {
continue;
}
Init(args[i]);
Random rnd(test::RandomSeed() + 5);
for (int num_entries = 0; num_entries < 2000;
num_entries += (num_entries < 50 ? 1 : 200)) {
if ((num_entries % 10) == 0) {
fprintf(stderr, "case %d of %d: num_entries = %d\n", (i + 1),
static_cast<int>(args.size()), num_entries);
}
for (int e = 0; e < num_entries; e++) {
std::string v;
Add(test::RandomKey(&rnd, rnd.Skewed(4)),
@ -2617,20 +2614,32 @@ TEST_F(GeneralTableTest, ApproximateOffsetOfCompressed) {
// RandomizedHarnessTest is very slow for certain combination of arguments
// Split into 8 pieces to reduce the time individual tests take.
TEST_F(HarnessTest, Randomized1n2) {
// part 1,2 out of 8
TEST_F(HarnessTest, Randomized1) {
// part 1 out of 8
const size_t part = 1;
const size_t total = 8;
RandomizedHarnessTest(part, total);
RandomizedHarnessTest(part+1, total);
}
TEST_F(HarnessTest, Randomized3n4) {
// part 3,4 out of 8
TEST_F(HarnessTest, Randomized2) {
// part 2 out of 8
const size_t part = 2;
const size_t total = 8;
RandomizedHarnessTest(part, total);
}
TEST_F(HarnessTest, Randomized3) {
// part 3 out of 8
const size_t part = 3;
const size_t total = 8;
RandomizedHarnessTest(part, total);
RandomizedHarnessTest(part+1, total);
}
TEST_F(HarnessTest, Randomized4) {
// part 4 out of 8
const size_t part = 4;
const size_t total = 8;
RandomizedHarnessTest(part, total);
}
TEST_F(HarnessTest, Randomized5) {

Loading…
Cancel
Save