From patchwork Tue May 28 18:25:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32874 Received: (qmail 124162 invoked by alias); 28 May 2019 18:26:05 -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 124149 invoked by uid 89); 28 May 2019 18:26:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=a2, hopes, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 May 2019 18:26:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4E912117D4F; Tue, 28 May 2019 14:26:02 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XYKJbnqPq6Ew; Tue, 28 May 2019 14:26:02 -0400 (EDT) Received: from murgatroyd.Home (174-29-48-168.hlrn.qwest.net [174.29.48.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id CC7B1117D4C; Tue, 28 May 2019 14:26:01 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Joel Brobecker , vries@gcc.gnu.org, Tom Tromey Subject: [PATCH] Fix gdb.ada/vla.exp Date: Tue, 28 May 2019 12:25:56 -0600 Message-Id: <20190528182556.20011-1-tromey@adacore.com> MIME-Version: 1.0 PR ada/24539 concerns a test failure in gdb.ada/vla.exp. The problem here is that different versions of Gnat emit the structure's fields in different orders -- with the order currently failing actually being the correct one. This patch attempts to fix the problem by changing the test to accept both orders. I can't test this as all the compilers I have available here use the incorrect order. I've reported a Gnat compiler bug internally in hopes of getting this fixed. gdb/testsuite/ChangeLog 2019-05-28 Tom Tromey PR ada/24539: * gdb.ada/vla.exp (mk): New proc. Use it in test results. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.ada/vla.exp | 26 ++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.ada/vla.exp b/gdb/testsuite/gdb.ada/vla.exp index 7e10e9b8223..3b325c74899 100644 --- a/gdb/testsuite/gdb.ada/vla.exp +++ b/gdb/testsuite/gdb.ada/vla.exp @@ -28,11 +28,29 @@ clean_restart ${testfile} set bp_location [gdb_get_line_number "Set breakpoint here" ${testdir}/vla.adb] runto "vla.adb:$bp_location" +# Helper proc to compute the regexp needed to match both results that +# have been seen. +proc mk {a1 a2} { + set n1 "a1 => $a1, i2 => 2, a2 => $a2, i3 => 3" + set n2 "i2 => 2, i3 => 3, a1 => $a1, a2 => $a2" + return "($n1|$n2)" +} + +# Some versions of gnat emit the variable-length elements after the +# other elements, so these test cases accept both. + +set r00 [mk "\\(\\)" "\\(\\)"] gdb_test "print r00" \ - "= \\(l1 => 0, l2 => 0, i1 => 1, i2 => 2, i3 => 3, a1 => \\(\\), a2 => \\(\\)\\)" + "= \\(l1 => 0, l2 => 0, i1 => 1, $r00\\)" + +set r01 [mk "\\(\\)" "\\(20\\)"] gdb_test "print r01" \ - "= \\(l1 => 0, l2 => 1, i1 => 1, i2 => 2, i3 => 3, a1 => \\(\\), a2 => \\(20\\)\\)" + "= \\(l1 => 0, l2 => 1, i1 => 1, $r01\\)" + +set r10 [mk "\\(10\\)" "\\(\\)"] gdb_test "print r10" \ - "= \\(l1 => 1, l2 => 0, i1 => 1, i2 => 2, i3 => 3, a1 => \\(10\\), a2 => \\(\\)\\)" + "= \\(l1 => 1, l2 => 0, i1 => 1, $r10\\)" + +set r22 [mk "\\(10, 10\\)" "\\(20, 20\\)"] gdb_test "print r22" \ - "= \\(l1 => 2, l2 => 2, i1 => 1, i2 => 2, i3 => 3, a1 => \\(10, 10\\), a2 => \\(20, 20\\)\\)" + "= \\(l1 => 2, l2 => 2, i1 => 1, $r22\\)"