Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
873250f5
Commit
873250f5
authored
Nov 27, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15998 from alalek:ts_count_skip_exception
parents
6c37e10c
5639f5a2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
20 deletions
+63
-20
ts.hpp
modules/ts/include/opencv2/ts.hpp
+12
-3
ts_ext.hpp
modules/ts/include/opencv2/ts/ts_ext.hpp
+6
-4
ts_perf.hpp
modules/ts/include/opencv2/ts/ts_perf.hpp
+2
-2
ts.cpp
modules/ts/src/ts.cpp
+25
-0
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+4
-4
ts_tags.cpp
modules/ts/src/ts_tags.cpp
+12
-7
ts_tags.hpp
modules/ts/src/ts_tags.hpp
+2
-0
No files found.
modules/ts/include/opencv2/ts.hpp
View file @
873250f5
...
@@ -180,12 +180,21 @@ using testing::tuple_size;
...
@@ -180,12 +180,21 @@ using testing::tuple_size;
using
testing
::
tuple_element
;
using
testing
::
tuple_element
;
class
SkipTestException
:
public
cv
::
Exception
namespace
details
{
class
SkipTestExceptionBase
:
public
cv
::
Exception
{
public
:
SkipTestExceptionBase
(
bool
handlingTags
);
SkipTestExceptionBase
(
const
cv
::
String
&
message
,
bool
handlingTags
);
};
}
class
SkipTestException
:
public
details
::
SkipTestExceptionBase
{
{
public
:
public
:
int
dummy
;
// workaround for MacOSX Xcode 7.3 bug (don't make class "empty")
int
dummy
;
// workaround for MacOSX Xcode 7.3 bug (don't make class "empty")
SkipTestException
()
:
dummy
(
0
)
{}
SkipTestException
()
:
d
etails
::
SkipTestExceptionBase
(
false
),
d
ummy
(
0
)
{}
SkipTestException
(
const
cv
::
String
&
message
)
:
d
ummy
(
0
)
{
this
->
msg
=
message
;
}
SkipTestException
(
const
cv
::
String
&
message
)
:
d
etails
::
SkipTestExceptionBase
(
message
,
false
),
dummy
(
0
)
{
}
};
};
/** Apply tag to the current test
/** Apply tag to the current test
...
...
modules/ts/include/opencv2/ts/ts_ext.hpp
View file @
873250f5
...
@@ -16,6 +16,9 @@ extern int testThreads;
...
@@ -16,6 +16,9 @@ extern int testThreads;
void
testSetUp
();
void
testSetUp
();
void
testTearDown
();
void
testTearDown
();
bool
checkBigDataTests
();
}
}
// check for required "opencv_test" namespace
// check for required "opencv_test" namespace
...
@@ -37,7 +40,7 @@ void testTearDown();
...
@@ -37,7 +40,7 @@ void testTearDown();
Body(); \
Body(); \
CV__TEST_CLEANUP \
CV__TEST_CLEANUP \
} \
} \
catch (const cvtest::
SkipTestException
& e) \
catch (const cvtest::
details::SkipTestExceptionBase
& e) \
{ \
{ \
printf("[ SKIP ] %s\n", e.what()); \
printf("[ SKIP ] %s\n", e.what()); \
} \
} \
...
@@ -74,9 +77,8 @@ void testTearDown();
...
@@ -74,9 +77,8 @@ void testTearDown();
#define CV__TEST_BIGDATA_BODY_IMPL(name) \
#define CV__TEST_BIGDATA_BODY_IMPL(name) \
{ \
{ \
if (!cvtest::
runBigDataTests
) \
if (!cvtest::
checkBigDataTests()
) \
{ \
{ \
printf("[ SKIP ] BigData tests are disabled\n"); \
return; \
return; \
} \
} \
CV__TRACE_APP_FUNCTION_NAME(name); \
CV__TRACE_APP_FUNCTION_NAME(name); \
...
@@ -85,7 +87,7 @@ void testTearDown();
...
@@ -85,7 +87,7 @@ void testTearDown();
Body(); \
Body(); \
CV__TEST_CLEANUP \
CV__TEST_CLEANUP \
} \
} \
catch (const cvtest::
SkipTestException
& e) \
catch (const cvtest::
details::SkipTestExceptionBase
& e) \
{ \
{ \
printf("[ SKIP ] %s\n", e.what()); \
printf("[ SKIP ] %s\n", e.what()); \
} \
} \
...
...
modules/ts/include/opencv2/ts/ts_perf.hpp
View file @
873250f5
...
@@ -386,7 +386,7 @@ public:
...
@@ -386,7 +386,7 @@ public:
static
enum
PERF_STRATEGY
getCurrentModulePerformanceStrategy
();
static
enum
PERF_STRATEGY
getCurrentModulePerformanceStrategy
();
static
enum
PERF_STRATEGY
setModulePerformanceStrategy
(
enum
PERF_STRATEGY
strategy
);
static
enum
PERF_STRATEGY
setModulePerformanceStrategy
(
enum
PERF_STRATEGY
strategy
);
class
PerfSkipTestException
:
public
cv
::
Exception
class
PerfSkipTestException
:
public
cv
test
::
SkipTest
Exception
{
{
public
:
public
:
int
dummy
;
// workaround for MacOSX Xcode 7.3 bug (don't make class "empty")
int
dummy
;
// workaround for MacOSX Xcode 7.3 bug (don't make class "empty")
...
@@ -531,7 +531,7 @@ void PrintTo(const Size& sz, ::std::ostream* os);
...
@@ -531,7 +531,7 @@ void PrintTo(const Size& sz, ::std::ostream* os);
::cvtest::testSetUp(); \
::cvtest::testSetUp(); \
RunPerfTestBody(); \
RunPerfTestBody(); \
} \
} \
catch (cvtest::
SkipTestException
& e) \
catch (cvtest::
details::SkipTestExceptionBase
& e) \
{ \
{ \
printf("[ SKIP ] %s\n", e.what()); \
printf("[ SKIP ] %s\n", e.what()); \
} \
} \
...
...
modules/ts/src/ts.cpp
View file @
873250f5
...
@@ -125,6 +125,20 @@ bool required_opencv_test_namespace = false; // compilation check for non-refac
...
@@ -125,6 +125,20 @@ bool required_opencv_test_namespace = false; // compilation check for non-refac
namespace
cvtest
namespace
cvtest
{
{
details
::
SkipTestExceptionBase
::
SkipTestExceptionBase
(
bool
handlingTags
)
{
if
(
!
handlingTags
)
{
testTagIncreaseSkipCount
(
"skip_other"
,
true
,
true
);
}
}
details
::
SkipTestExceptionBase
::
SkipTestExceptionBase
(
const
cv
::
String
&
message
,
bool
handlingTags
)
{
if
(
!
handlingTags
)
testTagIncreaseSkipCount
(
"skip_other"
,
true
,
true
);
this
->
msg
=
message
;
}
uint64
param_seed
=
0x12345678
;
// real value is passed via parseCustomOptions function
uint64
param_seed
=
0x12345678
;
// real value is passed via parseCustomOptions function
static
std
::
string
path_join
(
const
std
::
string
&
prefix
,
const
std
::
string
&
subpath
)
static
std
::
string
path_join
(
const
std
::
string
&
prefix
,
const
std
::
string
&
subpath
)
...
@@ -850,6 +864,17 @@ void testTearDown()
...
@@ -850,6 +864,17 @@ void testTearDown()
}
}
}
}
bool
checkBigDataTests
()
{
if
(
!
runBigDataTests
)
{
testTagIncreaseSkipCount
(
"skip_bigdata"
,
true
,
true
);
printf
(
"[ SKIP ] BigData tests are disabled
\n
"
);
return
false
;
}
return
true
;
}
void
parseCustomOptions
(
int
argc
,
char
**
argv
)
void
parseCustomOptions
(
int
argc
,
char
**
argv
)
{
{
const
string
command_line_keys
=
string
(
const
string
command_line_keys
=
string
(
...
...
modules/ts/src/ts_perf.cpp
View file @
873250f5
...
@@ -2003,15 +2003,15 @@ void TestBase::RunPerfTestBody()
...
@@ -2003,15 +2003,15 @@ void TestBase::RunPerfTestBody()
implConf
.
GetImpl
();
implConf
.
GetImpl
();
#endif
#endif
}
}
catch
(
const
SkipTestException
&
)
catch
(
const
Perf
SkipTestException
&
)
{
{
metrics
.
terminationReason
=
performance_metrics
::
TERM_SKIP_TEST
;
metrics
.
terminationReason
=
performance_metrics
::
TERM_SKIP_TEST
;
throw
;
return
;
}
}
catch
(
const
PerfSkipTestException
&
)
catch
(
const
cvtest
::
details
::
SkipTestExceptionBase
&
)
{
{
metrics
.
terminationReason
=
performance_metrics
::
TERM_SKIP_TEST
;
metrics
.
terminationReason
=
performance_metrics
::
TERM_SKIP_TEST
;
return
;
throw
;
}
}
catch
(
const
PerfEarlyExitException
&
)
catch
(
const
PerfEarlyExitException
&
)
{
{
...
...
modules/ts/src/ts_tags.cpp
View file @
873250f5
...
@@ -23,8 +23,10 @@ static std::map<std::string, int>& getTestTagsSkipExtraCounts()
...
@@ -23,8 +23,10 @@ static std::map<std::string, int>& getTestTagsSkipExtraCounts()
static
std
::
map
<
std
::
string
,
int
>
testTagsSkipExtraCounts
;
static
std
::
map
<
std
::
string
,
int
>
testTagsSkipExtraCounts
;
return
testTagsSkipExtraCounts
;
return
testTagsSkipExtraCounts
;
}
}
static
void
increaseTagsSkipCount
(
const
std
::
string
&
tag
,
bool
isMain
)
void
testTagIncreaseSkipCount
(
const
std
::
string
&
tag
,
bool
isMain
,
bool
appendSkipTests
)
{
{
if
(
appendSkipTests
)
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
());
std
::
map
<
std
::
string
,
int
>&
counts
=
isMain
?
getTestTagsSkipCounts
()
:
getTestTagsSkipExtraCounts
();
std
::
map
<
std
::
string
,
int
>&
counts
=
isMain
?
getTestTagsSkipCounts
()
:
getTestTagsSkipExtraCounts
();
std
::
map
<
std
::
string
,
int
>::
iterator
i
=
counts
.
find
(
tag
);
std
::
map
<
std
::
string
,
int
>::
iterator
i
=
counts
.
find
(
tag
);
if
(
i
==
counts
.
end
())
if
(
i
==
counts
.
end
())
...
@@ -192,11 +194,14 @@ public:
...
@@ -192,11 +194,14 @@ public:
{
{
if
(
!
skipped_tests
.
empty
())
if
(
!
skipped_tests
.
empty
())
{
{
std
::
cout
<<
"[ SKIPSTAT ] "
<<
skipped_tests
.
size
()
<<
" tests
via tags
"
<<
std
::
endl
;
std
::
cout
<<
"[ SKIPSTAT ] "
<<
skipped_tests
.
size
()
<<
" tests
skipped
"
<<
std
::
endl
;
const
std
::
vector
<
std
::
string
>&
skipTags
=
getTestTagsSkipList
();
const
std
::
vector
<
std
::
string
>&
skipTags
=
getTestTagsSkipList
();
const
std
::
map
<
std
::
string
,
int
>&
counts
=
getTestTagsSkipCounts
();
const
std
::
map
<
std
::
string
,
int
>&
counts
=
getTestTagsSkipCounts
();
const
std
::
map
<
std
::
string
,
int
>&
countsExtra
=
getTestTagsSkipExtraCounts
();
const
std
::
map
<
std
::
string
,
int
>&
countsExtra
=
getTestTagsSkipExtraCounts
();
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
skipTags
.
begin
();
i
!=
skipTags
.
end
();
++
i
)
std
::
vector
<
std
::
string
>
skipTags_all
=
skipTags
;
skipTags_all
.
push_back
(
"skip_bigdata"
);
skipTags_all
.
push_back
(
"skip_other"
);
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
skipTags_all
.
begin
();
i
!=
skipTags_all
.
end
();
++
i
)
{
{
int
c1
=
0
;
int
c1
=
0
;
std
::
map
<
std
::
string
,
int
>::
const_iterator
i1
=
counts
.
find
(
*
i
);
std
::
map
<
std
::
string
,
int
>::
const_iterator
i1
=
counts
.
find
(
*
i
);
...
@@ -301,7 +306,7 @@ void checkTestTags()
...
@@ -301,7 +306,7 @@ void checkTestTags()
if
(
found
!=
tags
.
size
())
if
(
found
!=
tags
.
size
())
{
{
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
());
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
());
throw
SkipTestException
(
"Test tags don't pass required tags list (--test_tag parameter)"
);
throw
details
::
SkipTestExceptionBase
(
"Test tags don't pass required tags list (--test_tag parameter)"
,
true
);
}
}
}
}
}
}
...
@@ -317,7 +322,7 @@ void checkTestTags()
...
@@ -317,7 +322,7 @@ void checkTestTags()
const
std
::
string
&
testTag
=
testTags
[
i
];
const
std
::
string
&
testTag
=
testTags
[
i
];
if
(
isTestTagSkipped
(
testTag
,
skipTag
))
if
(
isTestTagSkipped
(
testTag
,
skipTag
))
{
{
increaseTags
SkipCount
(
skipTag
,
skip_message
.
empty
());
testTagIncrease
SkipCount
(
skipTag
,
skip_message
.
empty
());
if
(
skip_message
.
empty
())
skip_message
=
"Test with tag '"
+
testTag
+
"' is skipped ('"
+
skipTag
+
"' is in skip list)"
;
if
(
skip_message
.
empty
())
skip_message
=
"Test with tag '"
+
testTag
+
"' is skipped ('"
+
skipTag
+
"' is in skip list)"
;
}
}
}
}
...
@@ -327,7 +332,7 @@ void checkTestTags()
...
@@ -327,7 +332,7 @@ void checkTestTags()
const
std
::
string
&
testTag
=
testTagsImplied
[
i
];
const
std
::
string
&
testTag
=
testTagsImplied
[
i
];
if
(
isTestTagSkipped
(
testTag
,
skipTag
))
if
(
isTestTagSkipped
(
testTag
,
skipTag
))
{
{
increaseTags
SkipCount
(
skipTag
,
skip_message
.
empty
());
testTagIncrease
SkipCount
(
skipTag
,
skip_message
.
empty
());
if
(
skip_message
.
empty
())
skip_message
=
"Test with tag '"
+
testTag
+
"' is skipped (implied '"
+
skipTag
+
"' is in skip list)"
;
if
(
skip_message
.
empty
())
skip_message
=
"Test with tag '"
+
testTag
+
"' is skipped (implied '"
+
skipTag
+
"' is in skip list)"
;
}
}
}
}
...
@@ -335,7 +340,7 @@ void checkTestTags()
...
@@ -335,7 +340,7 @@ void checkTestTags()
if
(
!
skip_message
.
empty
())
if
(
!
skip_message
.
empty
())
{
{
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
());
skipped_tests
.
push_back
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
());
throw
SkipTestException
(
skip_messag
e
);
throw
details
::
SkipTestExceptionBase
(
skip_message
,
tru
e
);
}
}
}
}
...
...
modules/ts/src/ts_tags.hpp
View file @
873250f5
...
@@ -21,6 +21,8 @@ namespace cvtest {
...
@@ -21,6 +21,8 @@ namespace cvtest {
void
activateTestTags
(
const
cv
::
CommandLineParser
&
parser
);
void
activateTestTags
(
const
cv
::
CommandLineParser
&
parser
);
void
testTagIncreaseSkipCount
(
const
std
::
string
&
tag
,
bool
isMain
=
true
,
bool
appendSkipTests
=
false
);
}
// namespace
}
// namespace
#endif // OPENCV_TS_SRC_TAGS_HPP
#endif // OPENCV_TS_SRC_TAGS_HPP
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment