Clean up CMake scripts for automated tests #83222

Open
opened 2020-11-30 12:46:19 +01:00 by Sybren A. Stüvel · 5 comments

56aa5b0d8c restructured unit tests, reducing the number of test binaries and optimizing for link time. D9649: Tests: run suites instead of individual test cases changes how tests are grouped & run, optimizing for run time. These changes have caused some duplication and other smells to the CMake code related to automated tests.

After D9649 has been accepted, these need to be cleaned up.

Things to look into:

    • Which of the BLENDER_SRC_GTEST_EX, BLENDER_SRC_GTEST, BLENDER_TEST, and BLENDER_TEST_PERFORMANCE are still in use?
    • Which of the blender_add_test_executable, blender_add_test_lib, and blender_add_test_suite are still in use?
    • The GTest.cmake file contains Google Test code, modified for our use in Blender. It may be clearer if we clean it up a bit more (removing what we don't use) and put it in a Blender-specific file, rather than keeping a copied-but-modified file around.
    • There is no overview of how tests are defined, and which macros/functions are used for that.
56aa5b0d8c restructured unit tests, reducing the number of test binaries and optimizing for link time. [D9649: Tests: run suites instead of individual test cases](https://archive.blender.org/developer/D9649) changes how tests are grouped & run, optimizing for run time. These changes have caused some duplication and other smells to the CMake code related to automated tests. After [D9649](https://archive.blender.org/developer/D9649) has been accepted, these need to be cleaned up. Things to look into: - - [ ] Which of the `BLENDER_SRC_GTEST_EX`, `BLENDER_SRC_GTEST`, `BLENDER_TEST`, and `BLENDER_TEST_PERFORMANCE` are still in use? - - [ ] Which of the `blender_add_test_executable`, `blender_add_test_lib`, and `blender_add_test_suite` are still in use? - - [ ] The `GTest.cmake` file contains Google Test code, modified for our use in Blender. It may be clearer if we clean it up a bit more (removing what we don't use) and put it in a Blender-specific file, rather than keeping a copied-but-modified file around. - - [ ] There is no overview of how tests are defined, and which macros/functions are used for that.
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscribers: @dr.sybren, @LazyDodo, @Sergey

Added subscribers: @dr.sybren, @LazyDodo, @Sergey

This issue was referenced by 54f8a5dd73

This issue was referenced by 54f8a5dd737388d89332f3074eba01edc9efa8c1
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

While the other problems with gtest_add_tests are listed in detail at https://www.kitware.com/dynamic-google-test-discovery-in-cmake-3-10/, what irks me right now are these things:
1 cmake rerun after every single change in a test cpp file. The workflow of

  • change test code -> press run button -> build happens -> test runs ... loop
    has changed to
  • change test code -> press run button -> cmake rerun (this takes more time than the incremental build!) -> press run button again -> xcode processes new changes after cmake rerun (also takes time) -> build happens -> test runs ... loop.

2

Individual tests can still be run if desired by invocation of bin/tests/blender_test --gtest_filter=suitename.testname.

except one has to find *SAN_OPTIONS environment variables, arguments/flags etc (by dry run) and set them manually that code set otherwise.

Some time limitation could be overcome somewhat by running them in parallel -j2. If binary invocation is saving significant time, I assume long running tests like baking/ rendering are not running anyway.

Hierarchy/ grouping tests in targets like say bf_functions_tests problem might be solved by programmatically creating a dummy test fixture for a target. https://groups.google.com/g/googletestframework/c/FhedgGP2-Fs/m/5z10n9pDWeUJ and then using regex.

While the other problems with `gtest_add_tests` are listed in detail at https://www.kitware.com/dynamic-google-test-discovery-in-cmake-3-10/, what irks me right now are these things: 1 cmake rerun after _every single change_ in a test cpp file. The workflow of - change test code -> press run button -> build happens -> test runs ... loop has changed to - change test code -> press run button -> cmake rerun (this takes more time than the incremental build!) -> press run button again -> xcode processes new changes after cmake rerun (also takes time) -> build happens -> test runs ... loop. 2 > Individual tests can still be run if desired by invocation of bin/tests/blender_test --gtest_filter=suitename.testname. except one has to find *SAN_OPTIONS environment variables, arguments/flags etc (by dry run) and set them manually that code set otherwise. Some time limitation could be overcome somewhat by running them in parallel `-j2`. If binary invocation is saving significant time, I assume long running tests like baking/ rendering are not running anyway. Hierarchy/ grouping tests in targets like say `bf_functions_tests` problem might be solved by programmatically creating a dummy test fixture for a target. https://groups.google.com/g/googletestframework/c/FhedgGP2-Fs/m/5z10n9pDWeUJ and then using regex.
Philipp Oeser removed the
Interest
Platforms, Builds & Tests
label 2023-02-10 08:58:24 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83222
No description provided.