Skip to content

Commit 28769ea

Browse files
committed
testsuite/rust: adapt/fix the testcases ...
... so that the tests will still pass after the crate name logic change Signed-off-by: Zixing Liu <[email protected]>
1 parent f50e9a2 commit 28769ea

9 files changed

+32
-2
lines changed

gcc/rust/rust-session-manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "rust-linemap.h"
2424
#include "rust-backend.h"
25+
#include "safe-ctype.h"
2526

2627
#include "config.h"
2728
#include "rust-system.h"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// { dg-additional-options "-frust-crate=bad+name" }
2+
// { dg-excess-errors "invalid crate name: ...." }
3+
// { dg-excess-errors "unrecognized command-line option ...." }
4+
fn main() {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// { dg-excess-errors "invalid crate name: ...." }
2+
// { dg-bogus "unrecognized command-line option ...." }
3+
fn main() {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// { dg-additional-options "-fdump-tree-gimple -frust-crate=good-name" }
2+
pub fn does_nothing() {}
3+
fn main() {
4+
does_nothing()
5+
}
6+
// { dg-final { scan-tree-dump-times {good_name::does_nothing} 2 gimple } }
7+
// { dg-final { scan-tree-dump-times {good_name::main} 1 gimple } }

gcc/testsuite/rust/compile/canonical_paths1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// { dg-additional-options "-w -fdump-tree-gimple" }
1+
// { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" }
22
struct Foo(i32);
33

44
trait TR {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// { dg-additional-options "-fdump-tree-gimple" }
2+
pub fn does_nothing() {}
3+
fn main() {
4+
does_nothing()
5+
}
6+
// { dg-final { scan-tree-dump-times {infer_crate_name::does_nothing} 2 gimple } }
7+
// { dg-final { scan-tree-dump-times {infer_crate_name::main} 1 gimple } }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// { dg-additional-options "-frust-crate=fancy-crate_name -fdump-tree-gimple" }
2+
pub fn does_nothing() {}
3+
fn main() {
4+
does_nothing()
5+
}
6+
// { dg-final { scan-tree-dump-times {fancy_crate_name::does_nothing} 2 gimple } }
7+
// { dg-final { scan-tree-dump-times {fancy_crate_name::main} 1 gimple } }

gcc/testsuite/rust/compile/torture/struct_decl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// { dg-additional-options -fdump-tree-gimple }
1+
// { dg-additional-options "-fdump-tree-gimple -frust-crate=example" }
22

33
struct Foo {
44
a: u16,

gcc/testsuite/rust/compile/traits9.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// { dg-additional-options -frust-crate=example }
12
struct Foo(i32);
23
trait Bar {
34
fn baz(&self);

0 commit comments

Comments
 (0)