mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Merge pull request #20995 from mpashchenkov:mp/ocv-gapi-tdp-skip
G-API: Removing G-API test code that is a reflection of ts module * gapi: don't hijack testing infrastructure * Removed initDataPath functionality (ts module exists) * Removed false for ocv_extra data from findDataFile Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
parent
c7df82460c
commit
2f6d2b08aa
@ -159,7 +159,6 @@ PERF_TEST_P_(BuildPyr_CalcOptFlow_PipelinePerfTest, TestPerformance)
|
||||
PERF_TEST_P_(BackgroundSubtractorPerfTest, TestPerformance)
|
||||
{
|
||||
namespace gvideo = cv::gapi::video;
|
||||
initTestDataPath();
|
||||
|
||||
gvideo::BackgroundSubtractorType opType;
|
||||
std::string filePath = "";
|
||||
|
@ -58,40 +58,6 @@ namespace
|
||||
return o;
|
||||
}
|
||||
|
||||
inline bool initTestDataPathSilent()
|
||||
{
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath != nullptr) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
return initialized;
|
||||
#endif // WINRT
|
||||
}
|
||||
|
||||
inline void initTestDataPath()
|
||||
{
|
||||
bool initialized = initTestDataPathSilent();
|
||||
GAPI_Assert(initialized &&
|
||||
"OPENCV_TEST_DATA_PATH environment variable is either not set or set incorrectly.");
|
||||
}
|
||||
|
||||
inline void initTestDataPathOrSkip()
|
||||
{
|
||||
bool initialized = initTestDataPathSilent();
|
||||
if (!initialized)
|
||||
{
|
||||
throw cvtest::SkipTestException("Can't find test data");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T> inline void initPointRandU(cv::RNG &rng, cv::Point_<T>& pt)
|
||||
{
|
||||
GAPI_Assert(std::is_integral<T>::value);
|
||||
@ -299,7 +265,6 @@ public:
|
||||
|
||||
void initMatFromImage(int type, const std::string& fileName)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
int channels = (type >> CV_CN_SHIFT) + 1;
|
||||
GAPI_Assert(channels == 1 || channels == 3 || channels == 4);
|
||||
@ -323,7 +288,6 @@ public:
|
||||
|
||||
void initMatsFromImages(int channels, const std::string& pattern, int imgNum)
|
||||
{
|
||||
initTestDataPath();
|
||||
GAPI_Assert(channels == 1 || channels == 3 || channels == 4);
|
||||
const int flags = (channels == 1) ? cv::IMREAD_GRAYSCALE : cv::IMREAD_COLOR;
|
||||
|
||||
|
@ -92,8 +92,6 @@ TEST_P(BuildPyr_CalcOptFlow_PipelineTest, AccuracyTest)
|
||||
#ifdef HAVE_OPENCV_VIDEO
|
||||
TEST_P(BackgroundSubtractorTest, AccuracyTest)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::gapi::video::BackgroundSubtractorType opType;
|
||||
double thr = -1;
|
||||
std::tie(opType, thr) = typeAndThreshold;
|
||||
|
@ -43,22 +43,6 @@ namespace opencv_test
|
||||
//----------------------------------------------- Simple tests ------------------------------------------------
|
||||
namespace
|
||||
{
|
||||
inline void initTestDataPath()
|
||||
{
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
#endif // WINRT
|
||||
}
|
||||
|
||||
G_TYPED_KERNEL(GCountCalls, <cv::GOpaque<int>(GMat)>, "org.opencv.test.count_calls")
|
||||
{
|
||||
static GOpaqueDesc outMeta(GMatDesc /* in */) { return empty_gopaque_desc(); }
|
||||
@ -181,8 +165,6 @@ TEST(StatefulKernel, StateIsMutableInRuntime)
|
||||
|
||||
TEST(StatefulKernel, StateIsAutoResetForNewStream)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GOpaque<bool> out = GIsStateUpToDate::on(in);
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
@ -329,8 +311,6 @@ namespace
|
||||
|
||||
TEST(StatefulKernel, StateIsInitViaCompArgsInStreaming)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
// G-API graph declaration
|
||||
cv::GMat in;
|
||||
cv::GMat out = GBackSub::on(in);
|
||||
|
@ -13,23 +13,6 @@
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
namespace {
|
||||
void initTestDataPath() {
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath != nullptr) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
#endif // WINRT
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
TEST(GraphMeta, Trad_AccessInput) {
|
||||
cv::GMat in;
|
||||
cv::GMat out1 = cv::gapi::blur(in, cv::Size(3,3));
|
||||
@ -91,8 +74,6 @@ TEST(GraphMeta, Trad_AccessOutput) {
|
||||
}
|
||||
|
||||
TEST(GraphMeta, Streaming_AccessInput) {
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat out1 = cv::gapi::blur(in, cv::Size(3,3));
|
||||
cv::GOpaque<int64_t> out2 = cv::gapi::streaming::seq_id(in);
|
||||
@ -118,8 +99,6 @@ TEST(GraphMeta, Streaming_AccessInput) {
|
||||
}
|
||||
|
||||
TEST(GraphMeta, Streaming_AccessOutput) {
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat out1 = cv::gapi::blur(in, cv::Size(3,3));
|
||||
cv::GOpaque<int64_t> out2 = cv::gapi::streaming::seq_id(out1);
|
||||
@ -151,8 +130,6 @@ TEST(GraphMeta, Streaming_AccessOutput) {
|
||||
}
|
||||
|
||||
TEST(GraphMeta, Streaming_AccessDesync) {
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GOpaque<int64_t> out1 = cv::gapi::streaming::seq_id(in);
|
||||
cv::GOpaque<int64_t> out2 = cv::gapi::streaming::timestamp(in);
|
||||
|
@ -39,21 +39,6 @@
|
||||
namespace opencv_test
|
||||
{
|
||||
namespace {
|
||||
void initTestDataPath()
|
||||
{
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
#endif // WINRT
|
||||
}
|
||||
|
||||
class TestMediaBGR final: public cv::MediaFrame::IAdapter {
|
||||
cv::Mat m_mat;
|
||||
@ -1489,7 +1474,6 @@ TEST(Infer, SetInvalidNumberOfRequests)
|
||||
|
||||
TEST(Infer, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
@ -1557,7 +1541,6 @@ TEST(Infer, TestStreamingInfer)
|
||||
|
||||
TEST(InferROI, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
@ -1636,7 +1619,6 @@ TEST(InferROI, TestStreamingInfer)
|
||||
|
||||
TEST(InferList, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
@ -1726,7 +1708,6 @@ TEST(InferList, TestStreamingInfer)
|
||||
|
||||
TEST(Infer2, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
@ -1817,7 +1798,6 @@ TEST(Infer2, TestStreamingInfer)
|
||||
|
||||
TEST(InferEmptyList, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
@ -1872,7 +1852,6 @@ TEST(InferEmptyList, TestStreamingInfer)
|
||||
|
||||
TEST(Infer2EmptyList, TestStreamingInfer)
|
||||
{
|
||||
initTestDataPath();
|
||||
initDLDTDataPath();
|
||||
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
|
@ -83,21 +83,6 @@ cv::Mat initMatrixRandU(const int type, const cv::Size& sz_in) {
|
||||
namespace opencv_test
|
||||
{
|
||||
namespace {
|
||||
void initTestDataPath()
|
||||
{
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
#endif // WINRT
|
||||
}
|
||||
|
||||
// FIXME: taken from the DNN module
|
||||
void normAssert(cv::InputArray& ref, cv::InputArray& test,
|
||||
@ -322,7 +307,6 @@ public:
|
||||
cv::Mat in_mat;
|
||||
|
||||
ONNXtest() {
|
||||
initTestDataPath();
|
||||
env = Ort::Env(ORT_LOGGING_LEVEL_WARNING, "test");
|
||||
memory_info = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault);
|
||||
out_gapi.resize(1);
|
||||
|
@ -40,21 +40,6 @@ namespace opencv_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
void initTestDataPath()
|
||||
{
|
||||
#ifndef WINRT
|
||||
static bool initialized = false;
|
||||
if (!initialized)
|
||||
{
|
||||
// Since G-API has no own test data (yet), it is taken from the common space
|
||||
const char* testDataPath = getenv("OPENCV_TEST_DATA_PATH");
|
||||
if (testDataPath) {
|
||||
cvtest::addDataSearchPath(testDataPath);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
#endif // WINRT
|
||||
}
|
||||
|
||||
enum class KernelPackage: int
|
||||
{
|
||||
@ -81,7 +66,6 @@ std::ostream& operator<< (std::ostream &os, const KernelPackage &e)
|
||||
struct GAPI_Streaming: public ::testing::TestWithParam<std::tuple<KernelPackage,
|
||||
cv::optional<size_t>>> {
|
||||
GAPI_Streaming() {
|
||||
initTestDataPath();
|
||||
KernelPackage pkg_kind;
|
||||
std::tie(pkg_kind, cap) = GetParam();
|
||||
pkg = getKernelPackage(pkg_kind);
|
||||
@ -846,8 +830,6 @@ TEST(GAPI_Streaming_Types, XChangeScalar)
|
||||
// This test verifies if Streaming works when pipeline steps
|
||||
// (islands) exchange Scalar data.
|
||||
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GScalar m = cv::gapi::mean(in);
|
||||
cv::GMat tmp = cv::gapi::convertTo(in, CV_32F) - m;
|
||||
@ -914,8 +896,6 @@ TEST(GAPI_Streaming_Types, XChangeVector)
|
||||
// This test verifies if Streaming works when pipeline steps
|
||||
// (islands) exchange Vector data.
|
||||
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in1, in2;
|
||||
cv::GMat in = cv::gapi::crop(in1, cv::Rect{0,0,576,576});
|
||||
cv::GScalar m = cv::gapi::mean(in);
|
||||
@ -980,8 +960,6 @@ TEST(GAPI_Streaming_Types, OutputScalar)
|
||||
// This test verifies if Streaming works when pipeline
|
||||
// produces scalar data only
|
||||
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GScalar out = cv::gapi::mean(in);
|
||||
auto sc = cv::GComputation(cv::GIn(in), cv::GOut(out))
|
||||
@ -1019,7 +997,6 @@ TEST(GAPI_Streaming_Types, OutputVector)
|
||||
// This test verifies if Streaming works when pipeline
|
||||
// produces vector data only
|
||||
|
||||
initTestDataPath();
|
||||
auto pkg = cv::gapi::kernels<TypesTest::OCVSumV>();
|
||||
|
||||
cv::GMat in1, in2;
|
||||
@ -1181,7 +1158,6 @@ struct GAPI_Streaming_Unit: public ::testing::Test {
|
||||
return cv::GComputation(cv::GIn(a, b), cv::GOut(c));
|
||||
})
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
const auto a_desc = cv::descr_of(m);
|
||||
const auto b_desc = cv::descr_of(m);
|
||||
@ -1196,7 +1172,6 @@ struct GAPI_Streaming_Unit: public ::testing::Test {
|
||||
|
||||
TEST(GAPI_Streaming, TestTwoVideosDifferentLength)
|
||||
{
|
||||
initTestDataPath();
|
||||
auto desc = cv::GMatDesc{CV_8U,3,{768,576}};
|
||||
auto path1 = findDataFile("cv/video/768x576.avi");
|
||||
auto path2 = findDataFile("highgui/video/big_buck_bunny.avi");
|
||||
@ -1458,8 +1433,6 @@ TEST(GAPI_Streaming_Desync, SmokeTest_Regular)
|
||||
|
||||
TEST(GAPI_Streaming_Desync, SmokeTest_Streaming)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat tmp1 = cv::gapi::boxFilter(in, -1, cv::Size(3,3));
|
||||
cv::GMat out1 = cv::gapi::Canny(tmp1, 32, 128, 3);
|
||||
@ -1491,8 +1464,6 @@ TEST(GAPI_Streaming_Desync, SmokeTest_Streaming)
|
||||
|
||||
TEST(GAPI_Streaming_Desync, SmokeTest_Streaming_TwoParts)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat tmp1 = cv::gapi::boxFilter(in, -1, cv::Size(3,3));
|
||||
cv::GMat out1 = cv::gapi::Canny(tmp1, 32, 128, 3);
|
||||
@ -1628,8 +1599,6 @@ TEST(GAPI_Streaming_Desync, Negative_CrossOtherDesync_Tier1)
|
||||
|
||||
TEST(GAPI_Streaming_Desync, Negative_SynchronizedPull)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat out1 = cv::gapi::boxFilter(in, -1, cv::Size(3,3));
|
||||
|
||||
@ -1653,8 +1622,6 @@ TEST(GAPI_Streaming_Desync, Negative_SynchronizedPull)
|
||||
|
||||
TEST(GAPI_Streaming_Desync, UseSpecialPull)
|
||||
{
|
||||
initTestDataPath();
|
||||
|
||||
cv::GMat in;
|
||||
cv::GMat out1 = cv::gapi::boxFilter(in, -1, cv::Size(3,3));
|
||||
|
||||
@ -1811,7 +1778,6 @@ TEST(GAPI_Streaming_Desync, DesyncObjectConsumedByTwoIslandsViaSameDesync) {
|
||||
|
||||
TEST(GAPI_Streaming, CopyFrame)
|
||||
{
|
||||
initTestDataPath();
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
|
||||
cv::GFrame in;
|
||||
@ -1850,7 +1816,6 @@ TEST(GAPI_Streaming, CopyFrame)
|
||||
|
||||
TEST(GAPI_Streaming, CopyMat)
|
||||
{
|
||||
initTestDataPath();
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
|
||||
cv::GMat in;
|
||||
@ -1887,7 +1852,6 @@ TEST(GAPI_Streaming, CopyMat)
|
||||
|
||||
TEST(GAPI_Streaming, Reshape)
|
||||
{
|
||||
initTestDataPath();
|
||||
std::string filepath = findDataFile("cv/video/768x576.avi");
|
||||
|
||||
cv::GFrame in;
|
||||
@ -2077,8 +2041,7 @@ TEST_P(GAPI_Accessors_In_Streaming, AccuracyTest)
|
||||
auto accessor = gapi_functions[accessType];
|
||||
auto fromBGR = ref_functions[std::make_pair(sourceType, accessType)];
|
||||
|
||||
initTestDataPathOrSkip();
|
||||
const std::string& absFilePath = findDataFile(filepath, false);
|
||||
const std::string& absFilePath = findDataFile(filepath);
|
||||
|
||||
cv::GFrame in;
|
||||
cv::GMat out = accessor(in);
|
||||
@ -2129,8 +2092,7 @@ TEST_P(GAPI_Accessors_Meta_In_Streaming, AccuracyTest)
|
||||
auto accessor = gapi_functions[accessType];
|
||||
auto fromBGR = ref_functions[std::make_pair(sourceType, accessType)];
|
||||
|
||||
initTestDataPathOrSkip();
|
||||
const std::string& absFilePath = findDataFile(filepath, false);
|
||||
const std::string& absFilePath = findDataFile(filepath);
|
||||
|
||||
cv::GFrame in;
|
||||
cv::GMat gmat = accessor(in);
|
||||
@ -2328,7 +2290,6 @@ GAPI_OCV_KERNEL(GOcvTestBlur, GTestBlur) {
|
||||
};
|
||||
|
||||
TEST(GAPI_Streaming, TestDesyncMediaFrame) {
|
||||
initTestDataPath();
|
||||
cv::GFrame in;
|
||||
auto blurred = GTestBlur::on(in);
|
||||
auto desynced = cv::gapi::streaming::desync(blurred);
|
||||
|
@ -9,4 +9,4 @@
|
||||
|
||||
#include "test_precomp.hpp"
|
||||
|
||||
CV_TEST_MAIN("gapi")
|
||||
CV_TEST_MAIN("")
|
||||
|
Loading…
Reference in New Issue
Block a user