CV_GPU_TEST_MAIN macros
This commit is contained in:
@@ -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")
|
||||
|
Reference in New Issue
Block a user