blob: bf5e3ff6a4ed07ac7d6ba7769d3be96fffb62972 [file] [log] [blame] [edit]
# Test various error cases
# Synthesize a header only cgdata.
# struct Header {
# uint64_t Magic;
# uint32_t Version;
# uint32_t DataKind;
# uint64_t OutlinedHashTreeOffset;
# uint64_t StableFunctionMapOffset;
# }
RUN: touch %t_empty.cgdata
RUN: not llvm-cgdata --show %t_empty.cgdata 2>&1 | FileCheck %s --check-prefix=EMPTY
EMPTY: {{.}}cgdata: empty codegen data
# Not a magic.
RUN: printf '\377' > %t_malformed.cgdata
RUN: not llvm-cgdata --show %t_malformed.cgdata 2>&1 | FileCheck %s --check-prefix=MALFORMED
MALFORMED: {{.}}cgdata: malformed codegen data
# The minimum header size is 24.
RUN: printf '\377cgdata\201' > %t_corrupt.cgdata
RUN: not llvm-cgdata --show %t_corrupt.cgdata 2>&1 | FileCheck %s --check-prefix=CORRUPT
CORRUPT: {{.}}cgdata: invalid codegen data (file header is corrupt)
# The current version 4 while the header says 5.
RUN: printf '\377cgdata\201' > %t_version.cgdata
RUN: printf '\005\000\000\000' >> %t_version.cgdata
RUN: printf '\000\000\000\000' >> %t_version.cgdata
RUN: printf '\040\000\000\000\000\000\000\000' >> %t_version.cgdata
RUN: printf '\040\000\000\000\000\000\000\000' >> %t_version.cgdata
RUN: not llvm-cgdata --show %t_version.cgdata 2>&1 | FileCheck %s --check-prefix=BAD_VERSION
BAD_VERSION: {{.}}cgdata: unsupported codegen data version
# Header says an outlined hash tree, but the file ends after the header.
RUN: printf '\377cgdata\201' > %t_eof.cgdata
RUN: printf '\002\000\000\000' >> %t_eof.cgdata
RUN: printf '\001\000\000\000' >> %t_eof.cgdata
RUN: printf '\040\000\000\000\000\000\000\000' >> %t_eof.cgdata
RUN: printf '\040\000\000\000\000\000\000\000' >> %t_eof.cgdata
RUN: not llvm-cgdata --show %t_eof.cgdata 2>&1 | FileCheck %s --check-prefix=EOF
EOF: {{.}}cgdata: end of File