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

Unify and simplify c++ tests #488

Merged
merged 2 commits into from
Oct 6, 2023
Merged

Unify and simplify c++ tests #488

merged 2 commits into from
Oct 6, 2023

Conversation

mattelser
Copy link
Contributor

Fixes #486 Fixes #487

We currently have c++ tests separate from the tests extension. These tests were built first and had a straightforward doctest setup since they didn't have any dependencies on Omniverse. In building the tests extension, I tried this straightforward approach and ran into problems*, so I opted to use doctest's CHECKs in a standalone configuration. This didn't buy us nearly as much functionality, so I tried the straightforward approach again when merging the old tests into the new extension. This time it came together, which simplifies the testing setup, puts it more in line with a standard doctest approach, and provides more functionality! 🎉

*I was unable to create a test suite/case because I was trying to do so within the interface object used in the python bindings, which was an illegal attempt to statically define a function within a method (or something like that). I tried defining the function outside the object, but ran into similar trouble. For one reason or another I stopped short of the proper solution, which this PR contains.

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

Very nice, great to see the doctest results again

[doctest] doctest version is "2.4.9"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases:   11 |   11 passed | 0 failed | 0 skipped
[doctest] assertions: 1278 | 1278 passed | 0 failed |
[doctest] Status: SUCCESS!

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this file got accidentally checked in. Could you remove it and update .gitignore with the updated path?

@@ -325,7 +324,7 @@ if(CESIUM_OMNI_ENABLE_COVERAGE)
-DPROJECT_BUILD_DIRECTORY=${PROJECT_BINARY_DIR}
-DPROJECT_SOURCE_DIRECTORIES=${COVERAGE_SOURCE_DIRECTORIES_FORMATTED}
-DOUTPUT_DIRECTORY=${PROJECT_BINARY_DIR}/coverage -P ${PROJECT_SOURCE_DIR}/cmake/GenerateCoverage.cmake
DEPENDS $<TARGET_FILE:tests>
DEPENDS $<TARGET_FILE:cesium.omniverse.cpp.tests.plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be surprised if this alone fixes coverage, but maybe worth running coverage just to check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

confirmed it doesn't magically fix coverage (it finds no tests), but I figured it was worth updating since there is no longer a tests binary

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove this section from main.yml

      - name: Tests
        if: matrix.config.name != 'CentOS 7 - GCC'
        run: ctest --test-dir build --output-on-failure

Understandably, right now it's printing:

Run ctest --test-dir build --output-on-failure
Internal ctest changing into directory: C:/a/cesium-omniverse/cesium-omniverse/build
Test project C:/a/cesium-omniverse/cesium-omniverse/build
No tests were found!!!

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also remove the "Test" task in task.json and the associated testing code in vscode_build.py, and the documentation about that in developer-setup/README.md?

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rename tests/public to tests/src?

The reason for separating the main extension code into bindings, core, plugins, and public was because each represented its own library. But since the test code is a single library it makes sense to go with a more generic folder name like src.

Copy link
Contributor

Choose a reason for hiding this comment

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

It could make sense to move testUtils.h.in to the include folder since that's where testUtils.h will get created

Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to mention this in the other PR, but in the launch.json files could you move the Tests Extension configuration either after or before the python configurations? That way it isn't sandwiched between them awkwardly.

@mattelser mattelser enabled auto-merge (squash) October 6, 2023 15:33
Comment on lines +1 to +6
include(Macros)

glob_files(SOURCES "${CMAKE_CURRENT_LIST_DIR}/*.cpp")

get_property(ADDITIONAL_LIBRARIES GLOBAL PROPERTY NVIDIA_ADDITIONAL_LIBRARIES_PROPERTY)

Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to remove these lines

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

Just one small comment. Feel to free to merge after that's addressed.

@mattelser mattelser merged commit 102f67d into main Oct 6, 2023
@mattelser mattelser deleted the unifyCppTests branch October 6, 2023 15:54
@lilleyse
Copy link
Contributor

lilleyse commented Oct 6, 2023

Right... automerge kicked in since I approved... could you open up a follow up PR for #488 (review)?

@mattelser
Copy link
Contributor Author

@lilleyse, #490

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

Successfully merging this pull request may close these issues.

Improve logging output from tests extension Unify C++ tests
2 participants