Skip to content

Commit 3b1ca5e

Browse files
[APINotes] Prefer diff -u over diff -b
Lit's internal shell does not support -b (properly). This patch rewrites the tests to conform to their existing semantics (using --implicit-check-not) using diff -u. This allows for enabling lit's internal shell by default on all platforms. Fixes #106249. Reviewers: compnerd, ilovepi, petrhosek, DougGregor Reviewed By: ilovepi, compnerd Pull Request: #157588
1 parent b04f6f8 commit 3b1ca5e

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-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: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
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 | head -n -1 | \
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

0 commit comments

Comments
 (0)