[gdb/testsuite] Fix gdb.gdb/index-file.exp with -g0

Message ID 20240721075953.5537-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Fix gdb.gdb/index-file.exp with -g0 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries July 21, 2024, 7:59 a.m. UTC
  When building gdb with -g0 and running test-case gdb.gdb/index-file.exp, we
run into:
...
(gdb) save gdb-index index_1^M
Error while writing index for `xgdb': No debugging symbols^M
(gdb) FAIL: gdb.gdb/index-file.exp: create gdb-index file
...

Fix this by instead emitting an unsupported, and bailing out.

Tested on aarch64-linux.
---
 gdb/testsuite/gdb.gdb/index-file.exp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)


base-commit: d2f8ed901998a687d52dc308bbcc4a46699b4c2a
  

Comments

Tom de Vries July 29, 2024, 1:43 p.m. UTC | #1
On 7/21/24 09:59, Tom de Vries wrote:
> When building gdb with -g0 and running test-case gdb.gdb/index-file.exp, we
> run into:
> ...
> (gdb) save gdb-index index_1^M
> Error while writing index for `xgdb': No debugging symbols^M
> (gdb) FAIL: gdb.gdb/index-file.exp: create gdb-index file
> ...
> 
> Fix this by instead emitting an unsupported, and bailing out.
> 

Pushed.

Thanks,
- Tom

> Tested on aarch64-linux.
> ---
>   gdb/testsuite/gdb.gdb/index-file.exp | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
> index 72088ca41ee..a58b89994fb 100644
> --- a/gdb/testsuite/gdb.gdb/index-file.exp
> +++ b/gdb/testsuite/gdb.gdb/index-file.exp
> @@ -42,8 +42,19 @@ set worker_threads [gdb_get_worker_threads]
>   set dir1 [standard_output_file "index_1"]
>   remote_exec host "mkdir -p ${dir1}"
>   with_timeout_factor $timeout_factor {
> -    gdb_test_no_output "save gdb-index $dir1" \
> -	"create gdb-index file"
> +    set ok 0
> +    gdb_test_multiple "save gdb-index $dir1" "create gdb-index file" {
> +	-re -wrap "Error while writing index for \[^\r\n\]*: No debugging symbols" {
> +	    unsupported $gdb_test_name
> +	}
> +	-re -wrap "^" {
> +	    pass $gdb_test_name
> +	    set ok 1
> +	}
> +    }
> +    if { ! $ok } {
> +	return -1
> +    }
>   
>       gdb_test_no_output "save gdb-index -dwarf-5 $dir1" \
>   	"create dwarf-index files"
> 
> base-commit: d2f8ed901998a687d52dc308bbcc4a46699b4c2a
  

Patch

diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp
index 72088ca41ee..a58b89994fb 100644
--- a/gdb/testsuite/gdb.gdb/index-file.exp
+++ b/gdb/testsuite/gdb.gdb/index-file.exp
@@ -42,8 +42,19 @@  set worker_threads [gdb_get_worker_threads]
 set dir1 [standard_output_file "index_1"]
 remote_exec host "mkdir -p ${dir1}"
 with_timeout_factor $timeout_factor {
-    gdb_test_no_output "save gdb-index $dir1" \
-	"create gdb-index file"
+    set ok 0
+    gdb_test_multiple "save gdb-index $dir1" "create gdb-index file" {
+	-re -wrap "Error while writing index for \[^\r\n\]*: No debugging symbols" {
+	    unsupported $gdb_test_name
+	}
+	-re -wrap "^" {
+	    pass $gdb_test_name
+	    set ok 1
+	}
+    }
+    if { ! $ok } {
+	return -1
+    }
 
     gdb_test_no_output "save gdb-index -dwarf-5 $dir1" \
 	"create dwarf-index files"