116 lines · yaml
1## This file contains test cases for generating Fat Mach-O binaries.2 3## a) Test that yaml2obj emits Fat Mach-O binary and obj2yaml converts it4## back to YAML file.5 6# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s7 8--- !fat-mach-o9FatHeader: 10 magic: 0xCAFEBABE11 nfat_arch: 212FatArchs: 13 - cputype: 0x0000000714 cpusubtype: 0x0000000315 offset: 0x000000000000100016 size: 1524417 align: 1218 - cputype: 0x0100000719 cpusubtype: 0x8000000320 offset: 0x000000000000500021 size: 1538022 align: 1223Slices: 24 - FileHeader: 25 magic: 0xFEEDFACE26 cputype: 0x0000000727 cpusubtype: 0x0000000328 filetype: 0x0000000229 ncmds: 030 sizeofcmds: 031 flags: 0x0121808532 - FileHeader: 33 magic: 0xFEEDFACF34 cputype: 0x0100000735 cpusubtype: 0x8000000336 filetype: 0x0000000237 ncmds: 038 sizeofcmds: 039 flags: 0x0021808540 reserved: 0x0000000041...42 43 44#CHECK: --- !fat-mach-o45#CHECK: FatHeader: 46#CHECK: magic: 0xCAFEBABE47#CHECK: nfat_arch: 248#CHECK: FatArchs: 49#CHECK: - cputype: 0x750#CHECK: cpusubtype: 0x351#CHECK: offset: 0x100052#CHECK: size: 1524453#CHECK: align: 1254#CHECK: - cputype: 0x100000755#CHECK: cpusubtype: 0x8000000356#CHECK: offset: 0x500057#CHECK: size: 1538058#CHECK: align: 1259#CHECK: Slices: 60#CHECK: - !mach-o61#CHECK: FileHeader: 62#CHECK: magic: 0xFEEDFACE63#CHECK: cputype: 0x764#CHECK: cpusubtype: 0x365#CHECK: filetype: 0x266#CHECK: ncmds: 067#CHECK: sizeofcmds: 068#CHECK: flags: 0x121808569#CHECK: - !mach-o70#CHECK: FileHeader: 71#CHECK: magic: 0xFEEDFACF72#CHECK: cputype: 0x100000773#CHECK: cpusubtype: 0x8000000374#CHECK: filetype: 0x275#CHECK: ncmds: 076#CHECK: sizeofcmds: 077#CHECK: flags: 0x21808578#CHECK: reserved: 0x079#CHECK: ...80 81## b) Test that yaml2obj emits an error message if the number of 'FatArchs' is less than82## the number of 'Slices'.83 84# RUN: not yaml2obj --docnum=2 %s -o %t2.fat-macho 2>&1 | FileCheck %s --check-prefix=ERROR85 86# ERROR: yaml2obj: error: cannot write 'Slices' if not described in 'FatArches'87 88--- !fat-mach-o89FatHeader:90 magic: 0xCAFEBABE91 nfat_arch: 292FatArchs:93 ## 2 FatArchs are expected.94 - cputype: 0x0000000795 cpusubtype: 0x0000000396 offset: 0x000000000000100097 size: 098 align: 099Slices:100 - FileHeader:101 magic: 0xFEEDFACE102 cputype: 0x00000007103 cpusubtype: 0x00000003104 filetype: 0x00000002105 ncmds: 0106 sizeofcmds: 0107 flags: 0x00000000108 - FileHeader:109 magic: 0xFEEDFACE110 cputype: 0x00000007111 cpusubtype: 0x00000003112 filetype: 0x00000002113 ncmds: 0114 sizeofcmds: 0115 flags: 0x00000000116