[committed,81/88] gccrs: Fix up DejaGnu directives in 'rust/compile/issue-1830_{bytes, str}.rs' test cases [#1838]

Message ID 20230405140411.3016563-82-arthur.cohen@embecosm.com
State Accepted
Headers
Series [committed,01/88] gccrs: fatal_error_flag: Fix typo in error message |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Arthur Cohen April 5, 2023, 2:04 p.m. UTC
  From: Thomas Schwinge <thomas@codesourcery.com>

'dg-excess-errors' "indicates that the test is expected to fail due to compiler
messages that are not handled by 'dg-error', [etc.]".  It's argument doesn't
specify the message to match but just just a comment.  Here, however, we'd like
to match specific compiler messages, so we should use 'dg-error', etc.  Use the
magic line number zero as the compiler error diagnostic doesn't tell which line
the error occurred on (separate issue to resolve).  This gives us:

    -XFAIL: rust/compile/issue-1830_str.rs (test for excess errors)
    +PASS: rust/compile/issue-1830_bytes.rs  at line 8 (test for errors, line )
    +PASS: rust/compile/issue-1830_bytes.rs (test for excess errors)
    -XFAIL: rust/compile/issue-1830_bytes.rs (test for excess errors)
    +PASS: rust/compile/issue-1830_str.rs  at line 8 (test for errors, line )
    +PASS: rust/compile/issue-1830_str.rs (test for excess errors)

Fix-up for recent GCC/Rust master branch #1838
commit cf9ed4001eec6a22686d19a13f7de8ac94f9cb2a
"testsuite: Add empty string macro test".

	gcc/testsuite/
	* rust/compile/issue-1830_bytes.rs: Fix up DejaGnu directives.
	* rust/compile/issue-1830_str.rs: Likewise.
---
 gcc/testsuite/rust/compile/issue-1830_bytes.rs | 3 ++-
 gcc/testsuite/rust/compile/issue-1830_str.rs   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/testsuite/rust/compile/issue-1830_bytes.rs b/gcc/testsuite/rust/compile/issue-1830_bytes.rs
index dcc53b73b19..997d4ca0cdc 100644
--- a/gcc/testsuite/rust/compile/issue-1830_bytes.rs
+++ b/gcc/testsuite/rust/compile/issue-1830_bytes.rs
@@ -4,5 +4,6 @@  macro_rules! include_bytes {
 }
 
 fn main() {
-    include_bytes!(""); // { dg-excess-errors "Is a directory" }
+    include_bytes!("");
+    // { dg-error {cannot open filename [^\n\r]+: Is a directory} {} { target *-*-* } 0 }
 }
diff --git a/gcc/testsuite/rust/compile/issue-1830_str.rs b/gcc/testsuite/rust/compile/issue-1830_str.rs
index 6cf835ba9bd..fcf2dc988d3 100644
--- a/gcc/testsuite/rust/compile/issue-1830_str.rs
+++ b/gcc/testsuite/rust/compile/issue-1830_str.rs
@@ -4,5 +4,6 @@  macro_rules! include_str {
 }
 
 fn main() {
-    include_str!(""); // { dg-excess-errors "Is a directory" }
+    include_str!("");
+    // { dg-error {cannot open filename [^\n\r]+: Is a directory} {} { target *-*-* } 0 }
 }