-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Skip test on SkipTestException at fixture's constructor #24186
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
Conversation
87fec42 to
e8bbb0c
Compare
e8bbb0c to
6d934f0
Compare
modules/core/test/test_misc.cpp
Outdated
| // Expected that SkipTestException thrown in the constructor should skip test but not fail | ||
| struct TestFixtureSkip: public ::testing::Test { | ||
| TestFixtureSkip() { | ||
| throw SkipTestException(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we cover SetUp() overload too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added overload for SetUp and some workaround for a static method SetUpTestCase
modules/core/test/test_misc.cpp
Outdated
| #endif | ||
|
|
||
| #ifdef _MSC_VER | ||
| # pragma warning(disable:4702) // unreachable code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this with FAIL()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to keep it to verify that test body won't start in case of skip exception in the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to disable this warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only on windows there is a warning: https://pullrequest.opencv.org/buildbot/builders/precommit_windows64/builds/102522. And it points to line in the constructor, not test body: 6d934f0#diff-4a53133499f4421656d6e02cc691c986d7ac26c94235f7480d81c156aebdab07R924
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is dangerous to disable this warning for whole file.
Please try to disable it locally through warning push/pop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CV_NORETURN solved this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is warning on MSVS 2019: https://pullrequest.opencv.org/buildbot/builders/precommit_opencl/builds/100186
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added if condition to avoid warnings.
opencv-alalek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! Thank you 👍
Thanks for review! |
|
@dkurt @opencv-alalek The PR breaks "skip" in OpenCV test system at least for DNN. Subset of log after the patch: All further tests are marked as skipped and even test body is not called. Focused test invocation works correctly. |
|
@asmorkalov, may I ask to revert? |
|
Yes, I'll revert the PR in several minutes. |
Skip test on SkipTestException at fixture's constructor (version 2) #24250 ### Pull Request Readiness Checklist Another version of #24186 (reverted by #24223). Current implementation cannot handle skip exception at `static void SetUpTestCase` but works on `virtual void SetUp`. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Skip test on SkipTestException at fixture's constructor * Skip test on SkipTestException at fixture's constructor * Add warning supression * Skip Python tests if no test file found * Skip instances of test fixture with exception at SetUpTestCase * Skip test with exception at SetUp method * Try remove warning disable * Add CV_NORETURN * Remove FAIL assertion * Use findDataFile to throw Skip exception * Throw exception conditionally
Skip test on SkipTestException at fixture's constructor (version 2) opencv#24250 ### Pull Request Readiness Checklist Another version of opencv#24186 (reverted by opencv#24223). Current implementation cannot handle skip exception at `static void SetUpTestCase` but works on `virtual void SetUp`. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Skip test on SkipTestException at fixture's constructor * Skip test on SkipTestException at fixture's constructor * Add warning supression * Skip Python tests if no test file found * Skip instances of test fixture with exception at SetUpTestCase * Skip test with exception at SetUp method * Try remove warning disable * Add CV_NORETURN * Remove FAIL assertion * Use findDataFile to throw Skip exception * Throw exception conditionally
Skip test on SkipTestException at fixture's constructor (version 2) opencv#24250 ### Pull Request Readiness Checklist Another version of opencv#24186 (reverted by opencv#24223). Current implementation cannot handle skip exception at `static void SetUpTestCase` but works on `virtual void SetUp`. See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Pull Request Readiness Checklist
In case of
SkipTestExceptionthrows in the fixture's constructor, test should be skipped. Reproducer added tocoremodule tests.related: #24157
related: opencv/ci-gha-workflow#109
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.