mdbx-test: support for repeat parameter.

Change-Id: I6de52cd21314935c123ac51537e1b893c39dd5ed
This commit is contained in:
Leonid Yuriev 2019-06-20 02:41:22 +03:00
parent cd75c4f081
commit 86cfd86cda
3 changed files with 28 additions and 14 deletions

View File

@ -82,11 +82,11 @@ clean:
rm -rf $(TOOLS) mdbx_test @* *.[ao] *.[ls]o *~ tmp.db/* *.gcov *.log *.err src/*.o test/*.o
check: all
rm -f $(TESTDB) $(TESTLOG) && (set -o pipefail; ./mdbx_test --pathname=$(TESTDB) --dont-cleanup-after basic | tee -a $(TESTLOG) | tail -n 42) \
rm -f $(TESTDB) $(TESTLOG) && (set -o pipefail; ./mdbx_test --repeat=42 --pathname=$(TESTDB) --dont-cleanup-after basic | tee -a $(TESTLOG) | tail -n 42) \
&& ./mdbx_chk -vvn $(TESTDB) && ./mdbx_chk -vvn $(TESTDB)-copy
check-singleprocess: all
rm -f $(TESTDB) $(TESTLOG) && (set -o pipefail; ./mdbx_test --pathname=$(TESTDB) --dont-cleanup-after --hill --copy | tee -a $(TESTLOG) | tail -n 42) \
rm -f $(TESTDB) $(TESTLOG) && (set -o pipefail; ./mdbx_test --repeat=42 --pathname=$(TESTDB) --dont-cleanup-after --hill --copy | tee -a $(TESTLOG) | tail -n 42) \
&& ./mdbx_chk -vvn $(TESTDB) && ./mdbx_chk -vvn $(TESTDB)-copy
check-fault: all

View File

@ -37,7 +37,7 @@ void actor_params::set_defaults(const std::string &tmpdir) {
table_flags = MDBX_DUPSORT;
size_lower = -1;
size_now = 1024 * 1024 * ((table_flags & MDBX_DUPSORT) ? 4 : 256);
size_now = intptr_t(1024) * 1024 * ((table_flags & MDBX_DUPSORT) ? 4 : 256);
size_upper = -1;
shrink_threshold = -1;
growth_step = -1;

View File

@ -322,6 +322,7 @@ bool testcase::setup() {
return false;
start_timestamp = chrono::now_motonic();
nops_completed = 0;
return true;
}
@ -492,18 +493,31 @@ bool test_execute(const actor_config &config) {
break;
}
if (!test->setup())
log_notice("test setup failed");
else if (!test->run())
log_notice("test failed");
else if (!test->teardown())
log_notice("test teardown failed");
else {
log_info("test successed");
return true;
}
size_t iter = 0;
do {
iter++;
if (!test->setup()) {
log_notice("test setup failed");
return false;
} else if (!test->run()) {
log_notice("test failed");
return false;
} else if (!test->teardown()) {
log_notice("test teardown failed");
return false;
} else {
if (config.params.nrepeat == 1)
log_info("test successed");
else if (config.params.nrepeat == 1)
log_info("test successed (iteration %zi of %zi)", iter,
size_t(config.params.nrepeat));
else
log_info("test successed (iteration %zi)", iter);
}
} while (config.params.nrepeat == 0 || iter < config.params.nrepeat);
return true;
} catch (const std::exception &pipets) {
failure("***** Exception: %s *****", pipets.what());
return false;
}
return false;
}