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

Merge pull request #105848 from leandro-benedet-garcia/delete_cache

Delete test cache before running it
This commit is contained in:
Thaddeus Crews
2025-05-15 10:22:21 -05:00

View File

@@ -30,6 +30,8 @@
#include "test_main.h"
#include "core/error/error_macros.h"
#include "core/io/dir_access.h"
#include "modules/modules_enabled.gen.h"
#ifdef TOOLS_ENABLED
@@ -232,6 +234,15 @@ int test_main(int argc, char *argv[]) {
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.
if (test_commands) {
for (const KeyValue<String, TestFunc> &E : (*test_commands)) {