removed catch from GPU stereo_bp test as --gtest_catch_exceptions flags exists (but...
authorAlexey Spizhevoy <no@email>
Thu, 17 Feb 2011 07:02:12 +0000 (07:02 +0000)
committerAlexey Spizhevoy <no@email>
Thu, 17 Feb 2011 07:02:12 +0000 (07:02 +0000)
modules/gpu/test/test_main.cpp
modules/gpu/test/test_stereo_bp.cpp

index c4b5e24..1f2c265 100644 (file)
@@ -1,3 +1,9 @@
 #include "test_precomp.hpp"\r
 \r
+// Run test with --gtest_catch_exceptions flag to avoid runtime errors in \r
+// the case when there is no GPU\r
 CV_TEST_MAIN("gpu")\r
+\r
+// TODO Add other tests from tests/gpu folder\r
+// TODO When there is no GPU test system doesn't print error message: it fails or keeps \r
+//      quiet when --gtest_catch_exceptions is enabled\r
index fcf01f7..a3b1780 100644 (file)
@@ -43,7 +43,7 @@
 \r
 struct CV_GpuStereoBPTest : public cvtest::BaseTest\r
 {\r
-    void run(int )\r
+    void run(int)\r
     {\r
         cv::Mat img_l = cv::imread(std::string(ts->get_data_path()) + "stereobp/aloe-L.png");\r
         cv::Mat img_r = cv::imread(std::string(ts->get_data_path()) + "stereobp/aloe-R.png");\r
@@ -55,34 +55,25 @@ struct CV_GpuStereoBPTest : public cvtest::BaseTest
             return;\r
         }\r
 \r
-        try\r
-        {\r
-            {cv::Mat temp; cv::cvtColor(img_l, temp, CV_BGR2BGRA); cv::swap(temp, img_l);}\r
-            {cv::Mat temp; cv::cvtColor(img_r, temp, CV_BGR2BGRA); cv::swap(temp, img_r);}\r
+        {cv::Mat temp; cv::cvtColor(img_l, temp, CV_BGR2BGRA); cv::swap(temp, img_l);}\r
+        {cv::Mat temp; cv::cvtColor(img_r, temp, CV_BGR2BGRA); cv::swap(temp, img_r);}\r
 \r
-            cv::gpu::GpuMat disp;\r
-            cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S);\r
+        cv::gpu::StereoBeliefPropagation bpm(64, 8, 2, 25, 0.1f, 15, 1, CV_16S);\r
+        cv::gpu::GpuMat disp;\r
 \r
-            bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp);\r
+        bpm(cv::gpu::GpuMat(img_l), cv::gpu::GpuMat(img_r), disp);\r
 \r
-            //cv::imwrite(std::string(ts->get_data_path()) + "stereobp/aloe-disp.png", disp);\r
+        //cv::imwrite(std::string(ts->get_data_path()) + "stereobp/aloe-disp.png", disp);\r
 \r
-            disp.convertTo(disp, img_template.type());\r
+        disp.convertTo(disp, img_template.type());\r
 \r
-           double norm = cv::norm(disp, img_template, cv::NORM_INF);\r
-               if (norm >= 0.5)\r
-           {\r
-               ts->printf(cvtest::TS::LOG, "\nStereoBP norm = %f\n", norm);\r
-               ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);\r
-               return;\r
-           }\r
-       }\r
-       catch(const cv::Exception& e)\r
-       {\r
-           if (!check_and_treat_gpu_exception(e, ts))\r
-               throw;\r
-           return;\r
-       }\r
+        double norm = cv::norm(disp, img_template, cv::NORM_INF);\r
+           if (norm >= 0.5)\r
+        {\r
+               ts->printf(cvtest::TS::LOG, "\nStereoBP norm = %f\n", norm);\r
+               ts->set_failed_test_info(cvtest::TS::FAIL_GENERIC);\r
+               return;\r
+        }\r
 \r
         ts->set_failed_test_info(cvtest::TS::OK);\r
     }\r