|
| 1 | +## Check that llvm-objcopy reports a suitable error when it |
| 2 | +## encounters an invalid input during reading. The purpose is not to have |
| 3 | +## extensive of all read errors, that should be done in DXContainerTest.cpp, |
| 4 | +## instead this is a sanity check that the error is produced when using the |
| 5 | +## reader in llvm-objcopy. |
| 6 | + |
| 7 | +## We can't have multiple DXIL parts. |
| 8 | +# RUN: yaml2obj %s --docnum=1 -o %t1 |
| 9 | +# RUN: not llvm-objcopy %t1 %t1.out 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=ERROR1 |
| 10 | + |
| 11 | +# ERROR1: error: '[[FILE]]': More than one DXIL part is present in the file |
| 12 | + |
| 13 | +--- !dxcontainer |
| 14 | +Header: |
| 15 | + Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, |
| 16 | + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] |
| 17 | + Version: |
| 18 | + Major: 1 |
| 19 | + Minor: 0 |
| 20 | + PartCount: 2 |
| 21 | +Parts: |
| 22 | + - Name: DXIL |
| 23 | + Size: 28 |
| 24 | + - Name: DXIL |
| 25 | + Size: 28 |
| 26 | +... |
| 27 | + |
| 28 | +## The first part offset is out of file bound. |
| 29 | +# RUN: yaml2obj %s --docnum=2 -o %t2 |
| 30 | +# RUN: not llvm-objcopy %t2 %t2.out 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=ERROR2 |
| 31 | + |
| 32 | +# ERROR2: error: '[[FILE]]': Reading structure out of file bounds |
| 33 | + |
| 34 | +--- !dxcontainer |
| 35 | +Header: |
| 36 | + Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, |
| 37 | + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] |
| 38 | + Version: |
| 39 | + Major: 2 |
| 40 | + Minor: 0 |
| 41 | + PartCount: 1 |
| 42 | + PartOffsets: [ 48 ] |
| 43 | +Parts: |
| 44 | + - Name: DXIL |
| 45 | + Size: 28 |
| 46 | +... |
0 commit comments