Merged the trunk r8589:8653 - all changes related to build warnings
This commit is contained in:
@@ -9,7 +9,7 @@ if(MINGW)
|
||||
endif()
|
||||
|
||||
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
|
||||
|
||||
|
||||
ocv_add_module(ts opencv_core)
|
||||
ocv_glob_module_sources()
|
||||
ocv_module_include_directories()
|
||||
@@ -17,9 +17,6 @@ ocv_create_module()
|
||||
|
||||
if(BUILD_SHARED_LIBS AND NOT MINGW)
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
|
||||
if (MSVC AND NOT ENABLE_NOISY_WARNINGS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275")
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=0)
|
||||
endif()
|
||||
|
@@ -14,16 +14,38 @@
|
||||
# include <android/api-level.h>
|
||||
# define GTEST_HAS_CLONE (__ANDROID_API__ > 7 && __arm__)
|
||||
# define GTEST_HAS_POSIX_RE (__ANDROID_API__ > 7)
|
||||
# define GTEST_HAS_STD_WSTRING _GLIBCXX_USE_WCHAR_T
|
||||
# if defined _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_WCHAR_T
|
||||
# define GTEST_HAS_STD_WSTRING 1
|
||||
# else
|
||||
# define GTEST_HAS_STD_WSTRING 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdarg.h> // for va_list
|
||||
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4251 4275 4355 4127 )
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable: 4127 )
|
||||
#endif
|
||||
|
||||
#define GTEST_DONT_DEFINE_FAIL 0
|
||||
#define GTEST_DONT_DEFINE_SUCCEED 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_EQ 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_NE 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_LE 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_LT 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_GE 0
|
||||
#define GTEST_DONT_DEFINE_ASSERT_GT 0
|
||||
#define GTEST_DONT_DEFINE_TEST 0
|
||||
|
||||
#include "opencv2/ts/ts_gtest.h"
|
||||
|
||||
#ifndef GTEST_USES_SIMPLE_RE
|
||||
# define GTEST_USES_SIMPLE_RE 0
|
||||
#endif
|
||||
#ifndef GTEST_USES_POSIX_RE
|
||||
# define GTEST_USES_POSIX_RE 0
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
|
||||
namespace cvtest
|
||||
@@ -39,9 +61,9 @@ using cv::Point;
|
||||
using cv::Rect;
|
||||
|
||||
class CV_EXPORTS TS;
|
||||
|
||||
|
||||
CV_EXPORTS int64 readSeed(const char* str);
|
||||
|
||||
|
||||
CV_EXPORTS void randUni( RNG& rng, Mat& a, const Scalar& param1, const Scalar& param2 );
|
||||
|
||||
inline unsigned randInt( RNG& rng )
|
||||
@@ -53,13 +75,13 @@ inline double randReal( RNG& rng )
|
||||
{
|
||||
return (double)rng;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
CV_EXPORTS const char* getTypeName( int type );
|
||||
CV_EXPORTS int typeByName( const char* type_name );
|
||||
|
||||
CV_EXPORTS string vec2str(const string& sep, const int* v, size_t nelems);
|
||||
|
||||
|
||||
inline int clipInt( int val, int min_val, int max_val )
|
||||
{
|
||||
if( val < min_val )
|
||||
@@ -71,9 +93,9 @@ inline int clipInt( int val, int min_val, int max_val )
|
||||
|
||||
CV_EXPORTS double getMinVal(int depth);
|
||||
CV_EXPORTS double getMaxVal(int depth);
|
||||
|
||||
|
||||
CV_EXPORTS Size randomSize(RNG& rng, double maxSizeLog);
|
||||
CV_EXPORTS void randomSize(RNG& rng, int minDims, int maxDims, double maxSizeLog, vector<int>& sz);
|
||||
CV_EXPORTS void randomSize(RNG& rng, int minDims, int maxDims, double maxSizeLog, vector<int>& sz);
|
||||
CV_EXPORTS int randomType(RNG& rng, int typeMask, int minChannels, int maxChannels);
|
||||
CV_EXPORTS Mat randomMat(RNG& rng, Size size, int type, double minVal, double maxVal, bool useRoi);
|
||||
CV_EXPORTS Mat randomMat(RNG& rng, const vector<int>& size, int type, double minVal, double maxVal, bool useRoi);
|
||||
@@ -85,7 +107,7 @@ CV_EXPORTS void divide(const Mat& a, const Mat& b, Mat& c, double alpha=1);
|
||||
CV_EXPORTS void convert(const Mat& src, Mat& dst, int dtype, double alpha=1, double beta=0);
|
||||
CV_EXPORTS void copy(const Mat& src, Mat& dst, const Mat& mask=Mat(), bool invertMask=false);
|
||||
CV_EXPORTS void set(Mat& dst, const Scalar& gamma, const Mat& mask=Mat());
|
||||
|
||||
|
||||
// working with multi-channel arrays
|
||||
CV_EXPORTS void extract( const Mat& a, Mat& plane, int coi );
|
||||
CV_EXPORTS void insert( const Mat& plane, Mat& a, int coi );
|
||||
@@ -93,10 +115,10 @@ CV_EXPORTS void insert( const Mat& plane, Mat& a, int coi );
|
||||
// checks that the array does not have NaNs and/or Infs and all the elements are
|
||||
// within [min_val,max_val). idx is the index of the first "bad" element.
|
||||
CV_EXPORTS int check( const Mat& data, double min_val, double max_val, vector<int>* idx );
|
||||
|
||||
|
||||
// modifies values that are close to zero
|
||||
CV_EXPORTS void patchZeros( Mat& mat, double level );
|
||||
|
||||
|
||||
CV_EXPORTS void transpose(const Mat& src, Mat& dst);
|
||||
CV_EXPORTS void erode(const Mat& src, Mat& dst, const Mat& _kernel, Point anchor=Point(-1,-1),
|
||||
int borderType=IPL_BORDER_CONSTANT, const Scalar& borderValue=Scalar());
|
||||
@@ -109,17 +131,17 @@ CV_EXPORTS void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, in
|
||||
int borderType, const Scalar& borderValue=Scalar());
|
||||
CV_EXPORTS Mat calcSobelKernel2D( int dx, int dy, int apertureSize, int origin=0 );
|
||||
CV_EXPORTS Mat calcLaplaceKernel2D( int aperture_size );
|
||||
|
||||
|
||||
CV_EXPORTS void initUndistortMap( const Mat& a, const Mat& k, Size sz, Mat& mapx, Mat& mapy );
|
||||
|
||||
|
||||
CV_EXPORTS void minMaxLoc(const Mat& src, double* minval, double* maxval,
|
||||
vector<int>* minloc, vector<int>* maxloc, const Mat& mask=Mat());
|
||||
CV_EXPORTS double norm(const Mat& src, int normType, const Mat& mask=Mat());
|
||||
CV_EXPORTS double norm(const Mat& src1, const Mat& src2, int normType, const Mat& mask=Mat());
|
||||
CV_EXPORTS Scalar mean(const Mat& src, const Mat& mask=Mat());
|
||||
|
||||
|
||||
CV_EXPORTS bool cmpUlps(const Mat& data, const Mat& refdata, int expMaxDiff, double* realMaxDiff, vector<int>* idx);
|
||||
|
||||
|
||||
// compares two arrays. max_diff is the maximum actual difference,
|
||||
// success_err_level is maximum allowed difference, idx is the index of the first
|
||||
// element for which difference is >success_err_level
|
||||
@@ -127,23 +149,23 @@ CV_EXPORTS bool cmpUlps(const Mat& data, const Mat& refdata, int expMaxDiff, dou
|
||||
CV_EXPORTS int cmpEps( const Mat& data, const Mat& refdata, double* max_diff,
|
||||
double success_err_level, vector<int>* idx,
|
||||
bool element_wise_relative_error );
|
||||
|
||||
|
||||
// a wrapper for the previous function. in case of error prints the message to log file.
|
||||
CV_EXPORTS int cmpEps2( TS* ts, const Mat& data, const Mat& refdata, double success_err_level,
|
||||
bool element_wise_relative_error, const char* desc );
|
||||
|
||||
|
||||
CV_EXPORTS int cmpEps2_64f( TS* ts, const double* val, const double* refval, int len,
|
||||
double eps, const char* param_name );
|
||||
|
||||
|
||||
CV_EXPORTS void logicOp(const Mat& src1, const Mat& src2, Mat& dst, char c);
|
||||
CV_EXPORTS void logicOp(const Mat& src, const Scalar& s, Mat& dst, char c);
|
||||
CV_EXPORTS void min(const Mat& src1, const Mat& src2, Mat& dst);
|
||||
CV_EXPORTS void min(const Mat& src, double s, Mat& dst);
|
||||
CV_EXPORTS void min(const Mat& src, double s, Mat& dst);
|
||||
CV_EXPORTS void max(const Mat& src1, const Mat& src2, Mat& dst);
|
||||
CV_EXPORTS void max(const Mat& src, double s, Mat& dst);
|
||||
|
||||
CV_EXPORTS void max(const Mat& src, double s, Mat& dst);
|
||||
|
||||
CV_EXPORTS void compare(const Mat& src1, const Mat& src2, Mat& dst, int cmpop);
|
||||
CV_EXPORTS void compare(const Mat& src, double s, Mat& dst, int cmpop);
|
||||
CV_EXPORTS void compare(const Mat& src, double s, Mat& dst, int cmpop);
|
||||
CV_EXPORTS void gemm(const Mat& src1, const Mat& src2, double alpha,
|
||||
const Mat& src3, double beta, Mat& dst, int flags);
|
||||
CV_EXPORTS void transform( const Mat& src, Mat& dst, const Mat& transmat, const Mat& shift );
|
||||
@@ -155,16 +177,16 @@ struct CV_EXPORTS MatInfo
|
||||
const Mat* m;
|
||||
};
|
||||
|
||||
CV_EXPORTS std::ostream& operator << (std::ostream& out, const MatInfo& m);
|
||||
|
||||
CV_EXPORTS std::ostream& operator << (std::ostream& out, const MatInfo& m);
|
||||
|
||||
struct CV_EXPORTS MatComparator
|
||||
{
|
||||
public:
|
||||
MatComparator(double maxdiff, int context);
|
||||
|
||||
|
||||
::testing::AssertionResult operator()(const char* expr1, const char* expr2,
|
||||
const Mat& m1, const Mat& m2);
|
||||
|
||||
|
||||
double maxdiff;
|
||||
double realmaxdiff;
|
||||
vector<int> loc0;
|
||||
@@ -238,7 +260,7 @@ protected:
|
||||
struct TestInfo
|
||||
{
|
||||
TestInfo();
|
||||
|
||||
|
||||
// pointer to the test
|
||||
BaseTest* test;
|
||||
|
||||
@@ -247,7 +269,7 @@ struct TestInfo
|
||||
|
||||
// seed value right before the data for the failed test case is prepared.
|
||||
uint64 rng_seed;
|
||||
|
||||
|
||||
// seed value right before running the test
|
||||
uint64 rng_seed0;
|
||||
|
||||
@@ -263,18 +285,18 @@ struct TestInfo
|
||||
struct CV_EXPORTS TSParams
|
||||
{
|
||||
TSParams();
|
||||
|
||||
|
||||
// RNG seed, passed to and updated by every test executed.
|
||||
uint64 rng_seed;
|
||||
|
||||
|
||||
// whether to use IPP, MKL etc. or not
|
||||
bool use_optimized;
|
||||
|
||||
|
||||
// extensivity of the tests, scale factor for test_case_count
|
||||
double test_case_count_scale;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CV_EXPORTS TS
|
||||
{
|
||||
public:
|
||||
@@ -297,10 +319,10 @@ public:
|
||||
};
|
||||
|
||||
static TS* ptr();
|
||||
|
||||
|
||||
// initialize test system before running the first test
|
||||
virtual void init( const string& modulename );
|
||||
|
||||
|
||||
// low-level printing functions that are used by individual tests and by the system itself
|
||||
virtual void printf( int streams, const char* fmt, ... );
|
||||
virtual void vprintf( int streams, const char* fmt, va_list arglist );
|
||||
@@ -312,7 +334,7 @@ public:
|
||||
|
||||
// sets information about a failed test
|
||||
virtual void set_failed_test_info( int fail_code );
|
||||
|
||||
|
||||
virtual void set_gtest_status();
|
||||
|
||||
// test error codes
|
||||
@@ -398,7 +420,7 @@ public:
|
||||
|
||||
// returns textual description of failure code
|
||||
static string str_from_code( int code );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// these are allocated within a test to try keep them valid in case of stack corruption
|
||||
@@ -406,10 +428,10 @@ protected:
|
||||
|
||||
// information about the current test
|
||||
TestInfo current_test_info;
|
||||
|
||||
|
||||
// the path to data files used by tests
|
||||
string data_path;
|
||||
|
||||
|
||||
TSParams params;
|
||||
std::string output_buf[MAX_IDX];
|
||||
};
|
||||
@@ -468,7 +490,7 @@ protected:
|
||||
virtual void run_func(void) = 0;
|
||||
int test_case_idx;
|
||||
int progress;
|
||||
double t, freq;
|
||||
double t, freq;
|
||||
|
||||
template<class F>
|
||||
int run_test_case( int expected_code, const string& _descr, F f)
|
||||
@@ -486,7 +508,7 @@ protected:
|
||||
t = new_t;
|
||||
}
|
||||
progress = update_progress(progress, test_case_idx, 0, dt);
|
||||
|
||||
|
||||
int errcount = 0;
|
||||
bool thrown = false;
|
||||
const char* descr = _descr.c_str() ? _descr.c_str() : "";
|
||||
@@ -519,21 +541,21 @@ protected:
|
||||
errcount = 1;
|
||||
}
|
||||
test_case_idx++;
|
||||
|
||||
|
||||
return errcount;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct CV_EXPORTS DefaultRngAuto
|
||||
{
|
||||
const uint64 old_state;
|
||||
|
||||
|
||||
DefaultRngAuto() : old_state(cv::theRNG().state) { cv::theRNG().state = (uint64)-1; }
|
||||
~DefaultRngAuto() { cv::theRNG().state = old_state; }
|
||||
|
||||
|
||||
DefaultRngAuto& operator=(const DefaultRngAuto&);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
// fills c with zeros
|
||||
|
@@ -307,43 +307,76 @@
|
||||
#endif // __GNUC__
|
||||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#define GTEST_OS_CYGWIN 0
|
||||
#define GTEST_OS_SYMBIAN 0
|
||||
#define GTEST_OS_WINDOWS 0
|
||||
#define GTEST_OS_WINDOWS_MOBILE 0
|
||||
#define GTEST_OS_WINDOWS_MINGW 0
|
||||
#define GTEST_OS_WINDOWS_DESKTOP 0
|
||||
#define GTEST_OS_MAC 0
|
||||
#define GTEST_OS_MAC_IOS 0
|
||||
#define GTEST_OS_LINUX 0
|
||||
#define GTEST_OS_LINUX_ANDROID 0
|
||||
#define GTEST_OS_ZOS 0
|
||||
#define GTEST_OS_SOLARIS 0
|
||||
#define GTEST_OS_AIX 0
|
||||
#define GTEST_OS_HPUX 0
|
||||
#define GTEST_OS_NACL 0
|
||||
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# undef GTEST_OS_CYGWIN
|
||||
# define GTEST_OS_CYGWIN 1
|
||||
#elif defined __SYMBIAN32__
|
||||
# undef GTEST_OS_SYMBIAN
|
||||
# define GTEST_OS_SYMBIAN 1
|
||||
#elif defined _WIN32
|
||||
# undef GTEST_OS_WINDOWS
|
||||
# define GTEST_OS_WINDOWS 1
|
||||
# ifdef _WIN32_WCE
|
||||
# undef GTEST_OS_WINDOWS_MOBILE
|
||||
# define GTEST_OS_WINDOWS_MOBILE 1
|
||||
# elif defined(__MINGW__) || defined(__MINGW32__)
|
||||
# undef GTEST_OS_WINDOWS_MINGW
|
||||
# define GTEST_OS_WINDOWS_MINGW 1
|
||||
# else
|
||||
# undef GTEST_OS_WINDOWS_DESKTOP
|
||||
# define GTEST_OS_WINDOWS_DESKTOP 1
|
||||
# endif // _WIN32_WCE
|
||||
#elif defined __APPLE__
|
||||
# undef GTEST_OS_MAC
|
||||
# define GTEST_OS_MAC 1
|
||||
# include <TargetConditionals.h>
|
||||
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
# undef GTEST_OS_MAC_IOS
|
||||
# define GTEST_OS_MAC_IOS 1
|
||||
# endif
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
#define GTEST_OS_MAC_IOS 1
|
||||
# undef GTEST_OS_MAC_IOS
|
||||
# define GTEST_OS_MAC_IOS 1
|
||||
#endif
|
||||
#elif defined __linux__
|
||||
# undef GTEST_OS_LINUX
|
||||
# define GTEST_OS_LINUX 1
|
||||
# ifdef ANDROID
|
||||
# undef GTEST_OS_LINUX_ANDROID
|
||||
# define GTEST_OS_LINUX_ANDROID 1
|
||||
# endif // ANDROID
|
||||
#elif defined __MVS__
|
||||
# undef GTEST_OS_ZOS
|
||||
# define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
# undef GTEST_OS_SOLARIS
|
||||
# define GTEST_OS_SOLARIS 1
|
||||
#elif defined(_AIX)
|
||||
# undef GTEST_OS_AIX
|
||||
# define GTEST_OS_AIX 1
|
||||
#elif defined(__hpux)
|
||||
# undef GTEST_OS_HPUX
|
||||
# define GTEST_OS_HPUX 1
|
||||
#elif defined __native_client__
|
||||
# undef GTEST_OS_NACL
|
||||
# define GTEST_OS_NACL 1
|
||||
#endif // __CYGWIN__
|
||||
|
||||
@@ -379,19 +412,22 @@
|
||||
// <stddef.h>.
|
||||
# include <regex.h> // NOLINT
|
||||
|
||||
# define GTEST_USES_POSIX_RE 1
|
||||
# define GTEST_USES_POSIX_RE 1
|
||||
# define GTEST_USES_SIMPLE_RE 0
|
||||
|
||||
#elif GTEST_OS_WINDOWS
|
||||
|
||||
// <regex.h> is not available on Windows. Use our own simple regex
|
||||
// implementation instead.
|
||||
# define GTEST_USES_SIMPLE_RE 1
|
||||
# define GTEST_USES_POSIX_RE 0
|
||||
|
||||
#else
|
||||
|
||||
// <regex.h> may not be available on this platform. Use our own
|
||||
// simple regex implementation instead.
|
||||
# define GTEST_USES_SIMPLE_RE 1
|
||||
# define GTEST_USES_POSIX_RE 0
|
||||
|
||||
#endif // GTEST_HAS_POSIX_RE
|
||||
|
||||
@@ -1645,6 +1681,8 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
|
||||
// Determines whether test results can be streamed to a socket.
|
||||
#if GTEST_OS_LINUX
|
||||
# define GTEST_CAN_STREAM_RESULTS_ 1
|
||||
#else
|
||||
# define GTEST_CAN_STREAM_RESULTS_ 0
|
||||
#endif
|
||||
|
||||
// Defines some utility macros.
|
||||
@@ -16805,7 +16843,7 @@ class GTEST_API_ TestPartResultArray {
|
||||
};
|
||||
|
||||
// This interface knows how to report a test part result.
|
||||
class TestPartResultReporterInterface {
|
||||
class GTEST_API_ TestPartResultReporterInterface {
|
||||
public:
|
||||
virtual ~TestPartResultReporterInterface() {}
|
||||
|
||||
|
@@ -1,10 +1,6 @@
|
||||
#if _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4127 4251)
|
||||
#endif
|
||||
|
||||
#include "opencv2/core/core_c.h"
|
||||
#include "opencv2/ts/ts.hpp"
|
||||
|
||||
#if GTEST_LINKED_AS_SHARED_LIBRARY
|
||||
#ifdef GTEST_LINKED_AS_SHARED_LIBRARY
|
||||
#error ts module should not have GTEST_LINKED_AS_SHARED_LIBRARY defined
|
||||
#endif
|
||||
|
@@ -112,7 +112,7 @@ static const int tsSigId[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT, -1 };
|
||||
|
||||
static jmp_buf tsJmpMark;
|
||||
|
||||
void signalHandler( int sig_code )
|
||||
static void signalHandler( int sig_code )
|
||||
{
|
||||
int code = TS::FAIL_EXCEPTION;
|
||||
switch( sig_code )
|
||||
@@ -197,7 +197,7 @@ void BaseTest::safe_run( int start_from )
|
||||
read_params( ts->get_file_storage() );
|
||||
ts->update_context( 0, -1, true );
|
||||
ts->update_context( this, -1, true );
|
||||
|
||||
|
||||
if( !::testing::GTEST_FLAG(catch_exceptions) )
|
||||
run( start_from );
|
||||
else
|
||||
@@ -218,7 +218,7 @@ void BaseTest::safe_run( int start_from )
|
||||
{
|
||||
const char* errorStr = cvErrorStr(exc.code);
|
||||
char buf[1 << 16];
|
||||
|
||||
|
||||
sprintf( buf, "OpenCV Error: %s (%s) in %s, file %s, line %d",
|
||||
errorStr, exc.err.c_str(), exc.func.size() > 0 ?
|
||||
exc.func.c_str() : "unknown function", exc.file.c_str(), exc.line );
|
||||
@@ -230,7 +230,7 @@ void BaseTest::safe_run( int start_from )
|
||||
ts->set_failed_test_info( TS::FAIL_EXCEPTION );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ts->set_gtest_status();
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
|
||||
int errcount = 0;
|
||||
bool thrown = false;
|
||||
const char* descr = _descr.c_str() ? _descr.c_str() : "";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
run_func();
|
||||
@@ -402,7 +402,7 @@ TestInfo::TestInfo()
|
||||
test_case_idx = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TS::TS()
|
||||
{
|
||||
} // ctor
|
||||
@@ -450,7 +450,7 @@ static int tsErrorCallback( int status, const char* func_name, const char* err_m
|
||||
void TS::init( const string& modulename )
|
||||
{
|
||||
char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
|
||||
|
||||
|
||||
if( datapath_dir )
|
||||
{
|
||||
char buf[1024];
|
||||
@@ -459,7 +459,7 @@ void TS::init( const string& modulename )
|
||||
sprintf( buf, "%s%s%s/", datapath_dir, haveSlash ? "" : "/", modulename.c_str() );
|
||||
data_path = string(buf);
|
||||
}
|
||||
|
||||
|
||||
cv::redirectError((cv::ErrorCallback)tsErrorCallback, this);
|
||||
|
||||
if( ::testing::GTEST_FLAG(catch_exceptions) )
|
||||
@@ -484,10 +484,10 @@ void TS::init( const string& modulename )
|
||||
signal( tsSigId[i], SIG_DFL );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if( params.use_optimized == 0 )
|
||||
cv::setUseOptimized(false);
|
||||
|
||||
|
||||
rng = RNG(params.rng_seed);
|
||||
}
|
||||
|
||||
@@ -497,11 +497,11 @@ void TS::set_gtest_status()
|
||||
int code = get_err_code();
|
||||
if( code >= 0 )
|
||||
return SUCCEED();
|
||||
|
||||
|
||||
char seedstr[32];
|
||||
sprintf(seedstr, "%08x%08x", (unsigned)(current_test_info.rng_seed>>32),
|
||||
(unsigned)(current_test_info.rng_seed));
|
||||
|
||||
|
||||
string logs = "";
|
||||
if( !output_buf[SUMMARY_IDX].empty() )
|
||||
logs += "\n-----------------------------------\n\tSUM: " + output_buf[SUMMARY_IDX];
|
||||
@@ -510,7 +510,7 @@ void TS::set_gtest_status()
|
||||
if( !output_buf[CONSOLE_IDX].empty() )
|
||||
logs += "\n-----------------------------------\n\tCONSOLE: " + output_buf[CONSOLE_IDX];
|
||||
logs += "\n-----------------------------------\n";
|
||||
|
||||
|
||||
FAIL() << "\n\tfailure reason: " << str_from_code(code) <<
|
||||
"\n\ttest case #" << current_test_info.test_case_idx <<
|
||||
"\n\tseed: " << seedstr << logs;
|
||||
@@ -518,7 +518,7 @@ void TS::set_gtest_status()
|
||||
|
||||
|
||||
CvFileStorage* TS::get_file_storage() { return 0; }
|
||||
|
||||
|
||||
void TS::update_context( BaseTest* test, int test_case_idx, bool update_ts_context )
|
||||
{
|
||||
if( current_test_info.test != test )
|
||||
@@ -528,7 +528,7 @@ void TS::update_context( BaseTest* test, int test_case_idx, bool update_ts_conte
|
||||
rng = RNG(params.rng_seed);
|
||||
current_test_info.rng_seed0 = current_test_info.rng_seed = rng.state;
|
||||
}
|
||||
|
||||
|
||||
current_test_info.test = test;
|
||||
current_test_info.test_case_idx = test_case_idx;
|
||||
current_test_info.code = 0;
|
||||
@@ -537,7 +537,7 @@ void TS::update_context( BaseTest* test, int test_case_idx, bool update_ts_conte
|
||||
current_test_info.rng_seed = rng.state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TS::set_failed_test_info( int fail_code )
|
||||
{
|
||||
if( current_test_info.code >= 0 )
|
||||
@@ -577,7 +577,7 @@ void TS::printf( int streams, const char* fmt, ... )
|
||||
va_end( l );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TS ts;
|
||||
TS* TS::ptr() { return &ts; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,11 @@
|
||||
|
||||
// This line ensures that gtest.h can be compiled on its own, even
|
||||
// when it's fused.
|
||||
#include "opencv2/ts/ts_gtest.h"
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
|
||||
// The following lines pull in the real gtest *.cc files.
|
||||
// Copyright 2005, Google Inc.
|
||||
@@ -1906,7 +1910,7 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
|
||||
// This predicate-formatter checks that 'results' contains a test part
|
||||
// failure of the given type and that the failure message contains the
|
||||
// given substring.
|
||||
AssertionResult HasOneFailure(const char* /* results_expr */,
|
||||
static AssertionResult HasOneFailure(const char* /* results_expr */,
|
||||
const char* /* type_expr */,
|
||||
const char* /* substr_expr */,
|
||||
const TestPartResultArray& results,
|
||||
@@ -3874,7 +3878,7 @@ WORD GetColorAttribute(GTestColor color) {
|
||||
|
||||
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
|
||||
// an invalid input.
|
||||
const char* GetAnsiColorCode(GTestColor color) {
|
||||
static const char* GetAnsiColorCode(GTestColor color) {
|
||||
switch (color) {
|
||||
case COLOR_RED: return "1";
|
||||
case COLOR_GREEN: return "2";
|
||||
@@ -3921,7 +3925,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
||||
// cannot simply emit special characters and have the terminal change colors.
|
||||
// This routine must actually emit the characters rather than return a string
|
||||
// that would be colored when printed, as can be done on Linux.
|
||||
void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
@@ -3967,7 +3971,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
||||
static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
||||
const char* const type_param = test_info.type_param();
|
||||
const char* const value_param = test_info.value_param();
|
||||
|
||||
@@ -4946,13 +4950,13 @@ UnitTest * UnitTest::GetInstance() {
|
||||
// default implementation. Use this implementation to keep good OO
|
||||
// design with private destructor.
|
||||
|
||||
#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
|
||||
#if (defined(_MSC_VER) && _MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
|
||||
static UnitTest* const instance = new UnitTest;
|
||||
return instance;
|
||||
#else
|
||||
static UnitTest instance;
|
||||
return &instance;
|
||||
#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
|
||||
#endif // (defined(_MSC_VER) && _MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__)
|
||||
}
|
||||
|
||||
// Gets the number of successful test cases.
|
||||
@@ -5861,7 +5865,7 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
|
||||
// part can be omitted.
|
||||
//
|
||||
// Returns the value of the flag, or NULL if the parsing failed.
|
||||
const char* ParseFlagValue(const char* str,
|
||||
static const char* ParseFlagValue(const char* str,
|
||||
const char* flag,
|
||||
bool def_optional) {
|
||||
// str and flag must not be NULL.
|
||||
@@ -5899,7 +5903,7 @@ const char* ParseFlagValue(const char* str,
|
||||
//
|
||||
// On success, stores the value of the flag in *value, and returns
|
||||
// true. On failure, returns false without changing *value.
|
||||
bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
||||
static bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
||||
// Gets the value of the flag as a string.
|
||||
const char* const value_str = ParseFlagValue(str, flag, true);
|
||||
|
||||
@@ -5933,7 +5937,7 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
|
||||
//
|
||||
// On success, stores the value of the flag in *value, and returns
|
||||
// true. On failure, returns false without changing *value.
|
||||
bool ParseStringFlag(const char* str, const char* flag, String* value) {
|
||||
static bool ParseStringFlag(const char* str, const char* flag, String* value) {
|
||||
// Gets the value of the flag as a string.
|
||||
const char* const value_str = ParseFlagValue(str, flag, false);
|
||||
|
||||
@@ -6407,7 +6411,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
|
||||
// message is propagated back to the parent process. Otherwise, the
|
||||
// message is simply printed to stderr. In either case, the program
|
||||
// then exits with status 1.
|
||||
void DeathTestAbort(const String& message) {
|
||||
static void DeathTestAbort(const String& message) {
|
||||
// On a POSIX system, this function may be called from a threadsafe-style
|
||||
// death test child process, which operates on a very small stack. Use
|
||||
// the heap for any additional non-minuscule memory requirements.
|
||||
@@ -7139,7 +7143,7 @@ bool StackLowerThanAddress(const void* ptr) {
|
||||
return &dummy < ptr;
|
||||
}
|
||||
|
||||
bool StackGrowsDown() {
|
||||
static bool StackGrowsDown() {
|
||||
int dummy;
|
||||
return StackLowerThanAddress(&dummy);
|
||||
}
|
||||
@@ -8391,7 +8395,7 @@ static CapturedStream* g_captured_stderr = NULL;
|
||||
static CapturedStream* g_captured_stdout = NULL;
|
||||
|
||||
// Starts capturing an output stream (stdout/stderr).
|
||||
void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||
static void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||
if (*stream != NULL) {
|
||||
GTEST_LOG_(FATAL) << "Only one " << stream_name
|
||||
<< " capturer can exist at a time.";
|
||||
@@ -8400,7 +8404,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||
}
|
||||
|
||||
// Stops capturing the output stream and returns the captured string.
|
||||
String GetCapturedStream(CapturedStream** captured_stream) {
|
||||
static String GetCapturedStream(CapturedStream** captured_stream) {
|
||||
const String content = (*captured_stream)->GetCapturedString();
|
||||
|
||||
delete *captured_stream;
|
||||
@@ -8603,9 +8607,9 @@ using ::std::ostream;
|
||||
|
||||
#if GTEST_OS_WINDOWS_MOBILE // Windows CE does not define _snprintf_s.
|
||||
# define snprintf _snprintf
|
||||
#elif _MSC_VER >= 1400 // VC 8.0 and later deprecate snprintf and _snprintf.
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400 // VC 8.0 and later deprecate snprintf and _snprintf.
|
||||
# define snprintf _snprintf_s
|
||||
#elif _MSC_VER
|
||||
#elif defined(_MSC_VER) && _MSC_VER
|
||||
# define snprintf _snprintf
|
||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@ const char *command_line_keys =
|
||||
"{ |perf_seed |809564 |seed for random numbers generator}"
|
||||
"{ |perf_tbb_nthreads |-1 |if TBB is enabled, the number of TBB threads}"
|
||||
"{ |perf_write_sanity |false |allow to create new records for sanity checks}"
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
"{ |perf_time_limit |6.0 |default time limit for a single test (in seconds)}"
|
||||
"{ |perf_affinity_mask |0 |set affinity mask for the main thread}"
|
||||
"{ |perf_log_power_checkpoints |false |additional xml logging for power measurement}"
|
||||
@@ -37,7 +37,7 @@ static uint64 param_seed;
|
||||
static double param_time_limit;
|
||||
static int param_tbb_nthreads;
|
||||
static bool param_write_sanity;
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
static int param_affinity_mask;
|
||||
static bool log_power_checkpoints;
|
||||
|
||||
@@ -57,7 +57,7 @@ static void setCurrentThreadAffinityMask(int mask)
|
||||
|
||||
#endif
|
||||
|
||||
void randu(cv::Mat& m)
|
||||
static void randu(cv::Mat& m)
|
||||
{
|
||||
const int bigValue = 0x00000FFF;
|
||||
if (m.depth() < CV_32F)
|
||||
@@ -151,7 +151,7 @@ void Regression::init(const std::string& testSuitName, const std::string& ext)
|
||||
{
|
||||
LOGE("Failed to open sanity data for reading: %s", storageInPath.c_str());
|
||||
}
|
||||
|
||||
|
||||
if(!storageIn.isOpened())
|
||||
storageOutPath = storageInPath;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ void TestBase::Init(int argc, const char* const argv[])
|
||||
param_force_samples = args.get<unsigned int>("perf_force_samples");
|
||||
param_write_sanity = args.get<bool>("perf_write_sanity");
|
||||
param_tbb_nthreads = args.get<int>("perf_tbb_nthreads");
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
param_affinity_mask = args.get<int>("perf_affinity_mask");
|
||||
log_power_checkpoints = args.get<bool>("perf_log_power_checkpoints");
|
||||
#endif
|
||||
@@ -584,9 +584,17 @@ int64 TestBase::_calibrate()
|
||||
return (int64)compensation;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4355) // 'this' : used in base member initializer list
|
||||
#endif
|
||||
TestBase::TestBase(): declare(this)
|
||||
{
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
void TestBase::declareArray(SizeVector& sizes, cv::InputOutputArray a, int wtype)
|
||||
{
|
||||
@@ -636,17 +644,17 @@ cv::Size TestBase::getSize(cv::InputArray a)
|
||||
bool TestBase::next()
|
||||
{
|
||||
bool has_next = ++currentIter < nIters && totalTime < timeLimit;
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
if (log_power_checkpoints)
|
||||
{
|
||||
timeval tim;
|
||||
gettimeofday(&tim, NULL);
|
||||
unsigned long long t1 = tim.tv_sec * 1000LLU + (unsigned long long)(tim.tv_usec / 1000.f);
|
||||
|
||||
|
||||
if (currentIter == 1) RecordProperty("test_start", cv::format("%llu",t1).c_str());
|
||||
if (!has_next) RecordProperty("test_complete", cv::format("%llu",t1).c_str());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return has_next;
|
||||
}
|
||||
|
||||
@@ -896,7 +904,7 @@ void TestBase::SetUp()
|
||||
p_tbb_initializer=new tbb::task_scheduler_init(param_tbb_nthreads);
|
||||
}
|
||||
#endif
|
||||
#if ANDROID
|
||||
#ifdef ANDROID
|
||||
if (param_affinity_mask)
|
||||
setCurrentThreadAffinityMask(param_affinity_mask);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user