Fix the AT_HWCAP2 test.
"I have none of these capabilities" is a legitimate response, and
distinct from "I don't know what my capabilities are". It's the latter
I meant to test for.
Bug: http://b/27810985
Change-Id: Id165423e62390051cbf23fdda54f28d94566cbe7
diff --git a/tests/getauxval_test.cpp b/tests/getauxval_test.cpp
index 6499f89..54458c4 100644
--- a/tests/getauxval_test.cpp
+++ b/tests/getauxval_test.cpp
@@ -67,7 +67,11 @@
// If this test fails, apps that use getauxval to decide at runtime whether crypto hardware is
// available will incorrectly assume that it isn't, and will have really bad performance.
// If this test fails, ensure that you've enabled COMPAT_BINFMT_ELF in your kernel configuration.
- ASSERT_NE(0UL, getauxval(AT_HWCAP2)) << "kernel not reporting AT_HWCAP2 to 32-bit ARM process";
+ // Note that 0 ("I don't support any of these things") is a legitimate response --- we need
+ // to check errno to see whether we got a "true" 0 or a "not found" 0.
+ errno = 0;
+ getauxval(AT_HWCAP2);
+ ASSERT_EQ(0, errno) << "kernel not reporting AT_HWCAP2 to 32-bit ARM process";
#else
GTEST_LOG_(INFO) << "This test is only meaningful for 32-bit ARM code.\n";
#endif