diff options
author | Tom de Vries <tdevries@suse.de> | 2023-09-14 20:34:00 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-09-14 20:34:00 +0200 |
commit | d03878e670db238ab358511f5b201bef4768c3c2 (patch) | |
tree | db9ecedf87d8ee7305d7ceb7dcfe3b9364400d97 /gdb/testsuite/gdb.base | |
parent | d7680f13df105aa8fa0edbdf8efae31a5411f579 (diff) | |
download | gdb-d03878e670db238ab358511f5b201bef4768c3c2.zip gdb-d03878e670db238ab358511f5b201bef4768c3c2.tar.gz gdb-d03878e670db238ab358511f5b201bef4768c3c2.tar.bz2 |
[gdb/testsuite] Modernize gdb.base/huge.exp
Rewrite test-case gdb.base/huge.exp:
- use build_executable rather than gdb_compile,
- use save_vars,
- factor out hardcoded loop limits min and max,
- handle compilation failure using require, and
- avoid using . in regexp to match $, {} and <>.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/huge.exp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp index e28310c..fc8909d 100644 --- a/gdb/testsuite/gdb.base/huge.exp +++ b/gdb/testsuite/gdb.base/huge.exp @@ -23,29 +23,44 @@ require {!target_info exists gdb,skip_huge_test} standard_testfile .c -for { set size [expr 2 * 1024 * 1024] } { $size > 10 } { set size [expr $size / 2] } { - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ - executable [list debug "additional_flags=-DCRASH_GDB=$size"]] \ - == "" } break -} -if { $size < 10 } { - untested "size less than 10" - return -1 +set max [expr 2 * 1024 * 1024] +set min 16 + +set opts {} +lappend opts debug + +set compilation_succeeded 0 +for { set size $max } { $size >= $min } { set size [expr $size / 2] } { + set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]] + if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } { + continue + } + + set compilation_succeeded 1 + break } +require {expr $compilation_succeeded} # Start with a fresh gdb. - clean_restart ${binfile} -set prev_timeout $timeout -set timeout 30 - -if {![runto_main]} { - return -1 -} +save_vars { timeout } { + set timeout 30 -gdb_test_no_output "set max-value-size unlimited" + if {![runto_main]} { + return -1 + } -gdb_test "print a" ".1 = .0 .repeats \[0123456789\]+ times.." "print a very large data object" + gdb_test_no_output "set max-value-size unlimited" -set timeout $prev_timeout + set re \ + [list \ + [string_to_regexp $] \ + $decimal \ + " = " \ + [string_to_regexp "{0 <repeats "] \ + $decimal \ + [string_to_regexp " times>}"]] + set re [join $re ""] + gdb_test "print a" $re "print a very large data object" +} |