summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-07-25 16:59:30 +0300
committerAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-07-25 18:44:18 +0300
commitf6465f46b4c172cb40e16676dfb0ef09374a7b9c (patch)
tree5572d677bbc82fbe06dd3ef614445aaf005c6d36 /main
parent5f75cec59e004b5ff0fefdb326f987409b7d7e89 (diff)
SCons: Add `tests` option to enable or disable unit tests
Diffstat (limited to 'main')
-rw-r--r--main/SCsub2
-rw-r--r--main/main.cpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/main/SCsub b/main/SCsub
index bf188d7328..793e5ed827 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -20,7 +20,7 @@ env.CommandNoCache(
env.Depends("#main/app_icon.gen.h", "#main/app_icon.png")
env.CommandNoCache("#main/app_icon.gen.h", "#main/app_icon.png", run_in_subprocess(main_builders.make_app_icon))
-if env["tools"]:
+if env["tests"]:
SConscript("tests/SCsub")
lib = env.add_library("main", env.main_sources)
diff --git a/main/main.cpp b/main/main.cpp
index 35aa99c720..60abed7b0b 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -55,7 +55,6 @@
#include "main/performance.h"
#include "main/splash.gen.h"
#include "main/splash_editor.gen.h"
-#include "main/tests/test_main.h"
#include "modules/modules_enabled.gen.h"
#include "modules/register_module_types.h"
#include "platform/register_platform_apis.h"
@@ -75,6 +74,10 @@
#include "servers/rendering/rendering_server_wrap_mt.h"
#include "servers/xr_server.h"
+#ifdef TESTS_ENABLED
+#include "main/tests/test_main.h"
+#endif
+
#ifdef TOOLS_ENABLED
#include "editor/doc_data.h"
@@ -383,6 +386,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(
" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
+#ifdef TESTS_ENABLED
OS::get_singleton()->print(" --test <test> Run a unit test [");
const char **test_names = tests_get_names();
const char *comma = "";
@@ -393,10 +397,12 @@ void Main::print_help(const char *p_binary) {
}
OS::get_singleton()->print("].\n");
#endif
+ OS::get_singleton()->print("\n");
+#endif
}
int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) {
-#ifdef TOOLS_ENABLED // templates can't run unit test tool
+#ifdef TESTS_ENABLED
for (int x = 0; x < argc; x++) {
if (strncmp(argv[x], "--test", 6) == 0) {
tests_need_run = true;