From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18845 invoked by alias); 13 Feb 2009 16:13:37 -0000 Received: (qmail 18836 invoked by uid 22791); 13 Feb 2009 16:13:36 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Feb 2009 16:13:26 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n1DGDPd7008249 for ; Fri, 13 Feb 2009 11:13:25 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n1DGDNwi008549; Fri, 13 Feb 2009 11:13:24 -0500 Received: from opsy.redhat.com (vpn-13-214.rdu.redhat.com [10.11.13.214]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n1DGDLuM004972; Fri, 13 Feb 2009 11:13:23 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 723F98880F4; Fri, 13 Feb 2009 09:13:19 -0700 (MST) To: gdb-patches@sourceware.org Subject: FYI: small test suite cleanup From: Tom Tromey Reply-To: tromey@redhat.com Date: Fri, 13 Feb 2009 16:36:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00305.txt.bz2 I needed get_sizeof for the charset patch, and while looking I found multiple copies of this in the testsuite. This patch consolidates most of them -- I left a get_valueofx in pc-fp.exp. Built and regtested on x86-64 (compile farm). Tom 2009-02-13 Tom Tromey * gdb.base/remote.exp (get_sizeof): Remove. * gdb.base/long_long.exp (get_valueof, get_sizeof): Remove. * gdb.base/dfp-test.exp (get_valueof, get_sizeof): Remove. * gdb.base/sizeof.exp (get_valueof, get_sizeof): Remove. * lib/gdb.exp (get_valueof): Move from long_long.exp. (get_sizeof): Likewise. diff --git a/gdb/testsuite/gdb.base/dfp-test.exp b/gdb/testsuite/gdb.base/dfp-test.exp index 32f36a9..94fcb41 100644 --- a/gdb/testsuite/gdb.base/dfp-test.exp +++ b/gdb/testsuite/gdb.base/dfp-test.exp @@ -43,26 +43,6 @@ if ![runto_main] then { continue } -# Detect the size of the target's basic types (from gdb.base/long_long.exp). - -proc get_valueof { fmt exp default } { - global gdb_prompt - send_gdb "print${fmt} ${exp}\n" - gdb_expect { - -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" { - set val $expect_out(1,string) - } - timeout { - set val ${default} - } - } - return ${val} -} - -proc get_sizeof { type default } { - return [get_valueof "/d" "sizeof (${type})" $default] -} - set sizeof_long [get_sizeof "long" 4] proc d32_set_tests {} { diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index e585396..d0ad5ba 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -74,26 +74,6 @@ gdb_expect { # Detect the size of the target's basic types. -proc get_valueof { fmt exp default } { - global gdb_prompt - send_gdb "print${fmt} ${exp}\n" - gdb_expect { - -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" { - set val $expect_out(1,string) - pass "get value of ${exp} ($val)" - } - timeout { - set size ${default} - fail "get value of ${exp} (timeout)" - } - } - return ${val} -} - -proc get_sizeof { type default } { - return [get_valueof "/d" "sizeof (${type})" $default] -} - set sizeof_char [get_sizeof "char" 1] set sizeof_short [get_sizeof "short" 2] set sizeof_int [get_sizeof "int" 4] diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp index 0dee13a..113c56b 100644 --- a/gdb/testsuite/gdb.base/remote.exp +++ b/gdb/testsuite/gdb.base/remote.exp @@ -125,22 +125,6 @@ gdb_load_timed $binfile "limit" 0 # Query GDB for the size of various types # -proc get_sizeof { type default } { - global gdb_prompt - send_gdb "print/d sizeof (${type})\n" - gdb_expect { - -re "\\$\[0-9\]* = (\[0-9\]*).*$gdb_prompt $" { - set size $expect_out(1,string) - pass "get sizeof ${type} ($size)" - } - timeout { - set size ${default} - fail "get sizeof ${type} (timeout)" - } - } - return ${size} -} - # Get the size of random_data table (defaults to 48K). set sizeof_random_data [get_sizeof "random_data" 48*1024] diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index 61a6be3..82f0da2 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -61,24 +61,6 @@ if ![runto_main] then { # Query GDB for the size of various types # -proc get_valueof { fmt exp default } { - global gdb_prompt - - set test "get valueof \"${exp}\"" - set val ${default} - gdb_test_multiple "print${fmt} ${exp}" "$test" { - -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" { - set val $expect_out(1,string) - pass "$test ($val)" - } - } - return ${val} -} - -proc get_sizeof { type default } { - return [get_valueof "/d" "sizeof (${type})" $default] -} - gdb_test "next" set sizeof_char [get_sizeof "char" 1] diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b0059b7..e329b96 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2878,3 +2878,26 @@ proc prepare_for_testing { testname executable {sources ""} {options {debug}}} { return 0 } + +proc get_valueof { fmt exp default } { + global gdb_prompt + + set test "get valueof \"${exp}\"" + set val ${default} + gdb_test_multiple "print${fmt} ${exp}" "$test" { + -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" { + set val $expect_out(1,string) + pass "$test ($val)" + } + timeout { + set size ${default} + fail "get value of ${exp} (timeout)" + } + } + return ${val} +} + +proc get_sizeof { type default } { + return [get_valueof "/d" "sizeof (${type})" $default] +} +