From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id C31473858D38 for ; Fri, 23 Sep 2022 18:37:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C31473858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28NEw0IS024778; Fri, 23 Sep 2022 20:37:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=W0rQVyqP2qDXVlmjmTwfCQeBY0fYeTjPButDLnckbp8=; b=J8HuBAtDiz//BbbC9cb3lcsmSEF6EetG1pbnlK2+jNdCKggYuDz045EmxFeSrDvsiC1E /6dfRaQNzHEeyzD2tdu8P468Oo+q1RdWi89d7PaGYSxDQMwF/vhf1q5BxgBpjRWEyXQe JatyBwNsy0PBi8WYLQP995iVFMrZw7KZNHaXzoy+FkT7+RcDzqmHMBX+OjBwPjodPL9z G5HbSAXntY1mlKtuvV3fhwWMeD17iWF0bpjzraHfGyVrfbEYi/3hpnfSSOW9jwO3QdlS S6aw3LFxc+XdN2dSZYfRJJah4ECgdvAmkAQ03ZeQiEG5YrUTMxx6fHPdc0s2Hf/E3Vd7 vA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3jn6augrcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Sep 2022 20:37:33 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4F07E10002A; Fri, 23 Sep 2022 20:37:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2A34925AEEA; Fri, 23 Sep 2022 20:37:30 +0200 (CEST) Received: from [10.210.55.83] (10.75.127.49) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 20:37:27 +0200 Message-ID: <6b9d664b-e7f4-c7c9-e167-137cfeca5924@foss.st.com> Date: Fri, 23 Sep 2022 20:37:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH v2] testsuite: Only run test on target if VMA == LMA Content-Language: en-US To: =?UTF-8?Q?Torbj=c3=b6rn_SVENSSON_via_Gcc-patches?= , References: <20220920132515.844262-1-torbjorn.svensson@foss.st.com> From: Torbjorn SVENSSON In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-23_07,2022-09-22_02,2022-06-22_01 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Richard, Thanks for your review. Comments below. On 2022-09-23 19:34, Richard Sandiford wrote: > Torbjörn SVENSSON via Gcc-patches writes: >> Checking that the triplet matches arm*-*-eabi (or msp430-*-*) is not >> enough to know if the execution will enter an endless loop, or if it >> will give a meaningful result. As the execution test only work when >> VMA and LMA are equal, make sure that this condition is met. >> >> 2022-09-16 Torbjörn SVENSSON >> >> gcc/testsuite/ChangeLog: >> >> * lib/target-supports.exp (check_effective_target_vma_equals_lma): New. >> * c-c++-common/torture/attr-noinit-1.c: Requre VMA == LMA to run. >> * c-c++-common/torture/attr-noinit-2.c: Likewise. >> * c-c++-common/torture/attr-noinit-3.c: Likewise. >> * c-c++-common/torture/attr-persistent-1.c: Likewise. >> * c-c++-common/torture/attr-persistent-3.c: Likewise. > > Looks like a nice thing to have. > > Could you add an entry to doc/sourcebuild.texi too? I've added a note and will be shared in a v3. >> + >> + # Example output of objdump: >> + #vma_equals_lma9059.exe: file format elf32-littlearm >> + # >> + #Sections: >> + #Idx Name Size VMA LMA File off Algn >> + # 6 .data 00000558 20000000 08002658 00020000 2**3 >> + # CONTENTS, ALLOC, LOAD, DATA >> + >> + # Capture LMA and VMA columns for .data section >> + if ![ regexp "\d*\d+\s+\.data\s+\d+\s+(\d+)\s+(\d+)" $output dummy vma lma ] { > > Maybe my Tcl is getting rusty, but I'm surprised this quoting works. > I'd have expected single backslashes to be interpreted as C-style > sequences (for \n etc) and so be eaten before regexp sees them. > Quoting with {...} instead of "..." would avoid that. Good catch! I'm not fluent in Tcl and apparently, I was not testing this well enough before sending it to the list. I got the expected result for the test cases, but for the wrong reason. I've correct it for the v3. >> + verbose "Could not parse objdump output" 2 >> + return 0 >> + } else { >> + return [string equal $vma $lma] >> + } >> + } else { >> + remote_file build delete $exe >> + verbose "Could not determine if VMA is equal to LMA. Assuming not equal." 2 >> + return 0 >> + } > > Would it be more conservative to return 1 on failure rather than 0? > That way, a faulty test would trigger XFAILs rather than UNSUPPORTEDs, > with XFAILs being more likely to get attention. The main issue here is that for targets where VMA != LMA, executing the tests will fall into an endless recursion loop. Well, "endless" in the sense that the stack might be depleted or the test will simply timeout. The test cases are designed to assume that it's safe to call _start() from within main() to verify that the state of some variables tagged with certain attributes are correct after a "reset". > On the other hand, I suppose we don't lose much if these tests are > run on common targets only. So either way is OK, just asking. ;-) Do you think it's worth to have these tests reach the timeout to have them in the XFAIL list rather than in the UNSUPPORTED list? Keep in mind that it's not just one test case, it's 5 test cases times the number of permutations of the CFLAGS... It's also not expected that these test cases will be changed in a way that will make them work when VMA != LMA. Kind regards, Torbjörn