1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Delete test cache before running it

This commit is contained in:
Leandro (Cerberus1746) Benedet Garcia
2025-04-27 20:02:18 -03:00
parent 1cf573f44d
commit ed35b9e181

View File

@@ -30,6 +30,8 @@
#include "test_main.h" #include "test_main.h"
#include "core/error/error_macros.h"
#include "core/io/dir_access.h"
#include "modules/modules_enabled.gen.h" #include "modules/modules_enabled.gen.h"
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
@@ -231,6 +233,15 @@ int test_main(int argc, char *argv[]) {
WorkerThreadPool::get_singleton()->init(); WorkerThreadPool::get_singleton()->init();
String test_path = OS::get_singleton()->get_cache_path().path_join("godot_test");
Ref<DirAccess> da;
if (DirAccess::exists(test_path)) {
da = DirAccess::open(test_path);
ERR_FAIL_COND_V(da.is_null(), 0);
ERR_FAIL_COND_V_MSG(da->erase_contents_recursive() != OK, 0, "Failed to delete files");
}
// Run custom test tools. // Run custom test tools.
if (test_commands) { if (test_commands) {
for (const KeyValue<String, TestFunc> &E : (*test_commands)) { for (const KeyValue<String, TestFunc> &E : (*test_commands)) {