From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 301DD393BC2F for ; Mon, 27 Apr 2020 16:42:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 301DD393BC2F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-88-OapPXTvTO3isA1gs7mKRbQ-1; Mon, 27 Apr 2020 12:42:32 -0400 X-MC-Unique: OapPXTvTO3isA1gs7mKRbQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F6971005510; Mon, 27 Apr 2020 16:42:31 +0000 (UTC) Received: from theo.uglyboxes.com (ovpn-112-88.phx2.redhat.com [10.3.112.88]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 074455D9DA; Mon, 27 Apr 2020 16:42:30 +0000 (UTC) Subject: Re: [PATCH 2/4] gdb/testsuite: Detect and warn if paths are used in test names To: Andrew Burgess Cc: gdb-patches@sourceware.org References: <20200427155858.GG3522@embecosm.com> From: Keith Seitz Message-ID: <856efd0a-243d-e366-eb48-85fc65349706@redhat.com> Date: Mon, 27 Apr 2020 09:42:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200427155858.GG3522@embecosm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 16:42:35 -0000 On 4/27/20 8:58 AM, Andrew Burgess wrote: > * Keith Seitz [2020-04-23 13:26:30 -0700]: >>> +set local_record_procs(pass) "check_test_names" >>> +set local_record_procs(fail) "check_test_names" >>> +set local_record_procs(xfail) "check_test_names" >>> +set local_record_procs(kfail) "check_test_names" >>> +set local_record_procs(xpass) "check_test_names" >>> +set local_record_procs(kpass) "check_test_names" >>> +set local_record_procs(unresolved) "check_test_names" >>> +set local_record_procs(untested) "check_test_names" >>> +set local_record_procs(unsupported) "check_test_names" >> >> Since I failed to contain the Tcl pedantic in me, the above >> can be more Tcl-ishly written with `array set', but I am not >> requesting that you change anything. Just FYI. > > Thanks for your feedback, I'm making a few changes to the patch, but I > wanted to follow up on the 'array set' issue, I'd like to get things > right where I can, however, in this case.... > > $ tclsh > % array set foo {} > % array set foo(bar) 1 > list must have an even number of elements > > This is inline with what I see when I try to use 'array set ....' > within the Dejagnu script, I get the error 'list must have an even > number of elements'. > > Is there something I'm doing wrong here? Or is 'array set' not > actually needed in this case? To be clear -- I apologize if I wasn't earlier -- you do not /need/ to use array set. As I mentioned, the more Tcl-ish way to write large array initializations is array set local_record_procs { pass check_test_names fail check_test_names # ... } "array set" takes a list of key-value pairs, so there must be an even number of elements in the list. However, in hindsight, since all these are being set to the same value, an even more Tcl-ish way: foreach nm {pass fail xfail kfail xpass kpass unresolved untested unsupported} { set local_record_procs($nm) check_test_names } [While tempting to use "[array names local_record_procs]", reading framework.exp shows that this array is not actually expected to exist, so we have to explicitly list out all test result outcomes.] Okay, that was probably way more hassle than necessary... I promise to backburner my [counterproductive] Tcl pedantic-ness[sic]! Sorry about that, Keith