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
bc0e5630
Commit
bc0e5630
authored
Apr 08, 2013
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CV_GPU_TEST_MAIN macros
parent
84de6ce0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
153 deletions
+67
-153
test_main.cpp
modules/gpuarithm/test/test_main.cpp
+1
-76
test_main.cpp
modules/gpucodec/test/test_main.cpp
+1
-1
test_main.cpp
modules/gpufilters/test/test_main.cpp
+1
-76
gpu_test.hpp
modules/ts/include/opencv2/ts/gpu_test.hpp
+64
-0
No files found.
modules/gpuarithm/test/test_main.cpp
View file @
bc0e5630
...
...
@@ -42,79 +42,4 @@
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
gpu
;
using
namespace
cvtest
;
using
namespace
testing
;
int
main
(
int
argc
,
char
**
argv
)
{
try
{
const
std
::
string
keys
=
"{ h help ? | | Print help}"
"{ i info | | Print information about system and exit }"
"{ device | -1 | Device on which tests will be executed (-1 means all devices) }"
;
CommandLineParser
cmd
(
argc
,
(
const
char
**
)
argv
,
keys
);
if
(
cmd
.
has
(
"help"
))
{
cmd
.
printMessage
();
return
0
;
}
printCudaInfo
();
if
(
cmd
.
has
(
"info"
))
{
return
0
;
}
int
device
=
cmd
.
get
<
int
>
(
"device"
);
if
(
device
<
0
)
{
DeviceManager
::
instance
().
loadAll
();
cout
<<
"Run tests on all supported devices
\n
"
<<
endl
;
}
else
{
DeviceManager
::
instance
().
load
(
device
);
DeviceInfo
info
(
device
);
cout
<<
"Run tests on device "
<<
device
<<
" ["
<<
info
.
name
()
<<
"]
\n
"
<<
endl
;
}
TS
::
ptr
()
->
init
(
"gpu"
);
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
catch
(
const
exception
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
return
-
1
;
}
catch
(...)
{
cerr
<<
"Unknown error"
<<
endl
;
return
-
1
;
}
return
0
;
}
#else // HAVE_CUDA
int
main
()
{
printf
(
"OpenCV was built without CUDA support
\n
"
);
return
0
;
}
#endif // HAVE_CUDA
CV_GPU_TEST_MAIN
(
"gpu"
)
modules/gpucodec/test/test_main.cpp
View file @
bc0e5630
...
...
@@ -42,4 +42,4 @@
#include "test_precomp.hpp"
CV_TEST_MAIN
(
"gpu"
)
CV_
GPU_
TEST_MAIN
(
"gpu"
)
modules/gpufilters/test/test_main.cpp
View file @
bc0e5630
...
...
@@ -42,79 +42,4 @@
#include "test_precomp.hpp"
#ifdef HAVE_CUDA
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
gpu
;
using
namespace
cvtest
;
using
namespace
testing
;
int
main
(
int
argc
,
char
**
argv
)
{
try
{
const
std
::
string
keys
=
"{ h help ? | | Print help}"
"{ i info | | Print information about system and exit }"
"{ device | -1 | Device on which tests will be executed (-1 means all devices) }"
;
CommandLineParser
cmd
(
argc
,
(
const
char
**
)
argv
,
keys
);
if
(
cmd
.
has
(
"help"
))
{
cmd
.
printMessage
();
return
0
;
}
printCudaInfo
();
if
(
cmd
.
has
(
"info"
))
{
return
0
;
}
int
device
=
cmd
.
get
<
int
>
(
"device"
);
if
(
device
<
0
)
{
DeviceManager
::
instance
().
loadAll
();
cout
<<
"Run tests on all supported devices
\n
"
<<
endl
;
}
else
{
DeviceManager
::
instance
().
load
(
device
);
DeviceInfo
info
(
device
);
cout
<<
"Run tests on device "
<<
device
<<
" ["
<<
info
.
name
()
<<
"]
\n
"
<<
endl
;
}
TS
::
ptr
()
->
init
(
"gpu"
);
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
catch
(
const
exception
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
return
-
1
;
}
catch
(...)
{
cerr
<<
"Unknown error"
<<
endl
;
return
-
1
;
}
return
0
;
}
#else // HAVE_CUDA
int
main
()
{
printf
(
"OpenCV was built without CUDA support
\n
"
);
return
0
;
}
#endif // HAVE_CUDA
CV_GPU_TEST_MAIN
(
"gpu"
)
modules/ts/include/opencv2/ts/gpu_test.hpp
View file @
bc0e5630
...
...
@@ -43,6 +43,7 @@
#ifndef __OPENCV_GPU_TEST_UTILITY_HPP__
#define __OPENCV_GPU_TEST_UTILITY_HPP__
#include <stdexcept>
#include "opencv2/core.hpp"
#include "opencv2/core/gpumat.hpp"
#include "opencv2/highgui.hpp"
...
...
@@ -345,4 +346,67 @@ namespace cv { namespace gpu
CV_EXPORTS
void
PrintTo
(
const
DeviceInfo
&
info
,
std
::
ostream
*
os
);
}}
#ifdef HAVE_CUDA
#define CV_GPU_TEST_MAIN(resourcesubdir) \
int main(int argc, char* argv[]) \
{ \
try \
{ \
cv::CommandLineParser cmd(argc, argv, \
"{ h help ? | | Print help}" \
"{ i info | | Print information about system and exit }" \
"{ device | -1 | Device on which tests will be executed (-1 means all devices) }" \
); \
if (cmd.has("help")) \
{ \
cmd.printMessage(); \
return 0; \
} \
cvtest::printCudaInfo(); \
if (cmd.has("info")) \
{ \
return 0; \
} \
int device = cmd.get<int>("device"); \
if (device < 0) \
{ \
cvtest::DeviceManager::instance().loadAll(); \
std::cout << "Run tests on all supported devices \n" << std::endl; \
} \
else \
{ \
cvtest::DeviceManager::instance().load(device); \
cv::gpu::DeviceInfo info(device); \
std::cout << "Run tests on device " << device << " [" << info.name() << "] \n" << std::endl; \
} \
cvtest::TS::ptr()->init( resourcesubdir ); \
testing::InitGoogleTest(&argc, argv); \
return RUN_ALL_TESTS(); \
} \
catch (const std::exception& e) \
{ \
std::cerr << e.what() << std::endl; \
return -1; \
} \
catch (...) \
{ \
std::cerr << "Unknown error" << std::endl; \
return -1; \
} \
return 0; \
}
#else // HAVE_CUDA
#define CV_GPU_TEST_MAIN(resourcesubdir) \
int main() \
{ \
printf("OpenCV was built without CUDA support\n"); \
return 0; \
}
#endif // HAVE_CUDA
#endif // __OPENCV_GPU_TEST_UTILITY_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