xref: /llvm-project/llvm/utils/mlgo-utils/tests/corpus/extract_ir_script.test (revision d3ca779d7264bf0751eb4db632c14d8bc05608ca)
1# REQUIRES: system-linux
2
3## Test that invoking the extract_ir script work as expected.
4
5# RUN: rm -rf %t.dir && mkdir %t.dir
6# RUN: yaml2obj %s -o %t.dir/test1.o
7# RUN: yaml2obj %s -o %t.dir/test2.o
8# RUN: rm -rf %t.dir.out && mkdir %t.dir.out
9
10# RUN: %python %scripts_dir/corpus/extract_ir.py --input=%t.dir --input_type=directory --output_dir=%t.dir.out --llvm_objcopy_path=llvm-objcopy
11# RUN: cat %t.dir.out/corpus_description.json | FileCheck %s
12
13## Check that this is not a thinLTO build
14# CHECK: "has_thinlto": false
15## Check that the expected modules end up in the corpus description
16# CHECK-DAG: "test1.o"
17# CHECK-DAG: "test2.o"
18
19# RUN: ls %t.dir.out | FileCheck %s --check-prefix CHECK-DIR
20
21# CHECK-DIR: test1.o.bc
22# CHECK-DIR: test1.o.cmd
23# CHECK-DIR: test2.o.bc
24# CHECK-DIR: test2.o.cmd
25
26--- !ELF
27FileHeader:
28  Class:           ELFCLASS64
29  Data:            ELFDATA2LSB
30  Type:            ET_REL
31  Machine:         EM_X86_64
32  SectionHeaderStringTable: .strtab
33Sections:
34  - Name:            .text
35    Type:            SHT_PROGBITS
36    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
37    AddressAlign:    0x10
38    Content:         55
39  - Name:            .llvmbc
40    Type:            SHT_PROGBITS
41    AddressAlign:    0x1
42    Content:         55
43  - Name:            .llvmcmd
44    Type:            SHT_PROGBITS
45    AddressAlign:    0x1
46    Content:         ff
47