[DebugInfo][test] Attempt to fix big endian build bots

Commit 9782c922c broke them since it prints raw bytes, whose order will
be different dependent on the endianness of the host.
This commit is contained in:
James Henderson 2020-06-23 12:33:19 +01:00
parent 36bab8484d
commit 01fee8dce5
1 changed files with 15 additions and 0 deletions

View File

@ -1443,6 +1443,21 @@ struct TruncatedExtendedOpcodeFixture
void SetUp() { void SetUp() {
std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput, std::tie(BodyLength, OpcodeLength, Opcode, Operands, ExpectedOutput,
ExpectedErr) = GetParam(); ExpectedErr) = GetParam();
// Swap the byte order of the operands on big endian hosts, so that the raw
// bytes are always in the same order. ValLen.Value is a uint64_t, so make
// sure to shift the value back to the actually used bits for the
// appropriate type.
if (sys::IsBigEndianHost)
for (LineTable::ValueAndLength &ValLen : Operands)
if (ValLen.Length != LineTable::SLEB &&
ValLen.Length != LineTable::ULEB &&
ValLen.Length != LineTable::Byte) {
sys::swapByteOrder(ValLen.Value);
if (ValLen.Length == LineTable::Long)
ValLen.Value >>= 32;
if (ValLen.Length == LineTable::Half)
ValLen.Value >>= 48;
}
} }
uint64_t OpcodeLength; uint64_t OpcodeLength;