Skip to content

Commit 3cf7647

Browse files
Migrate the difftypes* tests to the diagnostic verifier.
This feels a little cleaner than manually scanning the stderr and lets us check the diagnostics more precisely, for what that's worth. We couldn't do this before #488 both because 3C exited before the diagnostics could be verified and because 3C didn't support custom verify prefixes. #488 solved the first problem, and this PR solves the second.
1 parent 40ecc11 commit 3cf7647

File tree

4 files changed

+32
-14
lines changed

4 files changed

+32
-14
lines changed

clang/test/3C/difftypes1a.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
//RUN: rm -rf %t*
2-
//RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1b.c -- 2>%t.stderr
3-
//RUN: grep -q "merging failed" %t.stderr
1+
// Since the RUN commands in difftypes1a.c and difftypes1b.c process the two
2+
// files in different orders and the location where the error is reported
3+
// depends on the order, we need to use a different diagnostic verification
4+
// prefix (and set of corresponding comments) for each RUN command.
45

5-
// The desired behavior in this case is to fail, so other checks are omitted
6+
//RUN: rm -rf %t*
7+
//RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1b.c -- -Xclang -verify=ab-expected
68

9+
// ab-expected-no-diagnostics
10+
// ba-expected-error@+1 {{merging failed for 'foo'}}
711
_Ptr<int> foo(int, char);

clang/test/3C/difftypes1b.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
//RUN: rm -rf %t*
2-
//RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1a.c -- 2>%t.stderr
3-
//RUN: grep -q "merging failed" %t.stderr
1+
// Since the RUN commands in difftypes1a.c and difftypes1b.c process the two
2+
// files in different orders and the location where the error is reported
3+
// depends on the order, we need to use a different diagnostic verification
4+
// prefix (and set of corresponding comments) for each RUN command.
45

5-
// The desired behavior in this case is to fail, so other checks are omitted
6+
//RUN: rm -rf %t*
7+
//RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1a.c -- -Xclang -verify=ba-expected
68

9+
// ba-expected-no-diagnostics
10+
// ab-expected-error@+1 {{merging failed for 'foo'}}
711
int *foo(int, char *);

clang/test/3C/difftypes2a.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
// Since the RUN commands in difftypes2a.c and difftypes2b.c process the two
2+
// files in different orders and the location where the error is reported
3+
// depends on the order, we need to use a different diagnostic verification
4+
// prefix (and set of corresponding comments) for each RUN command.
5+
16
// RUN: rm -rf %t*
2-
// RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2b.c -- 2>%t.stderr
3-
// RUN: grep -q "merging failed" %t.stderr
7+
// RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2b.c -- -Xclang -verify=ab-expected
48

59
// The desired behavior in this case is to fail, so other checks are omitted
610

711
// Test no body vs body
812

13+
// ab-expected-no-diagnostics
14+
// ba-expected-error@+1 {{merging failed for 'foo'}}
915
void foo(char *x);

clang/test/3C/difftypes2b.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// RUN: rm -rf %t*
2-
// RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2a.c -- 2>%t.stderr
3-
// RUN: grep -q "merging failed" %t.stderr
1+
// Since the RUN commands in difftypes2a.c and difftypes2b.c process the two
2+
// files in different orders and the location where the error is reported
3+
// depends on the order, we need to use a different diagnostic verification
4+
// prefix (and set of corresponding comments) for each RUN command.
45

5-
// The desired behavior in this case is to fail, so other checks are omitted
6+
// RUN: rm -rf %t*
7+
// RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2a.c -- -Xclang -verify=ba-expected
68

79
// Test body vs no body
810

11+
// ba-expected-no-diagnostics
12+
// ab-expected-error@+1 {{merging failed for 'foo'}}
913
void foo(char **y) {
1014
// this is the body
1115
}

0 commit comments

Comments
 (0)