Merge pull request #40661 from RevoluPowered/fix_argument_edit_doctest_pr

Fix godot not starting
This commit is contained in:
Rémi Verschelde 2020-07-24 16:03:05 +02:00 committed by GitHub
commit 5287124b72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -397,16 +397,17 @@ void Main::print_help(const char *p_binary) {
int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) { int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) {
#ifdef TOOLS_ENABLED // templates can't run unit test tool #ifdef TOOLS_ENABLED // templates can't run unit test tool
for (int x = 0; x < argc; x++) {
if (strncmp(argv[x], "--test", 6) == 0) {
tests_need_run = true;
OS::get_singleton()->initialize(); OS::get_singleton()->initialize();
StringName::setup(); StringName::setup();
for (int x = 0; x < argc; x++) { int status = test_main(argc, argv);
if (strncmp(argv[x], "--test", 6)) {
tests_need_run = true;
return test_main(argc, argv);
}
}
StringName::cleanup(); StringName::cleanup();
OS::get_singleton()->finalize(); // TODO: fix OS::singleton cleanup
return status;
}
}
#endif #endif
tests_need_run = false; tests_need_run = false;
return 0; return 0;
@ -1829,7 +1830,7 @@ bool Main::start() {
print_line("Generating new docs..."); print_line("Generating new docs...");
doc.save_classes(index_path, doc_data_classes); doc.save_classes(index_path, doc_data_classes);
return FAILED; return false;
} }
if (_export_preset != "") { if (_export_preset != "") {
@ -1837,7 +1838,7 @@ bool Main::start() {
String err = "Command line includes export parameter option, but no destination path was given.\n"; String err = "Command line includes export parameter option, but no destination path was given.\n";
err += "Please specify the binary's file path to export to. Aborting export."; err += "Please specify the binary's file path to export to. Aborting export.";
ERR_PRINT(err); ERR_PRINT(err);
return FAILED; return false;
} }
} }
#endif #endif
@ -1859,7 +1860,7 @@ bool Main::start() {
if (!script_res->is_valid()) { if (!script_res->is_valid()) {
OS::get_singleton()->set_exit_code(1); OS::get_singleton()->set_exit_code(1);
} }
return FAILED; return false;
} }
if (script_res->can_instance()) { if (script_res->can_instance()) {
@ -1878,7 +1879,7 @@ bool Main::start() {
script_loop->set_init_script(script_res); script_loop->set_init_script(script_res);
main_loop = script_loop; main_loop = script_loop;
} else { } else {
return FAILED; return false;
} }
} else { } else {
@ -1892,7 +1893,7 @@ bool Main::start() {
if (!main_loop) { if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) { if (!ClassDB::class_exists(main_loop_type)) {
DisplayServer::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type); DisplayServer::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
return FAILED; return false;
} else { } else {
Object *ml = ClassDB::instance(main_loop_type); Object *ml = ClassDB::instance(main_loop_type);
ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type."); ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type.");
@ -2251,7 +2252,7 @@ bool Main::start() {
OS::get_singleton()->set_main_loop(main_loop); OS::get_singleton()->set_main_loop(main_loop);
return OK; return true;
} }
/* Main iteration /* Main iteration