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 rm -rf $(TOOLS) mdbx_test @* *.[ao] *.[ls]o *~ tmp.db/* *.gcov *.log *.err src/*.o test/*.o
check: all 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 && ./mdbx_chk -vvn $(TESTDB) && ./mdbx_chk -vvn $(TESTDB)-copy
check-singleprocess: all 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 && ./mdbx_chk -vvn $(TESTDB) && ./mdbx_chk -vvn $(TESTDB)-copy
check-fault: all check-fault: all

View File

@ -37,7 +37,7 @@ void actor_params::set_defaults(const std::string &tmpdir) {
table_flags = MDBX_DUPSORT; table_flags = MDBX_DUPSORT;
size_lower = -1; 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; size_upper = -1;
shrink_threshold = -1; shrink_threshold = -1;
growth_step = -1; growth_step = -1;

View File

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