From e3b3982de69889ad438643d4d54588ccd34a7cf1 Mon Sep 17 00:00:00 2001 From: Alexey Spizhevoy Date: Mon, 21 Feb 2011 06:46:45 +0000 Subject: [PATCH] added check into opencv_test_gpu: whether OpenCV was compiled with CUDA or not --- modules/gpu/test/test_main.cpp | 15 +++++++++++---- modules/gpu/test/test_meanshift.cpp | 6 +----- modules/gpu/test/test_precomp.hpp | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/gpu/test/test_main.cpp b/modules/gpu/test/test_main.cpp index 3420eb1ec0..89c1b272bc 100644 --- a/modules/gpu/test/test_main.cpp +++ b/modules/gpu/test/test_main.cpp @@ -1,6 +1,13 @@ #include "test_precomp.hpp" -CV_TEST_MAIN("gpu") - -// Run test with --gtest_catch_exceptions flag to avoid runtime errors in -// the case when there is no GPU +int main(int argc, char **argv) +{ + cvtest::TS::ptr()->init("gpu"); + ::testing::InitGoogleTest(&argc, argv); +#ifdef HAVE_CUDA + return RUN_ALL_TESTS(); +#else + std::cerr << "opencv_test_gpu: OpenCV was compiled without GPU support\n"; + return -1; +#endif +} \ No newline at end of file diff --git a/modules/gpu/test/test_meanshift.cpp b/modules/gpu/test/test_meanshift.cpp index e58bd15549..b297b982ac 100644 --- a/modules/gpu/test/test_meanshift.cpp +++ b/modules/gpu/test/test_meanshift.cpp @@ -125,11 +125,7 @@ struct CV_GpuMeanShiftTest : public cvtest::BaseTest }; -///////////////////////////////////////////////////////////////////////////// -/////////////////// tests registration ///////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - -CV_GpuMeanShiftTest CV_GpuMeanShift_test; +TEST(meanShift, accuracy) { CV_GpuMeanShiftTest test; test.safe_run(); } struct CV_GpuMeanShiftProcTest : public cvtest::BaseTest { diff --git a/modules/gpu/test/test_precomp.hpp b/modules/gpu/test/test_precomp.hpp index 9b048fc81e..89426c3bf0 100644 --- a/modules/gpu/test/test_precomp.hpp +++ b/modules/gpu/test/test_precomp.hpp @@ -2,6 +2,7 @@ #define __OPENCV_TEST_PRECOMP_HPP__ #include +#include #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp"