Skip to content

Commit a6ed43b

Browse files
rorthllvmbot
authored andcommitted
[sanitizer_common][test] Fix SanitizerIoctl/KVM_GET_* tests on Linux/… (llvm#100532)
…sparc64 Two ioctl tests `FAIL` on Linux/sparc64 (both 32 and 64-bit): ``` SanitizerCommon-Unit :: ./Sanitizer-sparc-Test/SanitizerIoctl/KVM_GET_LAPIC SanitizerCommon-Unit :: ./Sanitizer-sparc-Test/SanitizerIoctl/KVM_GET_MP_STATE ``` like ``` compiler-rt/lib/sanitizer_common/tests/./Sanitizer-sparc-Test --gtest_filter=SanitizerIoctl.KVM_GET_LAPIC -- compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp:91: Failure Value of: res Actual: false Expected: true compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp:92: Failure Expected equality of these values: ioctl_desc::WRITE Which is: 2 desc.type Which is: 1 ``` The problem is that Linux/sparc64, like Linux/mips, uses a different layout for the `ioctl` `request` arg than most other Linux targets as can be seen in `sanitizer_platform_limits_posix.h` (`IOC_*`). Therefore, this patch makes the tests use the correct one. Tested on `sparc64-unknown-linux-gnu` and `x86_64-pc-linux-gnu`. (cherry picked from commit 9eefe06)
1 parent 404746b commit a6ed43b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler-rt/lib/sanitizer_common/tests/sanitizer_ioctl_test.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ TEST(SanitizerIoctl, Fixup) {
7777
// Test decoding KVM ioctl numbers.
7878
TEST(SanitizerIoctl, KVM_GET_MP_STATE) {
7979
ioctl_desc desc;
80-
unsigned int desc_value = SANITIZER_MIPS ? 0x4004ae98U : 0x8004ae98U;
80+
unsigned int desc_value =
81+
SANITIZER_MIPS || SANITIZER_SPARC ? 0x4004ae98U : 0x8004ae98U;
8182
bool res = ioctl_decode(desc_value, &desc);
8283
EXPECT_TRUE(res);
8384
EXPECT_EQ(ioctl_desc::WRITE, desc.type);
@@ -86,7 +87,8 @@ TEST(SanitizerIoctl, KVM_GET_MP_STATE) {
8687

8788
TEST(SanitizerIoctl, KVM_GET_LAPIC) {
8889
ioctl_desc desc;
89-
unsigned int desc_value = SANITIZER_MIPS ? 0x4400ae8eU : 0x8400ae8eU;
90+
unsigned int desc_value =
91+
SANITIZER_MIPS || SANITIZER_SPARC ? 0x4400ae8eU : 0x8400ae8eU;
9092
bool res = ioctl_decode(desc_value, &desc);
9193
EXPECT_TRUE(res);
9294
EXPECT_EQ(ioctl_desc::WRITE, desc.type);

0 commit comments

Comments
 (0)