forked from checkedc/checkedc-clang
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
54924ac
commit 7e813d1
Showing
5 changed files
with
57 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
//RUN: rm -rf %t* | ||
//RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1b.c -- 2>%t.stderr | ||
//RUN: grep -q "merging failed" %t.stderr | ||
// Since the RUN commands in difftypes1a.c and difftypes1b.c process the two | ||
// files in different orders and the location where the error is reported | ||
// depends on the order, we need to use a different diagnostic verification | ||
// prefix (and set of corresponding comments) for each RUN command. Verification | ||
// is per translation unit, so the translation unit with no diagnostic needs | ||
// `expected-no-diagnostics`. | ||
|
||
// The desired behavior in this case is to fail, so other checks are omitted | ||
//RUN: rm -rf %t* | ||
//RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1b.c -- -Xclang -verify=ab-expected | ||
|
||
// ab-expected-no-diagnostics | ||
// ba-expected-error@+1 {{merging failed for 'foo'}} | ||
_Ptr<int> foo(int, char); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
//RUN: rm -rf %t* | ||
//RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1a.c -- 2>%t.stderr | ||
//RUN: grep -q "merging failed" %t.stderr | ||
// Since the RUN commands in difftypes1a.c and difftypes1b.c process the two | ||
// files in different orders and the location where the error is reported | ||
// depends on the order, we need to use a different diagnostic verification | ||
// prefix (and set of corresponding comments) for each RUN command. Verification | ||
// is per translation unit, so the translation unit with no diagnostic needs | ||
// `expected-no-diagnostics`. | ||
|
||
// The desired behavior in this case is to fail, so other checks are omitted | ||
//RUN: rm -rf %t* | ||
//RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes1a.c -- -Xclang -verify=ba-expected | ||
|
||
// ba-expected-no-diagnostics | ||
// ab-expected-error@+1 {{merging failed for 'foo'}} | ||
int *foo(int, char *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
// Since the RUN commands in difftypes2a.c and difftypes2b.c process the two | ||
// files in different orders and the location where the error is reported | ||
// depends on the order, we need to use a different diagnostic verification | ||
// prefix (and set of corresponding comments) for each RUN command. Verification | ||
// is per translation unit, so the translation unit with no diagnostic needs | ||
// `expected-no-diagnostics`. | ||
|
||
// RUN: rm -rf %t* | ||
// RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2b.c -- 2>%t.stderr | ||
// RUN: grep -q "merging failed" %t.stderr | ||
// RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2b.c -- -Xclang -verify=ab-expected | ||
|
||
// The desired behavior in this case is to fail, so other checks are omitted | ||
|
||
// Test no body vs body | ||
|
||
// ab-expected-no-diagnostics | ||
// ba-expected-error@+1 {{merging failed for 'foo'}} | ||
void foo(char *x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
// RUN: rm -rf %t* | ||
// RUN: not 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2a.c -- 2>%t.stderr | ||
// RUN: grep -q "merging failed" %t.stderr | ||
// Since the RUN commands in difftypes2a.c and difftypes2b.c process the two | ||
// files in different orders and the location where the error is reported | ||
// depends on the order, we need to use a different diagnostic verification | ||
// prefix (and set of corresponding comments) for each RUN command. Verification | ||
// is per translation unit, so the translation unit with no diagnostic needs | ||
// `expected-no-diagnostics`. | ||
|
||
// The desired behavior in this case is to fail, so other checks are omitted | ||
// RUN: rm -rf %t* | ||
// RUN: 3c -base-dir=%S -output-dir=%t.checked %s %S/difftypes2a.c -- -Xclang -verify=ba-expected | ||
|
||
// Test body vs no body | ||
|
||
// ba-expected-no-diagnostics | ||
// ab-expected-error@+1 {{merging failed for 'foo'}} | ||
void foo(char **y) { | ||
// this is the body | ||
} |