Skip to content

Commit 1897f54

Browse files
boomanaiden154github-actions[bot]
authored andcommitted
Automerge: Reapply "[APINotes] Prefer diff -u over diff -b" (#157894)
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.
2 parents 138426b + f1cdb44 commit 1897f54

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
RUN: apinotes-test %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes > %t.result
2-
RUN: not diff -b -e %t.result %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes | FileCheck %s
3-
4-
The `-e` option of `diff` is not implemented in the builtin diff, assume
5-
that we have a POSIX compatible diff when we have a shell.
6-
REQUIRES: shell
2+
RUN: not diff -u %S/Inputs/Frameworks/SimpleKit.framework/Headers/SimpleKit.apinotes %t.result | \
3+
RUN: tail -n +4 | \
4+
RUN: FileCheck %s --implicit-check-not="{{^\+}}" --implicit-check-not="{{^\-}}"
75

86
We expect only the document markers to be emitted
97

10-
CHECK: 52d
11-
CHECK: 1d
8+
CHECK: +---
9+
CHECK: +...
Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
RUN: apinotes-test %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes > %t.result
2-
RUN: not diff -b %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes %t.result | FileCheck %s
3-
4-
Avoid Windows as the diff output differs due to line-endings and different diff
5-
implementations.
6-
UNSUPPORTED: system-windows
2+
RUN: not diff -u %S/Inputs/Frameworks/Simple.framework/Headers/Simple.apinotes %t.result | \
3+
RUN: tail -n +5 | \
4+
RUN: FileCheck %s --implicit-check-not="{{^\+}}" --implicit-check-not="{{^\-}}"
75

86
We expect only the nullability to be different as it is canonicalized during the
97
roudtrip.
108

11-
CHECK: 7c8
12-
CHECK-NEXT: < Nullability: N
13-
CHECK-NEXT: ---
14-
CHECK-NEXT: > Nullability: Nonnull
15-
CHECK-NEXT: 13c14
16-
CHECK-NEXT: < Nullability: O
17-
CHECK-NEXT: ---
18-
CHECK-NEXT: > Nullability: Optional
19-
CHECK-NEXT: 19c20
20-
CHECK-NEXT: < Nullability: U
21-
CHECK-NEXT: ---
22-
CHECK-NEXT: > Nullability: Unspecified
23-
CHECK-NEXT: 25c26
24-
CHECK-NEXT: < Nullability: S
25-
CHECK-NEXT: ---
26-
CHECK-NEXT: > Nullability: Unspecified
27-
CHECK-NEXT: 28c29
28-
CHECK-NEXT: < Nullability: Scalar
29-
CHECK-NEXT: ---
30-
CHECK-NEXT: > Nullability: Unspecified
9+
CHECK: - Nullability: N
10+
CHECK-NEXT: + Nullability: Nonnull
11+
CHECK: - Nullability: O
12+
CHECK-NEXT: + Nullability: Optional
13+
CHECK: - Nullability: U
14+
CHECK-NEXT: + Nullability: Unspecified
15+
CHECK: - Nullability: S
16+
CHECK-NEXT: + Nullability: Unspecified
17+
CHECK: - Nullability: Scalar
18+
CHECK-NEXT: + Nullability: Unspecified
19+
20+
# The roundtrip will add document markers. It is hard to remove the last line of the
21+
# file in a cross-platform manner, so just assert it here to avoid a test failure due
22+
# to the implicit check not.
23+
# CHECK: +

0 commit comments

Comments
 (0)