-
Notifications
You must be signed in to change notification settings - Fork 672
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
Split tests into multiple executables #3998
base: main
Are you sure you want to change the base?
Conversation
Split test executables into: - multipass_tests (main test suite) - multipass_daemon_tests (daemon-specific tests) Moved daemon_test_fixture.cpp to common sources since it's needed by both executables. Moved test files that depend on DaemonTestFixture to the daemon test executable to resolve linking issues.
Split out SSH-related tests into new multipass_ssh_tests executable: - test_sftp*.cpp - test_ssh*.cpp - test_sshfs*.cpp Added all necessary configuration to match other executables: - Compiler flags and defines - Include directories - Library dependencies - Platform configuration - Mock process dependency
Added new multipass_memory_tests executable for memory-size tests: - Created MEMORY_TEST_SOURCES group - Added multipass_memory_tests executable with test_memory_size.cpp - Added all necessary build configurations and dependencies - Removed test_memory_size.cpp from main test executable
Added new multipass_formatter_tests executable: - Created FORMATTER_TEST_SOURCES group for formatter-related tests - Added test_format_utils.cpp and test_output_formatter.cpp - Added all necessary build configurations and dependencies - Removed formatter tests from main test executable
f63b02f
to
bbb52e5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3998 +/- ##
=======================================
Coverage 89.27% 89.27%
=======================================
Files 259 259
Lines 14653 14653
=======================================
Hits 13081 13081
Misses 1572 1572 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @levkropp, that's looking great! I just have one topic to discuss while we're at it. The different categories are already better than what we have; shall we go another step further and make each test source a separate executable? This way, each of the test suites is isolated at the process level, and we can also parallelize their execution if we want to. Also, we can have better control over what each test suite depends on. ctest is capable of curating tests from different executables, so the number of executables won't matter. It's designed to work in this way anyway. @ricab @georgeliao opinions? |
I don't know, I fear that total link time may grow too much when changing something that affects many tests. I believe linking is where most time is spent when developing, more than test execution. With N executables we'll probably end up paying with link time when changing something that lots of code depends on (say utils), because we now have to link in N executables. But we gain when iterating on tests or higher level stuff, because they would affect a smaller executable. And linking smaller executables totalling M bytes is probably faster than linking the same M bytes in a single executable. I suspect there is a sweet spot somewhere. Ideally we'd be able to make a graph of total link time when changing different parts of the code and chose the configuration that minimizes that. In practice, we could shoot a little lower and try a few configurations to compare. Another option could be to try to move things from static to dynamic libraries... I would take any improvement we can get. |
This pull request reorganizes the test suite in the
tests/CMakeLists.txt
file by splitting the tests into multiple categories and creating separate executables for each category.Before:
multipass_tests
= 3857 tests from 233 test suites ran. (42261 ms total)Now:
multipass_tests
= 1312 tests from 111 test suites ran. (12894 ms total)multipass_client_ssh_tests
= 820 tests from 56 test suites ran. (20483 ms total)multipass_daemon_tests
= 322 tests from 30 test suites ran. (2441 ms total)multipass_formatter_tests
= 373 tests from 9 test suites ran. (120 ms total)multipass_memory_tests
= 823 tests from 4 test suites ran. (36 ms total)multipass_network_tests
= 89 tests from 8 test suites ran. (2622 ms total)multipass_qemu_tests
= 131 tests from 16 test suites ran. (2271 ms total)Reorganization of test suite:
add_executable
commands to create distinct test executables for each category.add_test
commands to include the new test executables, enabling them to be run as part of the test suite.