From e71b6502bffecbbdd99a791c6ee7545603bafbc1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 8 Jan 2023 12:01:33 -0700 Subject: [PATCH] Rename to allow_guile_tests This changes skip_guile_tests to invert the sense, and renames it to allow_guile_tests. It also rewrites this proc to check the output of "gdb --configuration", as was done for Python. Then it changes the code to use "require" where possible. --- gdb/testsuite/gdb.guile/scm-arch.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-block.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-breakpoint.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-cmd.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-disasm.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-equal.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-error.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-frame-args.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-frame-inline.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-frame.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-gsmob.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-iterator.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-lazy-string.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-math.exp | 5 ++--- .../gdb.guile/scm-objfile-script.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-objfile.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-parameter.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-ports.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-pretty-print.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-progspace.exp | 5 ++--- .../gdb.guile/scm-section-script.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-symbol.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-symtab.exp | 5 ++--- gdb/testsuite/gdb.guile/scm-type.exp | 2 +- gdb/testsuite/gdb.guile/scm-value-cc.exp | 5 +---- gdb/testsuite/gdb.guile/scm-value.exp | 5 ++--- gdb/testsuite/gdb.guile/types-module.exp | 5 ++--- gdb/testsuite/lib/gdb-guile.exp | 21 ++++--------------- 28 files changed, 56 insertions(+), 97 deletions(-) diff --git a/gdb/testsuite/gdb.guile/scm-arch.exp b/gdb/testsuite/gdb.guile/scm-arch.exp index 7ec1db108ef..c2554d853d9 100644 --- a/gdb/testsuite/gdb.guile/scm-arch.exp +++ b/gdb/testsuite/gdb.guile/scm-arch.exp @@ -15,15 +15,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-block.exp b/gdb/testsuite/gdb.guile/scm-block.exp index 666d6fd458d..20fbd1784b5 100644 --- a/gdb/testsuite/gdb.guile/scm-block.exp +++ b/gdb/testsuite/gdb.guile/scm-block.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp index cd469ca4488..a9e656ddfc0 100644 --- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp +++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - proc_with_prefix test_bkpt_basic { } { global srcfile testfile hex decimal diff --git a/gdb/testsuite/gdb.guile/scm-cmd.exp b/gdb/testsuite/gdb.guile/scm-cmd.exp index 1d4e13d7aef..a7fb59b0089 100644 --- a/gdb/testsuite/gdb.guile/scm-cmd.exp +++ b/gdb/testsuite/gdb.guile/scm-cmd.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-disasm.exp b/gdb/testsuite/gdb.guile/scm-disasm.exp index 6609c746756..37b710f9f99 100644 --- a/gdb/testsuite/gdb.guile/scm-disasm.exp +++ b/gdb/testsuite/gdb.guile/scm-disasm.exp @@ -15,15 +15,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-equal.exp b/gdb/testsuite/gdb.guile/scm-equal.exp index d2fb9ef0161..3f6e0c51986 100644 --- a/gdb/testsuite/gdb.guile/scm-equal.exp +++ b/gdb/testsuite/gdb.guile/scm-equal.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-error.exp b/gdb/testsuite/gdb.guile/scm-error.exp index b0de521cb5c..168d71d1b9e 100644 --- a/gdb/testsuite/gdb.guile/scm-error.exp +++ b/gdb/testsuite/gdb.guile/scm-error.exp @@ -19,13 +19,12 @@ set testfile "scm-error" load_lib gdb-guile.exp +require allow_guile_tests + # Start with a fresh gdb. gdb_exit gdb_start -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - # Test error while loading .scm. set remote_guile_file_1 [gdb_remote_download host \ diff --git a/gdb/testsuite/gdb.guile/scm-frame-args.exp b/gdb/testsuite/gdb.guile/scm-frame-args.exp index 075f4419c17..67c10f65b3e 100644 --- a/gdb/testsuite/gdb.guile/scm-frame-args.exp +++ b/gdb/testsuite/gdb.guile/scm-frame-args.exp @@ -15,15 +15,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-frame-inline.exp b/gdb/testsuite/gdb.guile/scm-frame-inline.exp index 88a69fd882b..1f73ed67b90 100644 --- a/gdb/testsuite/gdb.guile/scm-frame-inline.exp +++ b/gdb/testsuite/gdb.guile/scm-frame-inline.exp @@ -15,15 +15,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-frame.exp b/gdb/testsuite/gdb.guile/scm-frame.exp index 3118d6bcd2f..2e854967d36 100644 --- a/gdb/testsuite/gdb.guile/scm-frame.exp +++ b/gdb/testsuite/gdb.guile/scm-frame.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - # The following tests require execution. if ![gdb_guile_runto_main] { diff --git a/gdb/testsuite/gdb.guile/scm-gsmob.exp b/gdb/testsuite/gdb.guile/scm-gsmob.exp index ded2a85c9d2..a7c95c01c11 100644 --- a/gdb/testsuite/gdb.guile/scm-gsmob.exp +++ b/gdb/testsuite/gdb.guile/scm-gsmob.exp @@ -18,13 +18,12 @@ load_lib gdb-guile.exp +require allow_guile_tests + # Start with a fresh gdb. gdb_exit gdb_start -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - gdb_reinitialize_dir $srcdir/$subdir gdb_install_guile_utils diff --git a/gdb/testsuite/gdb.guile/scm-iterator.exp b/gdb/testsuite/gdb.guile/scm-iterator.exp index 15974523324..0bf459518a1 100644 --- a/gdb/testsuite/gdb.guile/scm-iterator.exp +++ b/gdb/testsuite/gdb.guile/scm-iterator.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-lazy-string.exp b/gdb/testsuite/gdb.guile/scm-lazy-string.exp index 9b2960a4093..605235648a3 100644 --- a/gdb/testsuite/gdb.guile/scm-lazy-string.exp +++ b/gdb/testsuite/gdb.guile/scm-lazy-string.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - #gdb_install_guile_utils #gdb_install_guile_module diff --git a/gdb/testsuite/gdb.guile/scm-math.exp b/gdb/testsuite/gdb.guile/scm-math.exp index 97a2e58766b..42e195a0778 100644 --- a/gdb/testsuite/gdb.guile/scm-math.exp +++ b/gdb/testsuite/gdb.guile/scm-math.exp @@ -18,6 +18,8 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile proc test_value_numeric_ops {} { @@ -335,9 +337,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c}]} { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-objfile-script.exp b/gdb/testsuite/gdb.guile/scm-objfile-script.exp index bd0fd003cb6..5b480d1ea55 100644 --- a/gdb/testsuite/gdb.guile/scm-objfile-script.exp +++ b/gdb/testsuite/gdb.guile/scm-objfile-script.exp @@ -18,6 +18,8 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { @@ -28,9 +30,6 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { gdb_exit gdb_start -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - # Make the -gdb.scm script available to gdb, it is automagically loaded by gdb. # Care is taken to put it in the same directory as the binary so that # gdb will find it. diff --git a/gdb/testsuite/gdb.guile/scm-objfile.exp b/gdb/testsuite/gdb.guile/scm-objfile.exp index eb49600aa2c..f27c9f4027c 100644 --- a/gdb/testsuite/gdb.guile/scm-objfile.exp +++ b/gdb/testsuite/gdb.guile/scm-objfile.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-parameter.exp b/gdb/testsuite/gdb.guile/scm-parameter.exp index db76fc2d1c8..d62ae473faa 100644 --- a/gdb/testsuite/gdb.guile/scm-parameter.exp +++ b/gdb/testsuite/gdb.guile/scm-parameter.exp @@ -18,14 +18,13 @@ load_lib gdb-guile.exp +require allow_guile_tests + # Start with a fresh gdb. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - gdb_install_guile_utils gdb_install_guile_module diff --git a/gdb/testsuite/gdb.guile/scm-ports.exp b/gdb/testsuite/gdb.guile/scm-ports.exp index 318c434241a..f0af5d4bbad 100644 --- a/gdb/testsuite/gdb.guile/scm-ports.exp +++ b/gdb/testsuite/gdb.guile/scm-ports.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-pretty-print.exp b/gdb/testsuite/gdb.guile/scm-pretty-print.exp index f21ed41bffd..3c20edf5061 100644 --- a/gdb/testsuite/gdb.guile/scm-pretty-print.exp +++ b/gdb/testsuite/gdb.guile/scm-pretty-print.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile # Start with a fresh gdb. gdb_exit gdb_start -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - proc run_lang_tests {exefile lang} { with_test_prefix "lang=$lang" { global srcdir subdir srcfile testfile hex diff --git a/gdb/testsuite/gdb.guile/scm-progspace.exp b/gdb/testsuite/gdb.guile/scm-progspace.exp index f43e65e9673..c12a81e8ed1 100644 --- a/gdb/testsuite/gdb.guile/scm-progspace.exp +++ b/gdb/testsuite/gdb.guile/scm-progspace.exp @@ -18,6 +18,8 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { @@ -30,9 +32,6 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - gdb_install_guile_utils gdb_install_guile_module diff --git a/gdb/testsuite/gdb.guile/scm-section-script.exp b/gdb/testsuite/gdb.guile/scm-section-script.exp index 34ee6de3fdb..9e52939aae3 100644 --- a/gdb/testsuite/gdb.guile/scm-section-script.exp +++ b/gdb/testsuite/gdb.guile/scm-section-script.exp @@ -30,6 +30,8 @@ if {![istarget *-*-linux*] load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile # Make this available to gdb before the program starts, it is @@ -48,9 +50,6 @@ if {[build_executable $testfile.exp $testfile $srcfile \ gdb_exit gdb_start -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - gdb_reinitialize_dir $srcdir/$subdir # Try first with a restrictive safe-path. diff --git a/gdb/testsuite/gdb.guile/scm-symbol.exp b/gdb/testsuite/gdb.guile/scm-symbol.exp index f4b935f787f..fa2cf778284 100644 --- a/gdb/testsuite/gdb.guile/scm-symbol.exp +++ b/gdb/testsuite/gdb.guile/scm-symbol.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - # These tests are done before we call gdb_guile_runto_main so we have to # import the gdb module ourselves. gdb_install_guile_utils diff --git a/gdb/testsuite/gdb.guile/scm-symtab.exp b/gdb/testsuite/gdb.guile/scm-symtab.exp index 33308e0f008..0f468b7d373 100644 --- a/gdb/testsuite/gdb.guile/scm-symtab.exp +++ b/gdb/testsuite/gdb.guile/scm-symtab.exp @@ -18,6 +18,8 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile scm-symtab.c scm-symtab-2.c if {[prepare_for_testing "failed to prepare" $testfile \ @@ -25,9 +27,6 @@ if {[prepare_for_testing "failed to prepare" $testfile \ return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-type.exp b/gdb/testsuite/gdb.guile/scm-type.exp index f8902a30a62..45139cba0d5 100644 --- a/gdb/testsuite/gdb.guile/scm-type.exp +++ b/gdb/testsuite/gdb.guile/scm-type.exp @@ -43,7 +43,7 @@ proc restart_gdb {exefile} { gdb_reinitialize_dir $srcdir/$subdir gdb_load ${exefile} - if { [skip_guile_tests] } { + if { ![allow_guile_tests] } { return 0 } diff --git a/gdb/testsuite/gdb.guile/scm-value-cc.exp b/gdb/testsuite/gdb.guile/scm-value-cc.exp index 5b2a3c96c80..921d7a939a3 100644 --- a/gdb/testsuite/gdb.guile/scm-value-cc.exp +++ b/gdb/testsuite/gdb.guile/scm-value-cc.exp @@ -18,7 +18,7 @@ load_lib gdb-guile.exp -require allow_cplus_tests +require allow_cplus_tests allow_guile_tests standard_testfile .cc @@ -26,9 +26,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { return } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp index 9858b1c1a38..a00c9409086 100644 --- a/gdb/testsuite/gdb.guile/scm-value.exp +++ b/gdb/testsuite/gdb.guile/scm-value.exp @@ -18,6 +18,8 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile set has_argv0 [gdb_has_argv0] @@ -427,9 +429,6 @@ if { [build_inferior "${binfile}" "c"] < 0 } { # Start with a fresh gdb. clean_restart ${binfile} -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - gdb_install_guile_utils gdb_install_guile_module diff --git a/gdb/testsuite/gdb.guile/types-module.exp b/gdb/testsuite/gdb.guile/types-module.exp index 520c9021575..2b90d1b613a 100644 --- a/gdb/testsuite/gdb.guile/types-module.exp +++ b/gdb/testsuite/gdb.guile/types-module.exp @@ -18,15 +18,14 @@ load_lib gdb-guile.exp +require allow_guile_tests + standard_testfile .cc if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { return -1 } -# Skip all tests if Guile scripting is not enabled. -if { [skip_guile_tests] } { continue } - if ![gdb_guile_runto_main] { return } diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp index 845d584b914..f2307372b8b 100644 --- a/gdb/testsuite/lib/gdb-guile.exp +++ b/gdb/testsuite/lib/gdb-guile.exp @@ -18,24 +18,11 @@ # Guile doesn't print the 0x prefix on hex numbers. set ghex {[0-9a-f]+} -# Return a 1 for configurations that do not support Guile scripting. +# Return a 1 for configurations that support Guile scripting. -proc skip_guile_tests {} { - global gdb_prompt - - gdb_test_multiple "guile (display \"test\\n\")" "verify guile support" { - -re "Undefined command.*$gdb_prompt $" { - unsupported "Guile not supported." - return 1 - } - -re "not supported.*$gdb_prompt $" { - unsupported "Guile support is disabled." - return 1 - } - -re "$gdb_prompt $" {} - } - - return 0 +gdb_caching_proc allow_guile_tests { + set output [exec $::GDB --configuration] + return [expr {[string first "--with-guile" $output] != -1}] } # Run a command in GDB, and report a failure if a Scheme exception is thrown. -- 2.30.2