From d7f0f10189fa83a73d9819e81fd321142c0c6398 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 28 Mar 2023 10:22:48 +0200 Subject: [PATCH] [gdb/testsuite] Allow gdb.rust/expr.exp without rust compiler Proc allow_rust_tests returns 0 when there's no rust compiler, but that gives the wrong answer for gdb.rust/expr.exp, which doesn't require it. Fix this by using can_compile rust in the test-cases that need it, and just returning 1 in allow_rust_tests. Tested on x86_64-linux. --- gdb/testsuite/gdb.rust/completion.exp | 1 + gdb/testsuite/gdb.rust/dwindex.exp | 1 + gdb/testsuite/gdb.rust/finish.exp | 1 + gdb/testsuite/gdb.rust/fnfield.exp | 1 + gdb/testsuite/gdb.rust/generics.exp | 1 + gdb/testsuite/gdb.rust/main-crash.exp | 1 + gdb/testsuite/gdb.rust/methods.exp | 1 + gdb/testsuite/gdb.rust/modules.exp | 1 + gdb/testsuite/gdb.rust/onetwoeight.exp | 1 + gdb/testsuite/gdb.rust/pp.exp | 1 + gdb/testsuite/gdb.rust/rawids.exp | 1 + gdb/testsuite/gdb.rust/rust-start.exp | 1 + gdb/testsuite/gdb.rust/rust-style.exp | 1 + gdb/testsuite/gdb.rust/simple.exp | 1 + gdb/testsuite/gdb.rust/traits.exp | 1 + gdb/testsuite/gdb.rust/unicode.exp | 1 + gdb/testsuite/gdb.rust/union.exp | 1 + gdb/testsuite/gdb.rust/unsized.exp | 1 + gdb/testsuite/gdb.rust/watch.exp | 1 + gdb/testsuite/lib/gdb.exp | 4 ---- 20 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.rust/completion.exp b/gdb/testsuite/gdb.rust/completion.exp index 88763952dfa..76c45fda7ba 100644 --- a/gdb/testsuite/gdb.rust/completion.exp +++ b/gdb/testsuite/gdb.rust/completion.exp @@ -18,6 +18,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/dwindex.exp b/gdb/testsuite/gdb.rust/dwindex.exp index 841db216680..1a82c2e92fe 100644 --- a/gdb/testsuite/gdb.rust/dwindex.exp +++ b/gdb/testsuite/gdb.rust/dwindex.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs diff --git a/gdb/testsuite/gdb.rust/finish.exp b/gdb/testsuite/gdb.rust/finish.exp index ab0250df277..373f8d72f5d 100644 --- a/gdb/testsuite/gdb.rust/finish.exp +++ b/gdb/testsuite/gdb.rust/finish.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/fnfield.exp b/gdb/testsuite/gdb.rust/fnfield.exp index 5ae0c53b1eb..48c6179d7d6 100644 --- a/gdb/testsuite/gdb.rust/fnfield.exp +++ b/gdb/testsuite/gdb.rust/fnfield.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/generics.exp b/gdb/testsuite/gdb.rust/generics.exp index 41112afd572..7afed993a2d 100644 --- a/gdb/testsuite/gdb.rust/generics.exp +++ b/gdb/testsuite/gdb.rust/generics.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/main-crash.exp b/gdb/testsuite/gdb.rust/main-crash.exp index 9c513f91c1d..caede88a1fa 100644 --- a/gdb/testsuite/gdb.rust/main-crash.exp +++ b/gdb/testsuite/gdb.rust/main-crash.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile main.rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ diff --git a/gdb/testsuite/gdb.rust/methods.exp b/gdb/testsuite/gdb.rust/methods.exp index 72be6a11ab0..dd95429de7d 100644 --- a/gdb/testsuite/gdb.rust/methods.exp +++ b/gdb/testsuite/gdb.rust/methods.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/modules.exp b/gdb/testsuite/gdb.rust/modules.exp index 0ad1a4a6b75..076ef5c2dd4 100644 --- a/gdb/testsuite/gdb.rust/modules.exp +++ b/gdb/testsuite/gdb.rust/modules.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/onetwoeight.exp b/gdb/testsuite/gdb.rust/onetwoeight.exp index 317c848a899..ef56bcafda2 100644 --- a/gdb/testsuite/gdb.rust/onetwoeight.exp +++ b/gdb/testsuite/gdb.rust/onetwoeight.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} set v [split [rust_compiler_version] .] if {[lindex $v 0] == 1 && [lindex $v 1] < 43} { diff --git a/gdb/testsuite/gdb.rust/pp.exp b/gdb/testsuite/gdb.rust/pp.exp index 553bce3c1a9..ef66717607b 100644 --- a/gdb/testsuite/gdb.rust/pp.exp +++ b/gdb/testsuite/gdb.rust/pp.exp @@ -18,6 +18,7 @@ load_lib gdb-python.exp load_lib rust-support.exp require allow_rust_tests allow_python_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/rawids.exp b/gdb/testsuite/gdb.rust/rawids.exp index 976b723833e..56d1e5f64b3 100644 --- a/gdb/testsuite/gdb.rust/rawids.exp +++ b/gdb/testsuite/gdb.rust/rawids.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} set v [split [rust_compiler_version] .] if {[lindex $v 0] == 1 && [lindex $v 1] < 30} { diff --git a/gdb/testsuite/gdb.rust/rust-start.exp b/gdb/testsuite/gdb.rust/rust-start.exp index 96ba2ae3ac8..ca2608465dd 100644 --- a/gdb/testsuite/gdb.rust/rust-start.exp +++ b/gdb/testsuite/gdb.rust/rust-start.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} # This testcase verifies the behavior of the `start' command, which # does not work when we use the gdb stub... diff --git a/gdb/testsuite/gdb.rust/rust-style.exp b/gdb/testsuite/gdb.rust/rust-style.exp index c942673bddb..0555ea4b8a4 100644 --- a/gdb/testsuite/gdb.rust/rust-style.exp +++ b/gdb/testsuite/gdb.rust/rust-style.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} save_vars { env(TERM) } { # We need an ANSI-capable terminal to get the output. diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp index 25152a35cd0..08ebed3f103 100644 --- a/gdb/testsuite/gdb.rust/simple.exp +++ b/gdb/testsuite/gdb.rust/simple.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/traits.exp b/gdb/testsuite/gdb.rust/traits.exp index 9aa4cbfc75c..e52749733d7 100644 --- a/gdb/testsuite/gdb.rust/traits.exp +++ b/gdb/testsuite/gdb.rust/traits.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/unicode.exp b/gdb/testsuite/gdb.rust/unicode.exp index 2b4766b5553..7124934c8d5 100644 --- a/gdb/testsuite/gdb.rust/unicode.exp +++ b/gdb/testsuite/gdb.rust/unicode.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} # Non-ASCII identifiers were allowed starting in 1.53. set v [split [rust_compiler_version] .] diff --git a/gdb/testsuite/gdb.rust/union.exp b/gdb/testsuite/gdb.rust/union.exp index 5f128c563a3..6074717d276 100644 --- a/gdb/testsuite/gdb.rust/union.exp +++ b/gdb/testsuite/gdb.rust/union.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/unsized.exp b/gdb/testsuite/gdb.rust/unsized.exp index f81be8a3078..a12d8f0bac4 100644 --- a/gdb/testsuite/gdb.rust/unsized.exp +++ b/gdb/testsuite/gdb.rust/unsized.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/gdb.rust/watch.exp b/gdb/testsuite/gdb.rust/watch.exp index 43c88f8a1fc..ae359420aad 100644 --- a/gdb/testsuite/gdb.rust/watch.exp +++ b/gdb/testsuite/gdb.rust/watch.exp @@ -17,6 +17,7 @@ load_lib rust-support.exp require allow_rust_tests +require {can_compile rust} standard_testfile .rs if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} { diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 769bb28c356..46aa1441d6d 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2503,10 +2503,6 @@ gdb_caching_proc can_compile { lang } { # Return 1 to try Rust tests, 0 to skip them. proc allow_rust_tests {} { - if { ![can_compile rust] } { - return 0 - } - return 1 } -- 2.30.2