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

USD component: handle early exits in unit tests #16

Open
adlarkin opened this issue Jan 20, 2022 · 0 comments
Open

USD component: handle early exits in unit tests #16

adlarkin opened this issue Jan 20, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@adlarkin
Copy link

Description

gazebosim/sdformat#796 (review) points out that USD has a known bug (PixarAnimationStudios/OpenUSD#86) where fatal errors do not abort cleanly. This could be an issue in unit tests if an error occurs mid-test from something like trying to access an invalid stage - USD will "gracefully exit" without signifying that the stage was invalid, which could give a false positive of tests succeeding.

Steps to reproduce

The following program can be tested (you need to install USD). You'll notice that the program exits cleanly (exit code 0 instead of 1) without throwing an error:

#include <pxr/usd/usd/stage.h>

int main(int argc, char **argv) {
  pxr::UsdStageRefPtr stage;
  stage->Save(); // try to dereference invalid pointer
  throw std::runtime_error("bad stage reference occurred");
  return 1;
}

It should be worth knowing that in the unit tests that are being written for the USD component, we are not intentionally doing things like trying to dereference an invalid stage pointer. However, in order to protect ourselves from bad exits we are unaware of and false positive test results, we should address this issue to make sure that all unit tests run to completion. gazebosim/sdformat#796 (review) lists a few ideas for solving this, and in particular, I think the third idea given could work: "make a custom test runner which either captures and check stdout of the tests, or have each test write some artifacts and have the runner check them at the end."

@adlarkin adlarkin added the bug Something isn't working label Jan 20, 2022
@azeey azeey transferred this issue from gazebosim/sdformat Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant