diff --git a/test/copy.cc b/test/copy.cc index 1a1513c1..9e07af7b 100644 --- a/test/copy.cc +++ b/test/copy.cc @@ -1,8 +1,8 @@ #include "test.h" void testcase_copy::copy_db(const bool with_compaction) { - int err = osal_removefile(copy_pathname); - if (err != MDBX_SUCCESS && err != MDBX_ENOFILE) + int err = mdbx_env_delete(copy_pathname.c_str(), MDBX_ENV_JUST_DELETE); + if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE) failure_perror("mdbx_removefile()", err); err = mdbx_env_copy(db_guard.get(), copy_pathname.c_str(), diff --git a/test/main.cc b/test/main.cc index fd0bf21c..5d50b043 100644 --- a/test/main.cc +++ b/test/main.cc @@ -212,24 +212,9 @@ std::string thunk_param(const actor_config &config) { void cleanup() { log_trace(">> cleanup"); - const int is_dir = -#if defined(_WIN32) || defined(_WIN64) - ERROR_ACCESS_DENIED /* Windows API is mad */; -#else - EISDIR; -#endif for (const auto &db_path : global::databases) { - int err = osal_removefile(db_path); - if (err == is_dir) { - err = osal_removefile(db_path + MDBX_LOCKNAME); - if (err == MDBX_SUCCESS || err == MDBX_ENOFILE) - err = osal_removefile(db_path + MDBX_DATANAME); - if (err == MDBX_SUCCESS || err == MDBX_ENOFILE) - err = osal_removedirectory(db_path); - } else if (err == MDBX_SUCCESS || err == MDBX_ENOFILE) - err = osal_removefile(db_path + MDBX_LOCK_SUFFIX); - - if (err != MDBX_SUCCESS && err != MDBX_ENOFILE) + int err = mdbx_env_delete(db_path.c_str(), MDBX_ENV_JUST_DELETE); + if (err != MDBX_SUCCESS && err != MDBX_RESULT_TRUE) failure_perror(db_path.c_str(), err); } log_trace("<< cleanup"); diff --git a/test/osal-unix.cc b/test/osal-unix.cc index 7e552e5c..f8b1e1b4 100644 --- a/test/osal-unix.cc +++ b/test/osal-unix.cc @@ -531,12 +531,4 @@ std::string osal_tempdir(void) { return ""; } -int osal_removefile(const std::string &pathname) { - return unlink(pathname.c_str()) ? errno : MDBX_SUCCESS; -} - -int osal_removedirectory(const std::string &pathname) { - return rmdir(pathname.c_str()) ? errno : MDBX_SUCCESS; -} - #endif /* !Windows */ diff --git a/test/osal-windows.cc b/test/osal-windows.cc index ae31919e..94508030 100644 --- a/test/osal-windows.cc +++ b/test/osal-windows.cc @@ -452,12 +452,4 @@ std::string osal_tempdir(void) { return std::string(buf, len); } -int osal_removefile(const std::string &pathname) { - return DeleteFileA(pathname.c_str()) ? MDBX_SUCCESS : GetLastError(); -} - -int osal_removedirectory(const std::string &pathname) { - return RemoveDirectoryA(pathname.c_str()) ? MDBX_SUCCESS : GetLastError(); -} - #endif /* Windows */ diff --git a/test/osal.h b/test/osal.h index 129a9f1c..4318c0eb 100644 --- a/test/osal.h +++ b/test/osal.h @@ -34,8 +34,6 @@ void osal_udelay(unsigned us); void osal_yield(void); bool osal_istty(int fd); std::string osal_tempdir(void); -int osal_removefile(const std::string &pathname); -int osal_removedirectory(const std::string &pathname); #ifdef _MSC_VER #ifndef STDIN_FILENO