Attempt to fix buildbots after commit of r295173.

Unit tests needed to check on the endianness of the host platform. (Test was failing for big endian hosts).

llvm-svn: 295174
This commit is contained in:
David Bozier 2017-02-15 13:40:05 +00:00
parent 4ab9a06f6a
commit 5c8e5f3722
1 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
#include <sstream>
@ -23,9 +24,18 @@ TEST(Object, DataRefImplOstream) {
sizeof Data.p == sizeof(uint32_t),
"Test expected pointer type to be 32 or 64-bit.");
char const *Expected = sizeof Data.p == sizeof(uint64_t)
char const *Expected;
if (llvm::sys::IsLittleEndianHost) {
Expected = sizeof Data.p == sizeof(uint64_t)
? "(0xffffeeee0000 (0xeeee0000, 0x0000ffff))"
: "(0xeeee0000 (0xeeee0000, 0x0000ffff))";
}
else {
Expected = sizeof Data.p == sizeof(uint64_t)
? "(0xeeee00000000ffff (0xeeee0000, 0x0000ffff))"
: "(0x0000ffff (0xeeee0000, 0x0000ffff))";
}
OS << Data;
OS.flush();