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.
This commit is contained in:
Tom Tromey 2023-01-08 12:01:33 -07:00
parent e0c86460bc
commit e71b6502bf
28 changed files with 56 additions and 97 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View 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 \

View File

@ -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
}

View File

@ -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
}

View File

@ -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] {

View File

@ -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

View File

@ -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
}

View File

@ -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

View 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
}

View 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.

View File

@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View 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

View 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.

View File

@ -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

View 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
}

View 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
}

View 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
}

View 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

View File

@ -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
}

View File

@ -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.