From patchwork Mon Nov 9 15:34:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 9610 Received: (qmail 48772 invoked by alias); 9 Nov 2015 15:34:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 48687 invoked by uid 89); 9 Nov 2015 15:34:32 -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-f52.google.com Received: from mail-pa0-f52.google.com (HELO mail-pa0-f52.google.com) (209.85.220.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 09 Nov 2015 15:34:28 +0000 Received: by pacdm15 with SMTP id dm15so178201952pac.3 for ; Mon, 09 Nov 2015 07:34:26 -0800 (PST) X-Received: by 10.67.22.66 with SMTP id hq2mr40232295pad.81.1447083266260; Mon, 09 Nov 2015 07:34:26 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc2-power8.osuosl.org. [140.211.9.43]) by smtp.gmail.com with ESMTPSA id hz4sm17059138pbc.12.2015.11.09.07.34.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Nov 2015 07:34:25 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] gdb.base/gnu_vector.exp: Don't test output from the inferior Date: Mon, 9 Nov 2015 15:34:15 +0000 Message-Id: <1447083255-12820-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes gdb.base/gnu_vector.c printf the vector and gdb.base/gnu_vector.exp expects the output by gdb_test_multiple. Nowadays, the test doesn't expect the output from inferior_spawn_id, which is wrong. Even we change the test to expect from inferior_spawn_id for the inferior output, it is still possible the inferior exit before tcl/expect gets the inferior output. We see this fail on both s390x-linux and ppc-linux on buildbot, FAIL: gdb.base/gnu_vector.exp: verify vector return value (the program exited) https://sourceware.org/ml/gdb-testers/2015-q4/msg04922.html https://sourceware.org/ml/gdb-testers/2015-q4/msg04952.html In order to address these two shortcomings above in gnu_vector.exp, this patch rewrites the test a little bit. Get rid of checking the inferior output, and instead checking them by printing them. In this way, the test can also be run on the target without inferior io (gdb,noinferiorio is set in the board file). gdb/testsuite: 2015-11-09 Yao Qi * gdb.base/gnu_vector.exp: Check the return value by "p res". * gdb.base/gnu_vector.c: Don't include stdio.h. (main): Don't print res and call add_some_intvecs. --- gdb/testsuite/gdb.base/gnu_vector.c | 5 ++--- gdb/testsuite/gdb.base/gnu_vector.exp | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/gdb.base/gnu_vector.c b/gdb/testsuite/gdb.base/gnu_vector.c index 4e505d1..b6ed9f7 100644 --- a/gdb/testsuite/gdb.base/gnu_vector.c +++ b/gdb/testsuite/gdb.base/gnu_vector.c @@ -18,7 +18,6 @@ Contributed by Ken Werner */ #include -#include #define VECTOR(n, type) \ type __attribute__ ((vector_size (n * sizeof(type)))) @@ -139,10 +138,10 @@ main () int4 res; res = add_some_intvecs (i4a, i4a + i4b, i4b); - printf ("%d %d %d %d\n", res[0], res[1], res[2], res[3]); res = add_some_intvecs (i4a, i4a + i4b, i4b); - printf ("%d %d %d %d\n", res[0], res[1], res[2], res[3]); + + add_some_intvecs (i4a, i4a + i4b, i4b); return 0; } diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp index 09593d2..ba35ab5 100644 --- a/gdb/testsuite/gdb.base/gnu_vector.exp +++ b/gdb/testsuite/gdb.base/gnu_vector.exp @@ -216,8 +216,13 @@ gdb_test_multiple "finish" $test { } } -# Test "return" from vector-valued function. gdb_continue "add_some_intvecs" +gdb_test "up" "" +gdb_test "p res" "\\{10, 20, 48, 72\\}.*" +gdb_test "down" "" + + +# Test "return" from vector-valued function. set test "return from vector-valued function" set should_kfail 0 gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test { @@ -233,16 +238,6 @@ gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test { exp_continue } } -set test "verify vector return value" -gdb_test_multiple "continue" $test { - -re "4 2 7 6\r\n.*$gdb_prompt $" { - pass $test - } - -re "10 20 48 72\r\n.*$gdb_prompt $" { - if { $should_kfail } { - kfail "gdb/8549" $test - } else { - fail $test - } - } -} + +gdb_test "next" "" +gdb_test "p res" "\\{4, 2, 7, 6\\}.*" "verify vector return value"