mirror of
https://github.com/google/cpu_features.git
synced 2025-07-01 05:11:15 +02:00
Fix ARMv6 on Linux vs Android (#81)
This commit is contained in:

committed by
Guillaume Chatelet

parent
bfb4cf99cc
commit
18342789a1
@ -102,7 +102,11 @@ static bool HandleArmLine(const LineResult result, ArmInfo* const info,
|
||||
const StringView digits =
|
||||
CpuFeatures_StringView_KeepFront(value, IndexOfNonDigit(value));
|
||||
info->architecture = CpuFeatures_StringView_ParsePositiveNumber(digits);
|
||||
} else if (CpuFeatures_StringView_IsEquals(key, str("Processor"))) {
|
||||
} else if (CpuFeatures_StringView_IsEquals(key, str("Processor"))
|
||||
|| CpuFeatures_StringView_IsEquals(key, str("model name")) ) {
|
||||
// Android reports this in a non-Linux standard "Processor" but sometimes
|
||||
// also in "model name", Linux reports it only in "model name"
|
||||
// see RaspberryPiZero (Linux) vs InvalidArmv7 (Android) test-cases
|
||||
proc_info->processor_reports_armv6 =
|
||||
CpuFeatures_StringView_IndexOf(value, str("(v6l)")) >= 0;
|
||||
} else if (CpuFeatures_StringView_IsEquals(key, str("Hardware"))) {
|
||||
|
@ -83,6 +83,7 @@ CPU revision : 3)");
|
||||
EXPECT_FALSE(info.features.crc32);
|
||||
}
|
||||
|
||||
// Linux test-case
|
||||
TEST(CpuinfoArmTest, RaspberryPiZero) {
|
||||
DisableHardwareCapabilities();
|
||||
auto& fs = GetEmptyFilesystem();
|
||||
@ -104,7 +105,7 @@ Serial : 000000006cd946f3)");
|
||||
EXPECT_EQ(info.variant, 0x0);
|
||||
EXPECT_EQ(info.part, 0xb76);
|
||||
EXPECT_EQ(info.revision, 7);
|
||||
EXPECT_EQ(info.architecture, 7);
|
||||
EXPECT_EQ(info.architecture, 6);
|
||||
|
||||
EXPECT_TRUE(info.features.half);
|
||||
EXPECT_TRUE(info.features.thumb);
|
||||
@ -127,6 +128,7 @@ Serial : 000000006cd946f3)");
|
||||
EXPECT_FALSE(info.features.crc32);
|
||||
}
|
||||
|
||||
// Android test-case
|
||||
// http://code.google.com/p/android/issues/detail?id=10812
|
||||
TEST(CpuinfoArmTest, InvalidArmv7) {
|
||||
DisableHardwareCapabilities();
|
||||
@ -168,6 +170,7 @@ Serial : 33323613546d00ec )");
|
||||
EXPECT_FALSE(info.features.crc32);
|
||||
}
|
||||
|
||||
// Android test-case
|
||||
// https://crbug.com/341598.
|
||||
TEST(CpuinfoArmTest, InvalidNeon) {
|
||||
auto& fs = GetEmptyFilesystem();
|
||||
|
Reference in New Issue
Block a user