Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit with an error if using --test on binary without unit tests compiled #90507

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Apr 10, 2024

This makes it clearer that tests=yes should be used at compile-time. Previously, the engine would run as if the argument wasn't passed, which can be confusing.

I've tested behavior with and without tests and it works as expected – --test is blocked, --testsomething or -test are not.

Preview

$ bin/godot.linuxbsd.editor.x86_64 --test          
ERROR: `--test` was specified on the command line, but this Godot binary was compiled without support for unit tests. Aborting.
To be able to run unit tests, use the `tests=yes` SCons option when compiling Godot.

   at: test_entrypoint (main/main.cpp:852)

…piled

This makes it clearer that `tests=yes` should be used at compile-time.
Previously, the engine would run as if the argument wasn't passed,
which can be confusing.
@Calinou Calinou added this to the 4.x milestone Apr 10, 2024
@Calinou Calinou requested a review from a team as a code owner April 10, 2024 22:09
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Apr 11, 2024
@akien-mga
Copy link
Member

Another option would be to make TEST_MAIN_OVERRIDE and TEST_MAIN_PARAM_OVERRIDE no-ops when TESTS_ENABLED is off. Maybe a bit cleaner?

@Calinou
Copy link
Member Author

Calinou commented Apr 11, 2024

Another option would be to make TEST_MAIN_OVERRIDE and TEST_MAIN_PARAM_OVERRIDE no-ops when TESTS_ENABLED is off. Maybe a bit cleaner?

I've pushed a second commit that attempts this, but it doesn't seem to work when I use --test when tests are enabled (the argument is ignored). The error does work when tests are disabled though.

@akien-mga
Copy link
Member

I guess let's stick to the original commit if the other approach doesn't seem to work. It's less code too.

@Calinou Calinou force-pushed the tests-disabled-error-on-test-cli-argument branch from 2ada12b to 7467ce6 Compare April 17, 2024 18:43
@Calinou
Copy link
Member Author

Calinou commented Apr 17, 2024

I guess let's stick to the original commit if the other approach doesn't seem to work. It's less code too.

Done; I've removed the second commit.

@akien-mga akien-mga merged commit 35369b8 into godotengine:master Apr 18, 2024
32 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants