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
This commit is contained in:
fbarchard@google.com 2014-03-07 23:22:24 +00:00
parent cb3344ae25
commit 996dacac87
3 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 980
Version: 981
License: BSD
License File: LICENSE

View File

@ -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

View File

@ -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
}