[llvm] [llvm-objcopy] Support SREC output format (PR #75874)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 00:36:39 PST 2024


================
@@ -1,36 +1,40 @@
+## Check for basic functionality using an input file with
+## various section types, adresses, data, and no segments.
+
 # RUN: yaml2obj %s --docnum=1 -o %t
-# RUN: llvm-objcopy -O srec %t - | FileCheck %s
+# RUN: llvm-objcopy -O srec %t - | \
+# RUN:   FileCheck --match-full-lines --strict-whitespace %s --check-prefix=SREC
 
-## Terminator should contain the entry point
-# RUN: llvm-objcopy -O srec --set-start=0xF0000000 %t \
-#   RUN: --only-section=.dummy - 2>&1 | FileCheck %s --check-prefix=ENTRY
+## Terminator should contain the entry point.
+# RUN: llvm-objcopy -O srec --set-start=0xF0000000 %t --only-section=.dummy - 2>&1 | \
+# RUN:   FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY
 
-## Sign-extended entry point is OK
-# RUN: llvm-objcopy -O srec --set-start=0xFFFFFFFFF0000000 %t \
-#   RUN: --only-section=.dummy - 2>&1 | FileCheck %s --check-prefix=ENTRY
+## Sign-extended entry point is OK.
+# RUN: llvm-objcopy -O srec --set-start=0xFFFFFFFFF0000000 %t --only-section=.dummy - 2>&1 | \
+# RUN:   FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY
 
-## Start address which exceeds 32 bit range triggers an error
-# RUN: not llvm-objcopy -O srec --set-start=0xF00000000 %t - 2>&1 \
-#   RUN: | FileCheck %s --check-prefix=BAD_START
+## Start address which exceeds 32 bit range triggers an error.
+# RUN: not llvm-objcopy -O srec --set-start=0xF00000000 %t - 2>&1 | \
+# RUN:   FileCheck %s --check-prefix=BAD_START
 
-## Sign-extended start address which exceeds 32 bit range triggers an error
-# RUN: not llvm-objcopy -O srec --set-start=0xFFFFFFFF0F000000 %t - 2>&1 \
-#   RUN: | FileCheck %s --check-prefix=BAD_EXTENDED_START
+## Sign-extended start address which exceeds 32 bit range triggers an error.
+# RUN: not llvm-objcopy -O srec --set-start=0xFFFFFFFF0F000000 %t - 2>&1 | \
+# RUN:   FileCheck %s --check-prefix=BAD_EXTENDED_START
 
 ## The record type for the header should be S0 with a 2 byte address
-## of 0. For an output file named "-" the header data field should contain "2D"
+## of 0. For an output file named "-" the header data field should contain "2D".
 ## The byte count field should therefore have a value of 4: 2 bytes for address,
-## 1 byte for output file and 1 byte for checksum
-# CHECK: S00400002DCE
-# CHECK-NEXT: S31500001000000102030405060708090A0B0C0D0E0F62
-# CHECK-NEXT: S30A0000101010111213147B
-# CHECK-NEXT: S30F00EFFFFF1111111111111111111159
-# CHECK-NEXT: S31000FFFFF83031323334353637383940AC
-# CHECK-NEXT: S30A8000100000010203045B
-# CHECK-NEXT: S70500000000FA
-
-# ENTRY: S00400002DCE
-# ENTRY-NEXT: S705F00000000A
+## 1 byte for output file and 1 byte for checksum.
+     # SREC:S00400002DCE
----------------
jh7370 wrote:

Let's move the CHECK patterns to be close to the individual cases they are relevant to, so your ordering goes RUN/CHECK/RUN/CHECK etc.

https://github.com/llvm/llvm-project/pull/75874


More information about the llvm-commits mailing list