[llvm] [GOFF] Refactor writing GOFF records (PR #93855)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 01:05:51 PDT 2024


================
@@ -0,0 +1,74 @@
+# RUN: awk 'BEGIN {str = sprintf("%47s", "")} {gsub("@FILL@", str); print}' < %s | \
+# RUN:   yaml2obj | od -v -An -tx1 | \
+# RUN:   FileCheck --ignore-case --check-prefix CHECK1 %s
+# RUN: awk 'BEGIN {str = sprintf("%48s", "")} {gsub("@FILL@", str); print}' < %s | \
+# RUN:   yaml2obj | od -v -An -tx1 | \
+# RUN:   FileCheck --ignore-case --check-prefix CHECK2 %s
+# RUN: awk 'BEGIN {str = sprintf("%125s", "")} {gsub("@FILL@", str); print}' < %s | \
+# RUN:   yaml2obj | od -v -An -tx1 | \
+# RUN:   FileCheck --ignore-case --check-prefix CHECK3 %s
+# RUN: awk 'BEGIN {str = sprintf("%160s", "")} {gsub("@FILL@", str); print}' < %s | \
+# RUN:   yaml2obj | od -v -An -tx1 | \
+# RUN:   FileCheck --ignore-case --check-prefix CHECK4 %s
+
+
+## Verify that the entry name is written correctly over multiple records.
----------------
jh7370 wrote:

Normally we put the comment before the test case run line that it's related to. Indeed, a common pattern in more recent yaml2obj tests is the following:

```
## High-level comment summarising the tests in the file as a whole.
# RUN: General setup code, e.g. creating a test output directory. Not always needed.

## Comment describing individual test case.
# RUN: Test case commands

# CHECK: Check directive(s) for test case

## Second test case comment
# RUN: Second test case commands

# CHECK-2: Check directive(s) for second test case, if needed

...

<Common YAML>
```
Variations on the above where multiple different YAML docs are needed tend to have that YAML at the end of the block of test cases that share it.

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


More information about the llvm-commits mailing list