From 996dacac87801938934d14935607df9f5051f84b Mon Sep 17 00:00:00 2001
From: "fbarchard@google.com"
 <fbarchard@google.com@16f28f9a-4ce2-e073-06de-1de4eb20be90>
Date: Fri, 7 Mar 2014 23:22:24 +0000
Subject: [PATCH] unittest first checks if files exists for neon detection.
 BUG=315 TESTED=untested R=nfullagar@chromium.org, wuwang@google.com

Review URL: https://webrtc-codereview.appspot.com/9589005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@981 16f28f9a-4ce2-e073-06de-1de4eb20be90
---
 README.chromium          |  2 +-
 include/libyuv/version.h |  2 +-
 unit_test/cpu_test.cc    | 20 ++++++++++++++------
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/README.chromium b/README.chromium
index fb729e1d..03976066 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
 Name: libyuv
 URL: http://code.google.com/p/libyuv/
-Version: 980
+Version: 981
 License: BSD
 License File: LICENSE
 
diff --git a/include/libyuv/version.h b/include/libyuv/version.h
index e728a649..543d5e09 100644
--- a/include/libyuv/version.h
+++ b/include/libyuv/version.h
@@ -11,6 +11,6 @@
 #ifndef INCLUDE_LIBYUV_VERSION_H_  // NOLINT
 #define INCLUDE_LIBYUV_VERSION_H_
 
-#define LIBYUV_VERSION 980
+#define LIBYUV_VERSION 981
 
 #endif  // INCLUDE_LIBYUV_VERSION_H_  NOLINT
diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc
index 45579b89..7f8b7485 100644
--- a/unit_test/cpu_test.cc
+++ b/unit_test/cpu_test.cc
@@ -92,16 +92,24 @@ TEST_F(libyuvTest, TestCpuId) {
 }
 #endif
 
+static int FileExists(const char* file_name) {
+  FILE* f = fopen(file_name, "r");
+  if (!f) {
+    return 0;
+  }
+  fclose(f);
+  return 1;
+}
+
 TEST_F(libyuvTest, TestLinuxNeon) {
-  int testdata = ArmCpuCaps("unit_test/testdata/arm_v7.txt");
-  if (testdata) {
-    EXPECT_EQ(0, ArmCpuCaps("unit_test/testdata/arm_v7.txt"));
-    EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("unit_test/testdata/tegra3.txt"));
+  if (FileExists("../../unit_test/testdata/arm_v7.txt")) {
+    EXPECT_EQ(0, ArmCpuCaps("../../unit_test/testdata/arm_v7.txt"));
+    EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("../../unit_test/testdata/tegra3.txt"));
   } else {
-    printf("WARNING: unable to load \"unit_test/testdata/arm_v7.txt\"\n");
+    printf("WARNING: unable to load \"../../unit_test/testdata/arm_v7.txt\"\n");
   }
 #if defined(__linux__) && defined(__ARM_NEON__)
-  EXPECT_NE(0, ArmCpuCaps("/proc/cpuinfo"));
+  EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("/proc/cpuinfo"));
 #endif
 }
 
-- 
2.18.0