Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
江流儿的夏天
opencv
提交
cca4ee2e
O
opencv
项目概览
江流儿的夏天
/
opencv
与 Fork 源项目一致
Fork自
OpenCV / opencv
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
cca4ee2e
编写于
9月 05, 2023
作者:
A
Alexander Smorkalov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert PR 24186 as it force skip tests.
上级
21fb10c6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
85 deletion
+8
-85
modules/core/test/test_misc.cpp
modules/core/test/test_misc.cpp
+0
-36
modules/python/test/tests_common.py
modules/python/test/tests_common.py
+0
-2
modules/ts/include/opencv2/ts/ts_ext.hpp
modules/ts/include/opencv2/ts/ts_ext.hpp
+4
-38
modules/ts/src/ts_tags.cpp
modules/ts/src/ts_tags.cpp
+4
-9
未找到文件。
modules/core/test/test_misc.cpp
浏览文件 @
cca4ee2e
...
...
@@ -917,41 +917,5 @@ REGISTER_TYPED_TEST_CASE_P(Rect_Test, Overflows);
typedef
::
testing
::
Types
<
int
,
float
,
double
>
RectTypes
;
INSTANTIATE_TYPED_TEST_CASE_P
(
Negative_Test
,
Rect_Test
,
RectTypes
);
// Expected that SkipTestException thrown in the constructor should skip test but not fail
struct
TestFixtureSkip
:
public
::
testing
::
Test
{
TestFixtureSkip
(
bool
throwEx
=
true
)
{
if
(
throwEx
)
{
throw
SkipTestException
(
"Skip test at constructor"
);
}
}
};
TEST_F
(
TestFixtureSkip
,
NoBodyRun
)
{
FAIL
()
<<
"Unreachable code called"
;
}
// Check no test body started in case of skip exception at static SetUpTestCase
struct
TestSetUpTestCaseSkip
:
public
::
testing
::
Test
{
static
void
SetUpTestCase
()
{
throw
SkipTestException
(
"Skip test at SetUpTestCase"
);
}
};
TEST_F
(
TestSetUpTestCaseSkip
,
NoBodyRun
)
{
FAIL
()
<<
"Unreachable code called"
;
}
TEST_F
(
TestSetUpTestCaseSkip
,
NoBodyRun2
)
{
FAIL
()
<<
"Unreachable code called"
;
}
struct
TestSetUpSkip
:
public
::
testing
::
Test
{
virtual
void
SetUp
()
{
throw
SkipTestException
(
"Skip test at SetUp"
);
}
};
TEST_F
(
TestSetUpSkip
,
NoBodyRun
)
{
FAIL
()
<<
"Unreachable code called"
;
}
}}
// namespace
modules/python/test/tests_common.py
浏览文件 @
cca4ee2e
...
...
@@ -36,8 +36,6 @@ class NewOpenCVTests(unittest.TestCase):
return
candidate
if
required
:
self
.
fail
(
'File '
+
filename
+
' not found'
)
else
:
self
.
skipTest
(
'File '
+
filename
+
' not found'
)
return
None
...
...
modules/ts/include/opencv2/ts/ts_ext.hpp
浏览文件 @
cca4ee2e
...
...
@@ -47,18 +47,6 @@ bool checkBigDataTests();
} \
} \
#define CV__TEST_SETUP_IMPL(parent_class) \
{ \
try { \
parent_class::SetUp(); \
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
printf("[ SKIP ] %s\n", e.what()); \
} \
}
struct
DummyTest
:
public
::
testing
::
Test
{
virtual
void
TestBody
()
CV_OVERRIDE
{}
};
#undef TEST
#define TEST_(test_case_name, test_name, parent_class, bodyMethodName, BODY_ATTR, BODY_IMPL) \
...
...
@@ -72,17 +60,6 @@ struct DummyTest : public ::testing::Test {
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
};\
class test_case_name##test_name##_factory : public ::testing::internal::TestFactoryBase { \
public:\
virtual ::testing::Test* CreateTest() { \
try { \
return new GTEST_TEST_CLASS_NAME_(test_case_name, test_name); \
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
printf("[ SKIP ] %s\n", e.what()); \
return new DummyTest(); \
} \
} \
};\
\
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
::test_info_ =\
...
...
@@ -92,7 +69,8 @@ struct DummyTest : public ::testing::Test {
(::testing::internal::GetTestTypeId()), \
parent_class::SetUpTestCase, \
parent_class::TearDownTestCase, \
new test_case_name##test_name##_factory);\
new ::testing::internal::TestFactoryImpl<\
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody() BODY_IMPL( #test_case_name "_" #test_name ) \
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::bodyMethodName()
...
...
@@ -131,22 +109,10 @@ struct DummyTest : public ::testing::Test {
private:\
virtual void TestBody() CV_OVERRIDE;\
virtual void Body(); \
virtual void SetUp() CV_OVERRIDE; \
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_;\
GTEST_DISALLOW_COPY_AND_ASSIGN_(\
GTEST_TEST_CLASS_NAME_(test_fixture, test_name));\
};\
class test_fixture##test_name##_factory : public ::testing::internal::TestFactoryBase { \
public:\
virtual ::testing::Test* CreateTest() { \
try { \
return new GTEST_TEST_CLASS_NAME_(test_fixture, test_name); \
} catch (const cvtest::details::SkipTestExceptionBase& e) { \
printf("[ SKIP ] %s\n", e.what()); \
return new DummyTest(); \
} \
} \
};\
\
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_fixture, test_name)\
::test_info_ =\
...
...
@@ -156,9 +122,9 @@ struct DummyTest : public ::testing::Test {
(::testing::internal::GetTypeId<test_fixture>()), \
test_fixture::SetUpTestCase, \
test_fixture::TearDownTestCase, \
new test_fixture##test_name##_factory);\
new ::testing::internal::TestFactoryImpl<\
GTEST_TEST_CLASS_NAME_(test_fixture, test_name)>);\
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::TestBody() CV__TEST_BODY_IMPL( #test_fixture "_" #test_name ) \
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::SetUp() CV__TEST_SETUP_IMPL(test_fixture) \
void GTEST_TEST_CLASS_NAME_(test_fixture, test_name)::Body()
// Don't use directly
...
...
modules/ts/src/ts_tags.cpp
浏览文件 @
cca4ee2e
...
...
@@ -11,7 +11,7 @@ namespace cvtest {
static
bool
printTestTag
=
false
;
static
std
::
vector
<
std
::
string
>
currentDirectTestTags
,
currentImpliedTestTags
;
static
std
::
vector
<
const
::
testing
::
Test
Case
*>
skipped_tests
;
static
std
::
vector
<
const
::
testing
::
Test
Info
*>
skipped_tests
;
static
std
::
map
<
std
::
string
,
int
>&
getTestTagsSkipCounts
()
{
...
...
@@ -26,7 +26,7 @@ static std::map<std::string, int>& getTestTagsSkipExtraCounts()
void
testTagIncreaseSkipCount
(
const
std
::
string
&
tag
,
bool
isMain
,
bool
appendSkipTests
)
{
if
(
appendSkipTests
)
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
case
());
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
info
());
std
::
map
<
std
::
string
,
int
>&
counts
=
isMain
?
getTestTagsSkipCounts
()
:
getTestTagsSkipExtraCounts
();
std
::
map
<
std
::
string
,
int
>::
iterator
i
=
counts
.
find
(
tag
);
if
(
i
==
counts
.
end
())
...
...
@@ -280,11 +280,6 @@ static bool isTestTagSkipped(const std::string& testTag, CV_OUT std::string& ski
void
checkTestTags
()
{
if
(
std
::
find
(
skipped_tests
.
begin
(),
skipped_tests
.
end
(),
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_case
())
!=
skipped_tests
.
end
())
{
throw
details
::
SkipTestExceptionBase
(
false
);
}
std
::
string
skipTag
;
const
std
::
vector
<
std
::
string
>&
testTags
=
currentDirectTestTags
;
{
...
...
@@ -312,7 +307,7 @@ void checkTestTags()
}
if
(
found
!=
tags
.
size
())
{
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
case
());
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
info
());
throw
details
::
SkipTestExceptionBase
(
"Test tags don't pass required tags list (--test_tag parameter)"
,
true
);
}
}
...
...
@@ -346,7 +341,7 @@ void checkTestTags()
if
(
!
skip_message
.
empty
())
{
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
case
());
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_
info
());
throw
details
::
SkipTestExceptionBase
(
skip_message
,
true
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录