mdbx-test: implement cleanup().

This commit is contained in:
Leonid Yuriev 2020-05-13 16:40:23 +03:00
parent c6edd6fb91
commit 68241762e7
2 changed files with 7 additions and 3 deletions

View File

@ -176,7 +176,7 @@ function probe {
echo "=============================================== $(date)"
echo "${caption}: $*"
rm -f ${TESTDB_DIR}/* \
&& ${VALGRIND} ./mdbx_test --ignore-dbfull --repeat=3 --pathname=${TESTDB_DIR}/long.db "$@" | lz4 > ${TESTDB_DIR}/long.log.lz4 \
&& ${VALGRIND} ./mdbx_test --ignore-dbfull --repeat=3 --pathname=${TESTDB_DIR}/long.db "$@" --cleanup-after=no | lz4 > ${TESTDB_DIR}/long.log.lz4 \
&& ${VALGRIND} ./mdbx_chk -nvvv ${TESTDB_DIR}/long.db | tee ${TESTDB_DIR}/long-chk.log \
&& ([ ! -e ${TESTDB_DIR}/long.db-copy ] || ${VALGRIND} ./mdbx_chk -nvvv ${TESTDB_DIR}/long.db-copy | tee ${TESTDB_DIR}/long-chk-copy.log) \
|| (echo "FAILED"; exit 1)

View File

@ -209,7 +209,11 @@ std::string thunk_param(const actor_config &config) {
void cleanup() {
log_trace(">> cleanup");
/* TODO: remove each database */
for (const auto &db_path : global::databases) {
int err = osal_removefile(db_path);
if (err != MDBX_SUCCESS && err != MDBX_ENOFILE)
failure_perror(db_path.c_str(), err);
}
log_trace("<< cleanup");
}
@ -587,7 +591,7 @@ int main(int argc, char *const argv[]) {
}
log_notice("RESULT: %s\n", failed ? "Failed" : "Successful");
if (global::config::cleanup_before) {
if (global::config::cleanup_after) {
if (failed)
log_verbose("skip cleanup");
else