Skip to content

Conversation

boomanaiden154
Copy link
Contributor

This reverts commit 8d35bcc.

This was causing failures on MacOS due to the head command there not supporting negative offsets. This patch fixes that by removing the call to HEAD and relaxing the requirements around removing the last line of the file.

This reverts commit 8d35bcc.

This was causing failures on MacOS due to the head command there not
supporting negative offsets. This patch fixes that by removing the call
to HEAD and relaxing the requirements around removing the last line of
the file.
@boomanaiden154 boomanaiden154 added the skip-precommit-approval PR for CI feedback, not intended for review label Sep 10, 2025
@boomanaiden154 boomanaiden154 marked this pull request as ready for review September 10, 2025 17:03
@boomanaiden154 boomanaiden154 merged commit f1cdb44 into llvm:main Sep 10, 2025
12 checks passed
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 10, 2025
@boomanaiden154 boomanaiden154 deleted the reland-yaml-roundtrip-test branch September 10, 2025 17:04
@llvmbot
Copy link
Member

llvmbot commented Sep 10, 2025

@llvm/pr-subscribers-clang

Author: Aiden Grossman (boomanaiden154)

Changes

This reverts commit 8d35bcc.

This was causing failures on MacOS due to the head command there not supporting negative offsets. This patch fixes that by removing the call to HEAD and relaxing the requirements around removing the last line of the file.


Full diff: https://github.com/llvm/llvm-project/pull/157894.diff

2 Files Affected:

  • (modified) clang/test/APINotes/yaml-roundtrip-2.test (+5-7)
  • (modified) clang/test/APINotes/yaml-roundtrip.test (+18-25)
diff --git a/clang/test/APINotes/yaml-roundtrip-2.test b/clang/test/APINotes/yaml-roundtrip-2.test
index 63717bda7c099..26c5a73ad1083 100644
--- a/clang/test/APINotes/yaml-roundtrip-2.test
+++ b/clang/test/APINotes/yaml-roundtrip-2.test
@@ -1,11 +1,9 @@
 RUN: apinotes-test %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes > %t.result
-RUN: not diff -b -e %t.result %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes | FileCheck %s
-
-The `-e` option of `diff` is not implemented in the builtin diff, assume
-that we have a POSIX compatible diff when we have a shell.
-REQUIRES: shell
+RUN: not diff -u %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes %t.result | \
+RUN:   tail -n +4 | \
+RUN:   FileCheck %s --implicit-check-not="{{^\+}}" --implicit-check-not="{{^\-}}"
 
 We expect only the document markers to be emitted
 
-CHECK: 52d
-CHECK: 1d
+CHECK: +---
+CHECK: +...
diff --git a/clang/test/APINotes/yaml-roundtrip.test b/clang/test/APINotes/yaml-roundtrip.test
index f69038ca828b1..355596ef8e93b 100644
--- a/clang/test/APINotes/yaml-roundtrip.test
+++ b/clang/test/APINotes/yaml-roundtrip.test
@@ -1,30 +1,23 @@
 RUN: apinotes-test %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes > %t.result
-RUN: not diff -b %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes %t.result | FileCheck %s
-
-Avoid Windows as the diff output differs due to line-endings and different diff
-implementations.
-UNSUPPORTED: system-windows
+RUN: not diff -u %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes %t.result | \
+RUN:   tail -n +5 | \
+RUN:   FileCheck %s --implicit-check-not="{{^\+}}" --implicit-check-not="{{^\-}}"
 
 We expect only the nullability to be different as it is canonicalized during the
 roudtrip.
 
-CHECK:      7c8
-CHECK-NEXT: <         Nullability:     N
-CHECK-NEXT: ---
-CHECK-NEXT: >         Nullability:     Nonnull
-CHECK-NEXT: 13c14
-CHECK-NEXT: <         Nullability:     O
-CHECK-NEXT: ---
-CHECK-NEXT: >         Nullability:     Optional
-CHECK-NEXT: 19c20
-CHECK-NEXT: <         Nullability:     U
-CHECK-NEXT: ---
-CHECK-NEXT: >         Nullability:     Unspecified
-CHECK-NEXT: 25c26
-CHECK-NEXT: <         Nullability:     S
-CHECK-NEXT: ---
-CHECK-NEXT: >         Nullability:     Unspecified
-CHECK-NEXT: 28c29
-CHECK-NEXT: <         Nullability:     Scalar
-CHECK-NEXT: ---
-CHECK-NEXT: >         Nullability:     Unspecified
+CHECK:      -        Nullability:     N
+CHECK-NEXT: +        Nullability:     Nonnull
+CHECK:      -        Nullability:     O
+CHECK-NEXT: +        Nullability:     Optional
+CHECK:      -        Nullability:     U
+CHECK-NEXT: +        Nullability:     Unspecified
+CHECK:      -        Nullability:     S
+CHECK-NEXT: +        Nullability:     Unspecified
+CHECK:      -        Nullability:     Scalar
+CHECK-NEXT: +        Nullability:     Unspecified
+
+# The roundtrip will add document markers. It is hard to remove the last line of the
+# file in a cross-platform manner, so just assert it here to avoid a test failure due
+# to the implicit check not.
+# CHECK: +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants