Rename to allow_guile_tests
authorTom Tromey <tom@tromey.com>
Sun, 8 Jan 2023 19:01:33 +0000 (12:01 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 13 Jan 2023 20:18:58 +0000 (13:18 -0700)
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.

28 files changed:
gdb/testsuite/gdb.guile/scm-arch.exp
gdb/testsuite/gdb.guile/scm-block.exp
gdb/testsuite/gdb.guile/scm-breakpoint.exp
gdb/testsuite/gdb.guile/scm-cmd.exp
gdb/testsuite/gdb.guile/scm-disasm.exp
gdb/testsuite/gdb.guile/scm-equal.exp
gdb/testsuite/gdb.guile/scm-error.exp
gdb/testsuite/gdb.guile/scm-frame-args.exp
gdb/testsuite/gdb.guile/scm-frame-inline.exp
gdb/testsuite/gdb.guile/scm-frame.exp
gdb/testsuite/gdb.guile/scm-gsmob.exp
gdb/testsuite/gdb.guile/scm-iterator.exp
gdb/testsuite/gdb.guile/scm-lazy-string.exp
gdb/testsuite/gdb.guile/scm-math.exp
gdb/testsuite/gdb.guile/scm-objfile-script.exp
gdb/testsuite/gdb.guile/scm-objfile.exp
gdb/testsuite/gdb.guile/scm-parameter.exp
gdb/testsuite/gdb.guile/scm-ports.exp
gdb/testsuite/gdb.guile/scm-pretty-print.exp
gdb/testsuite/gdb.guile/scm-progspace.exp
gdb/testsuite/gdb.guile/scm-section-script.exp
gdb/testsuite/gdb.guile/scm-symbol.exp
gdb/testsuite/gdb.guile/scm-symtab.exp
gdb/testsuite/gdb.guile/scm-type.exp
gdb/testsuite/gdb.guile/scm-value-cc.exp
gdb/testsuite/gdb.guile/scm-value.exp
gdb/testsuite/gdb.guile/types-module.exp
gdb/testsuite/lib/gdb-guile.exp

index 7ec1db108ef78d44f81cb1656d3cd8031f7abe39..c2554d853d9cb258adb849eac6b280f732d3d85f 100644 (file)
 
 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
 }
index 666d6fd458dfd5970b82175e210046fdbb3744a3..20fbd1784b514e496ffac48473a9957256526913 100644 (file)
 
 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
 }
index cd469ca4488dda30a6d6cfec734fe66221a53831..a9e656ddfc0df92f173e182f63f9ecb1eb2e5a33 100644 (file)
 
 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
 
index 1d4e13d7aef38666a1f3587a8e61ef31105b4a7d..a7fb59b00897148964ed59a5d1539765b5e01477 100644 (file)
 
 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
 }
index 6609c746756671d284d3af3ebea247182c4618d4..37b710f9f9975178acaeee2fb6f4c28f388e9e5d 100644 (file)
 
 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
 }
index d2fb9ef0161c6dd760db3e76392bad6e805e98d9..3f6e0c51986ca9b4f8eb023afe18c35c6e9d7266 100644 (file)
 
 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
 }
index b0de521cb5c87df409e9dc431abd62809fbd9603..168d71d1b9e4d716b93539db9114c74f8fff7b8c 100644 (file)
@@ -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 \
index 075f4419c1796a34d6d4cce9b186d0ca6b362f4a..67c10f65b3e597766e29c0cd310e29b0e8fca9f6 100644 (file)
 
 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
 }
index 88a69fd882bfce96240b5ca4f2e02efcd5bf816c..1f73ed67b903b5c18d0b19b6ad1f9a351dcebdeb 100644 (file)
 
 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
 }
index 3118d6bcd2fa96a318b3f30b9d36e5b34063b7d2..2e854967d3643427a182e4cac9ea9120ae172d19 100644 (file)
 
 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] {
index ded2a85c9d243364e4dcb7e12531a63ddb47a452..a7c95c01c1161a0384e45b2815e317e3497e34d9 100644 (file)
 
 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
index 15974523324f51975bc89637ca341555b5acf234..0bf459518a175c6d51bf4d11cb3c4518964d1c7d 100644 (file)
 
 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
 }
index 9b2960a4093030eb2bae863a236c2959522dcce9..605235648a3ba6fae5259b2f1a16a30c44593d5d 100644 (file)
 
 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
 
index 97a2e58766b31cbad19112e33ca022aa0617231d..42e195a0778a4a42292f8dbecaca949acf6dd0f3 100644 (file)
@@ -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
 }
index bd0fd003cb6e732c777600a597e09fe8a24148d8..5b480d1ea55e3c0755af620b933e41d2c9d65f92 100644 (file)
@@ -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.
index eb49600aa2c827735b5cf00b1afd61f96fe4e905..f27c9f4027c97314862df0a365493065da5d329c 100644 (file)
 
 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
 }
index db76fc2d1c8ee2676c7c4f2b58a78853ddba4814..d62ae473faa979ab4ae196929475bb659f286f47 100644 (file)
 
 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
 
index 318c434241aa70e8a757f6f71dcd4d6f6afe3c42..f0af5d4bbad26c3ca652415cac8e4c3d2f6f8dcd 100644 (file)
 
 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
 }
index f21ed41bffdf6656ae077e424de787e39d729ed9..3c20edf5061928f487e1c76385f853b3eef5307c 100644 (file)
 
 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
index f43e65e96730fd28b4a959d1b6fd842774d16bb8..c12a81e8ed17c92aca97e60ce94bbbd861fb2904 100644 (file)
@@ -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
 
index 34ee6de3fdba6df5d6a3314835f44839efbc204a..9e52939aae38906402b8d2741671738b7dac76a5 100644 (file)
@@ -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.
index f4b935f787f70d04158641d795b30b9c03d84607..fa2cf77828466251a84124252bfbe42f08faf3ed 100644 (file)
 
 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
index 33308e0f008ce25c496f3f6401a52957bf9ac84b..0f468b7d37323e6a6bd8724ef2d6a995f829a67f 100644 (file)
@@ -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
 }
index f8902a30a6217d380674df1fe225526c1b863f10..45139cba0d5316de36017f8b7f1d76e7ad1be0d0 100644 (file)
@@ -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
     }
 
index 5b2a3c96c806e4d10d849f2133c3637ef4094bdf..921d7a939a3e3aab66cb312b05a75bdd286d0544 100644 (file)
@@ -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
 }
index 9858b1c1a387241cf16d783009038b0b5484b321..a00c9409086dd98687391d75455de89ac56af35b 100644 (file)
@@ -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
 
index 520c9021575477ac965429a64d1337198c3a223d..2b90d1b613a9105442980e0b10d30a2015c49087 100644 (file)
 
 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
 }
index 845d584b91493d3ee433eadae600be345edd3df0..f2307372b8b68b531295e477796a9626b0fd4ee7 100644 (file)
 # 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.