38 lines · plain
1# Test no input file2RUN: not llvm-cgdata --convert --output - 2>&1 | FileCheck %s --check-prefix=NOFILE --ignore-case3NOFILE: error: No input file is specified.4 5# Test for empty cgdata file, which is invalid.6RUN: touch %t_emptyfile.cgtext7RUN: not llvm-cgdata --convert %t_emptyfile.cgtext --format text 2>&1 | FileCheck %s --check-prefix=EMPTY8EMPTY: {{.}}emptyfile.cgtext: empty codegen data9 10# Test for empty header in the text format. It can be converted to a valid binary file.11RUN: printf '#' > %t_emptyheader.cgtext12RUN: llvm-cgdata --convert %t_emptyheader.cgtext --format binary -o %t_emptyheader.cgdata13 14# Without any cgdata other than the header, no data shows by default.15RUN: llvm-cgdata --show %t_emptyheader.cgdata | count 016 17# The version number appears when asked, as it's in the header18RUN: llvm-cgdata --show --cgdata-version %t_emptyheader.cgdata | FileCheck %s --check-prefix=VERSION19VERSION: Version: 420 21# When converting a binary file (w/ the header only) to a text file, it's an empty file as the text format does not have an explicit header.22RUN: llvm-cgdata --convert %t_emptyheader.cgdata --format text | count 023 24# Synthesize a header only cgdata.25# struct Header {26# uint64_t Magic;27# uint32_t Version;28# uint32_t DataKind;29# uint64_t OutlinedHashTreeOffset;30# uint64_t StableFunctionMapOffset;31# }32RUN: printf '\377cgdata\201' > %t_header.cgdata33RUN: printf '\004\000\000\000' >> %t_header.cgdata34RUN: printf '\000\000\000\000' >> %t_header.cgdata35RUN: printf '\040\000\000\000\000\000\000\000' >> %t_header.cgdata36RUN: printf '\040\000\000\000\000\000\000\000' >> %t_header.cgdata37RUN: diff %t_header.cgdata %t_emptyheader.cgdata38