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

Add an option to disable unittest build, & disable them on Docker build #9677

Merged
merged 1 commit into from
Apr 16, 2020

Conversation

nerzhul
Copy link
Member

@nerzhul nerzhul commented Apr 15, 2020

All is in the title.
It's not always useful to build unittests, especially on the docker build and on release builds (maybe).
Add a switch for that

To do

This PR is Ready for Review.

How to test

build the project with -DBUILD_UNITTESTS=0 and see that the unittest flag disappear from our command line

@nerzhul nerzhul added @ Build CMake, build scripts, official builds, compiler and linker errors @ Unit Test labels Apr 15, 2020
@SmallJoker
Copy link
Member

SmallJoker commented Apr 15, 2020

Opting out unittests for faster compiling and lighter binaries. I get the idea, but IMO those tests can also be used as basic sanity checks which should be possible to run at all times when in doubt.

As long the unittests are compiled into Minetest by default for all configurations, I might accept this proposal if you'd add an user feedback like so:

	// Run unit tests
	if (cmd_args.getFlag("run-unittests")) {
#if BUILD_UNITTESTS
		return run_tests();
#else
		errorstream << "Unittests are not compiled into this binary."
			<< " Set the CMake parameter BUILD_UNITTESTS=1" << std::endl;
		return 1;
#endif
	}

@sfan5
Copy link
Member

sfan5 commented Apr 15, 2020

Well there are certain platforms where you can't even run unittests, Android is one of them and also currently builds without them.

@nerzhul
Copy link
Member Author

nerzhul commented Apr 15, 2020

docker build has no interest to contain the unittest, it's a base image you just run. I don't see the point to add a command line option saying hey compile with unittests if you want to run it, unittests are for devel purposes

@nerzhul
Copy link
Member Author

nerzhul commented Apr 16, 2020

are we fine ?

@nerzhul nerzhul force-pushed the feature/unittests_option branch 2 times, most recently from 4215302 to 686c95b Compare April 16, 2020 17:28
@nerzhul
Copy link
Member Author

nerzhul commented Apr 16, 2020

PR has been updated to:

  • show an error message and keep the flag
  • disable client unittests too (forgotten in first version)

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nerzhul nerzhul merged commit 7539267 into minetest:master Apr 16, 2020
@nerzhul nerzhul deleted the feature/unittests_option branch April 16, 2020 18:43
aldum pushed a commit to banyamesterseg/minetest that referenced this pull request Apr 16, 2020
nerzhul added a commit to nerzhul/minetest that referenced this pull request Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Build CMake, build scripts, official builds, compiler and linker errors One approval ✅ ◻️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants