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

[Tests] Fix unit tests in template builds #93745

Merged
merged 1 commit into from
Jun 29, 2024

Conversation

AThousandShips
Copy link
Member

These tests fail on template builds because they are editor only, tests now run correctly (at least on Windows, can't verify on other platforms)

@AThousandShips AThousandShips added this to the 4.3 milestone Jun 29, 2024
@AThousandShips AThousandShips requested a review from a team as a code owner June 29, 2024 15:45
@akien-mga
Copy link
Member

Seems fine, but what functionality do those tests use that make them editor-only?

@AThousandShips
Copy link
Member Author

AThousandShips commented Jun 29, 2024

Packed scene instancing with edit mode:

_TestInstancePlaceholderNode *internal_created = Object::cast_to<_TestInstancePlaceholderNode>(internal_scene_loaded->instantiate(PackedScene::GEN_EDIT_STATE_MAIN_INHERITED));

@AThousandShips
Copy link
Member Author

AThousandShips commented Jun 29, 2024

Would be nice to be able to run template based unit tests in CI but we'd have to build debug templates as well, will test if it would make sense to run tests in release templates and check them though

If we are interested in making the tests run on release as well that is, they currently are not able to run fully at least

@AThousandShips AThousandShips marked this pull request as draft June 29, 2024 16:08
@AThousandShips
Copy link
Member Author

Will fix some things in the unit tests for release as well just for completeness, unless that grows into a lot of cases

@AThousandShips AThousandShips marked this pull request as ready for review June 29, 2024 16:27
@@ -163,12 +163,14 @@ TEST_CASE("[OS] Processor count and memory information") {
CHECK_MESSAGE(
OS::get_singleton()->get_processor_count() >= 1,
"The returned processor count should be greater than zero.");
#ifdef DEBUG_ENABLED
Copy link
Member Author

@AThousandShips AThousandShips Jun 29, 2024

Choose a reason for hiding this comment

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

These don't return anything valid on non-debug builds. I could swap to check that they return 0 but don't think that's necessary

@AThousandShips
Copy link
Member Author

Now release builds also won't fail (though there are some errors printed that I'll investigate later)

@akien-mga akien-mga merged commit 2f7973f into godotengine:master Jun 29, 2024
18 checks passed
@AThousandShips AThousandShips deleted the test_template_fix branch June 29, 2024 18:06
@akien-mga
Copy link
Member

Thanks!

@AThousandShips
Copy link
Member Author

Thank you!

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.

2 participants