From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78492 invoked by alias); 1 Dec 2015 13:43:35 -0000 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 Received: (qmail 78377 invoked by uid 89); 1 Dec 2015 13:43:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 01 Dec 2015 13:43:30 +0000 Received: by pacdm15 with SMTP id dm15so5813730pac.3 for ; Tue, 01 Dec 2015 05:43:28 -0800 (PST) X-Received: by 10.66.139.234 with SMTP id rb10mr44899278pab.82.1448977408722; Tue, 01 Dec 2015 05:43:28 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id cc16sm58927777pac.44.2015.12.01.05.43.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Dec 2015 05:43:27 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Run gdb.base/sizeof.exp with board having gdb,noinferiorio Date: Tue, 01 Dec 2015 13:43:00 -0000 Message-Id: <1448977402-9487-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00013.txt.bz2 In my remote cross testing (x86_64 host and aarch64 target), the test gdb.base/sizeof.exp is skipped because gdb,noinferiorio is defined in my gdbserver board file. Tests are skipped because the test checks the expected value from the program's output, but I don't see why must do it this way. With my patch applied, we can save the result in variable in the program, and check the variable then. Then, the test doesn't rely on inferiorio. However, in check_valueof, the value is still checked by printing from the program, because I don't know why do we test in this way, so I leave them there. With boards having gdb,noinferiorio, these check_valueof tests are unsupported. The rest of tests can be run unconditionally. gdb/testsuite: 2015-12-01 Yao Qi * gdb.base/sizeof.c (main): New variable 'size'. Remove printf. Assign return value to size. * gdb.base/sizeof.exp: Remove the checking to gdb,noinferiorio at the beginning. (check_sizeof): Check the result by printing variable 'size'. (check_valueof): Do the test if gdb,noinferiorio doesn't exist, otherwise mark the test unsupported. --- gdb/testsuite/gdb.base/sizeof.c | 24 ++++++++++++------------ gdb/testsuite/gdb.base/sizeof.exp | 28 +++++++++++----------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/gdb/testsuite/gdb.base/sizeof.c b/gdb/testsuite/gdb.base/sizeof.c index eb21f22..86deff5 100644 --- a/gdb/testsuite/gdb.base/sizeof.c +++ b/gdb/testsuite/gdb.base/sizeof.c @@ -100,22 +100,22 @@ fill_structs (void) int main () { + int size; + gdb_unbuffer_output (); fill_structs (); - printf ("sizeof (char) == %d\n", (int) sizeof (char)); - printf ("sizeof (short) == %d\n", (int) sizeof (short)); - printf ("sizeof (int) == %d\n", (int) sizeof (int)); - printf ("sizeof (long) == %d\n", (int) sizeof (long)); - printf ("sizeof (long long) == %d\n", (int) sizeof (long long)); - - printf ("sizeof (void *) == %d\n", (int) sizeof (void*)); - printf ("sizeof (void (*)(void)) == %d\n", (int) sizeof (void (*)(void))); - - printf ("sizeof (float) == %d\n", (int) sizeof (float)); - printf ("sizeof (double) == %d\n", (int) sizeof (double)); - printf ("sizeof (long double) == %d\n", (int) sizeof (long double)); + size = (int) sizeof (char); + size = (int) sizeof (short); + size = (int) sizeof (int); + size = (int) sizeof (long); + size = (int) sizeof (long long); + size = (int) sizeof (void*); + size = (int) sizeof (void (*)(void)); + size = (int) sizeof (float); + size = (int) sizeof (double); + size = (int) sizeof (long double); /* Signed char? */ printf ("valueof ('\\377') == %d\n", '\377'); diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index ce6b7ed..776fc9b 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -15,11 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -if [target_info exists gdb,noinferiorio] { - verbose "Skipping sizeof.exp because of no fileio capabilities." - continue -} - # # test running programs # @@ -68,12 +63,8 @@ set sizeof_long_double [get_sizeof "long double" 8] # proc check_sizeof { type size } { - global gdb_prompt - - set pat [string_to_regexp "sizeof (${type}) == ${size}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check sizeof \"$type\"" + gdb_test "next" "" "" + gdb_test "p size" " = ${size}" "check sizeof \"$type\"" } check_sizeof "char" ${sizeof_char} @@ -90,12 +81,15 @@ check_sizeof "double" ${sizeof_double} check_sizeof "long double" ${sizeof_long_double} proc check_valueof { exp val } { - global gdb_prompt - - set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"] - gdb_test_stdio "next" "${pat}" \ - "\[0-9\].*" \ - "check valueof \"$exp\"" + if [target_info exists gdb,noinferiorio] { + gdb_test "next" "" "" + unsupported "check valueof \"$exp\"" + } else { + set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"] + gdb_test_stdio "next" "${pat}" \ + "\[0-9\].*" \ + "check valueof \"$exp\"" + } } # Check that GDB and the target agree over the sign of a character. -- 1.9.1