Skip to content

Commit

Permalink
Better AArch64 Test Runner (#475)
Browse files Browse the repository at this point in the history
* More detailed AArch64 test runner
  • Loading branch information
artemdinaburg authored Jan 21, 2021
1 parent 4ab86f3 commit ab27539
Showing 1 changed file with 53 additions and 4 deletions.
57 changes: 53 additions & 4 deletions tests/AArch64/Run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,6 @@ static void RunWithFlags(const test::TestInfo *info, NZCV flags,
native_state->hyper_call = AsyncHyperCall::kInvalid;
lifted_state->hyper_call = AsyncHyperCall::kInvalid;

EXPECT_TRUE(lifted_state->sr.n == native_state->sr.n);
EXPECT_TRUE(lifted_state->sr.z == native_state->sr.z);
EXPECT_TRUE(lifted_state->sr.c == native_state->sr.c);
EXPECT_TRUE(lifted_state->sr.v == native_state->sr.v);
EXPECT_TRUE(lifted_state->gpr == native_state->gpr);

// The lifted code won't update these.
Expand All @@ -453,6 +449,59 @@ static void RunWithFlags(const test::TestInfo *info, NZCV flags,
if (gLiftedState != gNativeState) {
LOG(ERROR) << "States did not match for " << desc;
EXPECT_TRUE(!"Lifted and native states did not match.");

#define DIFF(name, a) EXPECT_EQ(lifted_state->a, native_state->a)

DIFF(X0, gpr.x0.qword);
DIFF(X1, gpr.x1.qword);
DIFF(X2, gpr.x2.qword);
DIFF(X3, gpr.x3.qword);
DIFF(X4, gpr.x4.qword);
DIFF(X5, gpr.x5.qword);
DIFF(X6, gpr.x6.qword);
DIFF(X7, gpr.x7.qword);
DIFF(X8, gpr.x8.qword);
DIFF(X9, gpr.x9.qword);
DIFF(X10, gpr.x10.qword);
DIFF(X11, gpr.x11.qword);
DIFF(X12, gpr.x12.qword);
DIFF(X13, gpr.x13.qword);
DIFF(X14, gpr.x14.qword);
DIFF(X15, gpr.x15.qword);
DIFF(X16, gpr.x16.qword);
DIFF(X17, gpr.x17.qword);
DIFF(X18, gpr.x18.qword);
DIFF(X19, gpr.x19.qword);
DIFF(X20, gpr.x20.qword);
DIFF(X21, gpr.x21.qword);
DIFF(X22, gpr.x22.qword);
DIFF(X23, gpr.x23.qword);
DIFF(X24, gpr.x24.qword);
DIFF(X25, gpr.x25.qword);
DIFF(X26, gpr.x26.qword);
DIFF(X27, gpr.x27.qword);
DIFF(X28, gpr.x28.qword);
DIFF(X29, gpr.x29.qword);
DIFF(X30, gpr.x30.qword);

DIFF(IXC, sr.ixc);
DIFF(OFC, sr.ofc);
DIFF(UFC, sr.ufc);
DIFF(IDC, sr.idc);
DIFF(IOC, sr.ioc);

DIFF(N, sr.n);
DIFF(Z, sr.z);
DIFF(C, sr.c);
DIFF(V, sr.v);

auto lifted_state_bytes = reinterpret_cast<uint8_t *>(lifted_state);
auto native_state_bytes = reinterpret_cast<uint8_t *>(native_state);

for (size_t i = 0; i < sizeof(State); ++i) {
LOG_IF(ERROR, lifted_state_bytes[i] != native_state_bytes[i])
<< "Bytes at offset " << i << " are different";
}
}

if (gLiftedStack != gNativeStack) {
Expand Down

0 comments on commit ab27539

Please sign in to comment.