diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-18 12:24:24 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-18 12:24:24 +0200 |
commit | 35369b8d280d6f7b588d1b3758fb1becf0577d2c (patch) | |
tree | 9b455e2f7835c2fb620bb06683b20d6ab9197099 /main | |
parent | 0dfb48e58dc002f2ad90773dcafb74e3ed075a6a (diff) | |
parent | 7467ce6405167b16d9e6d6505a409cc67e88d309 (diff) | |
download | redot-engine-35369b8d280d6f7b588d1b3758fb1becf0577d2c.tar.gz |
Merge pull request #90507 from Calinou/tests-disabled-error-on-test-cli-argument
Exit with an error if using `--test` on binary without unit tests compiled
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/main.cpp b/main/main.cpp index ed74094c9e..801e8934b0 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -842,21 +842,26 @@ void Main::test_cleanup() { #endif int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) { -#ifdef TESTS_ENABLED for (int x = 0; x < argc; x++) { if ((strncmp(argv[x], "--test", 6) == 0) && (strlen(argv[x]) == 6)) { tests_need_run = true; +#ifdef TESTS_ENABLED // TODO: need to come up with different test contexts. // Not every test requires high-level functionality like `ClassDB`. test_setup(); int status = test_main(argc, argv); test_cleanup(); return status; +#else + ERR_PRINT( + "`--test` was specified on the command line, but this Godot binary was compiled without support for unit tests. Aborting.\n" + "To be able to run unit tests, use the `tests=yes` SCons option when compiling Godot.\n"); + return EXIT_FAILURE; +#endif } } -#endif tests_need_run = false; - return 0; + return EXIT_SUCCESS; } /* Engine initialization |