Merge "sys_hwprobe_test.cpp: compare vdso to syscall." into main am: d8708ba8b6
am: 6e0fa4ae74
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2708293 Change-Id: I4f9a5706714ad4a6039522df49f93ae9c2b5d056 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7af5650e81
1 changed files with 24 additions and 1 deletions
|
@ -30,10 +30,11 @@
|
|||
|
||||
#if __has_include(<sys/hwprobe.h>)
|
||||
#include <sys/hwprobe.h>
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
TEST(sys_hwprobe, __riscv_hwprobe) {
|
||||
#if defined(__riscv) && __has_include(<sys/cachectl.h>)
|
||||
#if defined(__riscv) && __has_include(<sys/hwprobe.h>)
|
||||
riscv_hwprobe probes[] = {{.key = RISCV_HWPROBE_KEY_IMA_EXT_0},
|
||||
{.key = RISCV_HWPROBE_KEY_CPUPERF_0}};
|
||||
ASSERT_EQ(0, __riscv_hwprobe(probes, 2, 0, nullptr, 0));
|
||||
|
@ -60,3 +61,25 @@ TEST(sys_hwprobe, __riscv_hwprobe) {
|
|||
GTEST_SKIP() << "__riscv_hwprobe requires riscv64";
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(sys_hwprobe, __riscv_hwprobe_syscall_vdso) {
|
||||
#if defined(__riscv) && __has_include(<sys/hwprobe.h>)
|
||||
riscv_hwprobe probes_vdso[] = {{.key = RISCV_HWPROBE_KEY_IMA_EXT_0},
|
||||
{.key = RISCV_HWPROBE_KEY_CPUPERF_0}};
|
||||
ASSERT_EQ(0, __riscv_hwprobe(probes_vdso, 2, 0, nullptr, 0));
|
||||
|
||||
riscv_hwprobe probes_syscall[] = {{.key = RISCV_HWPROBE_KEY_IMA_EXT_0},
|
||||
{.key = RISCV_HWPROBE_KEY_CPUPERF_0}};
|
||||
ASSERT_EQ(0, syscall(SYS_riscv_hwprobe, probes_syscall, 2, 0, nullptr, 0));
|
||||
|
||||
// Check we got the same answers from the vdso and the syscall.
|
||||
EXPECT_EQ(RISCV_HWPROBE_KEY_IMA_EXT_0, probes_syscall[0].key);
|
||||
EXPECT_EQ(probes_vdso[0].key, probes_syscall[0].key);
|
||||
EXPECT_EQ(probes_vdso[0].value, probes_syscall[0].value);
|
||||
EXPECT_EQ(RISCV_HWPROBE_KEY_CPUPERF_0, probes_syscall[1].key);
|
||||
EXPECT_EQ(probes_vdso[1].key, probes_syscall[1].key);
|
||||
EXPECT_EQ(probes_vdso[1].value, probes_syscall[1].value);
|
||||
#else
|
||||
GTEST_SKIP() << "__riscv_hwprobe requires riscv64";
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue