HW compatibility tests added;
authorAlexander Smorkalov <no@email>
Thu, 12 Jul 2012 11:50:40 +0000 (11:50 +0000)
committerAndrey Kamaev <andrey.kamaev@itseez.com>
Tue, 21 Aug 2012 11:29:57 +0000 (15:29 +0400)
Arm-v7a neon package support enabled.

android/service/engine/jni/Android.mk
android/service/engine/jni/NativeService/PackageInfo.cpp
android/service/engine/jni/Tests/OpenCVEngineTest.cpp
android/service/engine/jni/Tests/Tests.mk

index ded931f..be73f6c 100644 (file)
@@ -24,8 +24,8 @@ LOCAL_C_INCLUDES := \
     $(TOP)/system/core/include
 
 LOCAL_CFLAGS += -DPLATFORM_ANDROID
+LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
-#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
 
 LOCAL_PRELINK_MODULE := false
@@ -65,8 +65,8 @@ LOCAL_C_INCLUDES := \
 LOCAL_PRELINK_MODULE := false
 
 LOCAL_CFLAGS += -DPLATFORM_ANDROID
+LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
-#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
 
 LOCAL_MODULE := libOpenCVEngine_jni
index fc6e43d..65828e7 100644 (file)
@@ -206,21 +206,19 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
        {
            if (ARCH_X86 & CpuID)
            {
-               LOGD("Found processor with x86 arch");
+               LOGD("PackageInfo::PackageInfo: package arch x86");
                FullName += string("_") + ARCH_X86_NAME;
 #ifdef __SUPPORT_INTEL_FEATURES
                string features = JoinIntelFeatures(CpuID);
-#else
-               string features;
-#endif
                if (!features.empty())
                {
                    FullName += string("_") + features;
                }
+#endif
            }
            else if (ARCH_X64 & CpuID)
            {
-               LOGD("Found processor with x64 arch");
+               LOGD("PackageInfo::PackageInfo: package arch x64");
 #ifdef __SUPPORT_INTEL_x64
                FullName += string("_") + ARCH_X64_NAME;
 #else
@@ -228,61 +226,53 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
 #endif
 #ifdef __SUPPORT_INTEL_FEATURES
                string features = JoinIntelFeatures(CpuID);
-#else
-               string features;
-#endif
                if (!features.empty())
                {
                    FullName += string("_") + features;
                }
+#endif
            }
            else if (ARCH_ARMv5 & CpuID)
            {
-               LOGD("Found processor with ARMv5 arch");
+               LOGD("PackageInfo::PackageInfo: package arch ARMv5");
                FullName += string("_") + ARCH_ARMv5_NAME;
 #ifdef __SUPPORT_ARMEABI_FEATURES
                string features = JoinARMFeatures(CpuID);
-#else
-               string features;
-#endif
                if (!features.empty())
                {
                    FullName += string("_") + features;
                }
+#endif
            }
            else if (ARCH_ARMv6 & CpuID)
            {
-               LOGD("Found processor with ARMv6 arch");
+               LOGD("PackageInfo::PackageInfo: package arch ARMv6");
                // NOTE: ARM v5 used instead ARM v6
                //FullName += string("_") + ARCH_ARMv6_NAME;
                FullName += string("_") + ARCH_ARMv5_NAME;
 #ifdef __SUPPORT_ARMEABI_FEATURES
                string features = JoinARMFeatures(CpuID);
-#else
-               string features;
-#endif
                if (!features.empty())
                {
                    FullName += string("_") + features;
                }
+#endif
            }
            else if (ARCH_ARMv7 & CpuID)
            {
-               LOGD("Found processor with ARMv7 arch");
+               LOGD("PackageInfo::PackageInfo: package arch ARMv7");
                FullName += string("_") + ARCH_ARMv7_NAME;
 #ifdef __SUPPORT_ARMEABI_V7A_FEATURES
                string features = JoinARMFeatures(CpuID);
-#else
-               string features;
-#endif
                if (!features.empty())
                {
                    FullName += string("_") + features;
                }
+#endif
            }
            else if (ARCH_ARMv8 & CpuID)
            {
-               LOGD("Found processor with ARMv8 arch");
+               LOGD("PackageInfo::PackageInfo: package arch ARMv8");
 #ifdef __SUPPORT_ARMEABI_V8            
                FullName += string("_") + ARCH_ARMv8_NAME;
 #else
@@ -296,7 +286,7 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
            }
            else
            {
-               LOGD("Found processor with unknown arch");
+               LOGD("PackageInfo::PackageInfo: package arch unknown");
                Version.clear();
                CpuID = ARCH_UNKNOWN;
                Platform = PLATFORM_UNKNOWN;
@@ -304,7 +294,7 @@ PackageInfo::PackageInfo(const string& version, int platform, int cpu_id, std::s
        }
        else
        {
-           LOGD("Found processor with unknown arch");
+           LOGD("PackageInfo::PackageInfo: package arch unknown");
            Version.clear();
            CpuID = ARCH_UNKNOWN;
            Platform = PLATFORM_UNKNOWN;
index a198a47..4ea8b3d 100644 (file)
@@ -118,6 +118,44 @@ TEST(OpenCVEngineTest, GetPathForUnExistVersion)
     EXPECT_EQ(0, result.size());
 }
 
+TEST(OpenCVEngineTest, GetPathForCompatiblePackage1)
+{
+    sp<IOpenCVEngine> Engine = InitConnect();
+    Starter.PackageManager->InstalledPackages.clear();
+    Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_ARMv5);
+    EXPECT_FALSE(NULL == Engine.get());
+    String16 result = Engine->GetLibPathByVersion(String16("2.4"));    
+    EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv5/lib", String8(result).string());
+}
+
+TEST(OpenCVEngineTest, GetPathForCompatiblePackage2)
+{
+    sp<IOpenCVEngine> Engine = InitConnect();
+    Starter.PackageManager->InstalledPackages.clear();
+    Starter.PackageManager->InstallVersion("242", PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_NEON);
+    EXPECT_FALSE(NULL == Engine.get());
+    String16 result = Engine->GetLibPathByVersion(String16("2.4"));
+#ifdef __SUPPORT_TEGRA3
+    EXPECT_STREQ("/data/data/org.opencv.lib_v24_tegra3/lib", String8(result).string());
+#else
+#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
+    EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a_neon/lib", String8(result).string());
+#else
+    EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a/lib", String8(result).string());
+#endif
+#endif
+}
+
+TEST(OpenCVEngineTest, GetPathForInCompatiblePackage1)
+{
+    sp<IOpenCVEngine> Engine = InitConnect();
+    Starter.PackageManager->InstalledPackages.clear();
+    Starter.PackageManager->InstallVersion("242", PLATFORM_UNKNOWN, ARCH_X64);
+    EXPECT_FALSE(NULL == Engine.get());
+    String16 result = Engine->GetLibPathByVersion(String16("2.4"));    
+    EXPECT_EQ(0, result.size());
+}
+
 TEST(OpenCVEngineTest, InstallAndGetVersion)
 {
     sp<IOpenCVEngine> Engine = InitConnect();
index 4fe1111..3dab5f0 100644 (file)
@@ -17,7 +17,7 @@ LOCAL_SRC_FILES := \
     Tests/PackageManagmentTest.cpp \
     Tests/PackageInfoTest.cpp \
     Tests/OpenCVEngineTest.cpp \
-     Tests/TestMain.cpp
+    Tests/TestMain.cpp
 #     Tests/HardwareDetectionTest.cpp \
 
 LOCAL_C_INCLUDES := \
@@ -31,8 +31,8 @@ LOCAL_C_INCLUDES := \
     $(TOP)/system/core/include
 
 LOCAL_CFLAGS += -O0 -DGTEST_HAS_CLONE=0 -DGTEST_OS_LINUX_ANDROID=1 -DGTEST_HAS_TR1_TUPLE=0
+LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
-#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
 
 LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined