From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2041.outbound.protection.outlook.com [40.107.8.41]) by sourceware.org (Postfix) with ESMTPS id 810393858D20 for ; Wed, 17 Apr 2024 09:39:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 810393858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 810393858D20 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.41 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1713346755; cv=pass; b=Zg4ieLqtYsUoqZX12DaXXif68WFve7WuISlGb2t58ZZy4CA6P8TBCS6FdWl0u6dsgb6YLIh96c4CX68UNxZruqZ8yn7I49KK1zeD2esetfZrHlGuWkYy38admwWSDM5jDj4YANlwZjDjQESR6r/6PcGixlveF05iq9mRyxtyig8= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1713346755; c=relaxed/simple; bh=o67kWrEVyqmTjnpaAsn4f0UrkaEcXPK+OSYivMuQwTQ=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=HvGHsv2a95c53slE1VAaY5Hc2r4fFOGC2Fqv+2S9TDEVCi8WAmXv4thC4arcaArWz1GDwdQ6w8Uync1ZkOk0gbAXbpEtXIZwn7UqSeupFE3FvVpCD+X5AChw/esXIYKzqmzybGxt5qvhpo8gpvj6npAl2s3SO49t8Hj0CbR+1I4= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=VakLJREosZPEGCRtOdlwM+EUDgVQHtHgPyRVIBhluLbN+QfmkUzRQ5UYdeUH7NmtxsUCJsbYEtup3qTs47BQV91b3UBc0YPZjpQHM0GlFuhX11jLJSFgW0IZBN3Jjizaq74Xve1cdwovf2WN0132R+ytN7B/aAomlotgVjb7NhCE9us6cGU8kScgZx1b/EXKViNRh1eryUi3htm/sXvR7u7+d/KM5ldRC4fcj0RShdkmS417K6SRThOdIR1X7zkfqChHcS3fnLGQdp7QHgNsMf73uLtj0ESuLr+Q3uSEKYXgVclk6RXNzhuFdwZt6t9YmMr06t8HDRUDAASS4I3brQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ShfkiW+h2MZCnckZKBSl4O1ahKtW/GQ/2Qi/j0TOePY=; b=OjNqveo6bVCREeQE7AE2RPYuXTzZbmjBasomEsGCPQuWjVkcOde1C1hYlt53dMcZj1gtYa8T923S3tANbSWF5nU4e36ddmp4ZYS8j6BX9qYrpd5lyD9ZmZrCbPQKluGV+GPlT01/NqT08jyooFVexWDM3VoIZa6Cj+rPcpwQMnvGSJdupxlxBXRBJNaPuo+XcZi19w0RC+DoWImJPEE03h1rAvz6+7U7PhWg8DLbdqaNoP8qbatmSmLRT9yZrP1oi1MRC79ZSH/tKedMmoGYk0hvFkWa2k2l16MIBsOJMNl5Ak2JM2qr3ylYNUFwO7+LVrdBZYaQvYAVH++VKHWINg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ShfkiW+h2MZCnckZKBSl4O1ahKtW/GQ/2Qi/j0TOePY=; b=phQa7G2gmgBw3/Az2o6pQAGd47ZHXTNOjtJYqL/JAnKf4WmaOx9R41FPv2VB9YUl6IqSJSNw2egleWhCfv1oQap7EeHYKV3JOa+y6rOaJi1l93mG9Bw/s8aIulAMOq8FlBAgZE1vXtWrdT29YqIqIXwqx61bSp/sfvDIsJamt9M= Received: from DB8PR06CA0009.eurprd06.prod.outlook.com (2603:10a6:10:100::22) by AM8PR08MB6578.eurprd08.prod.outlook.com (2603:10a6:20b:36a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.50; Wed, 17 Apr 2024 09:39:08 +0000 Received: from DB1PEPF000509F9.eurprd02.prod.outlook.com (2603:10a6:10:100:cafe::28) by DB8PR06CA0009.outlook.office365.com (2603:10a6:10:100::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.20 via Frontend Transport; Wed, 17 Apr 2024 09:39:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB1PEPF000509F9.mail.protection.outlook.com (10.167.242.155) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Wed, 17 Apr 2024 09:39:06 +0000 Received: ("Tessian outbound 93e51b94fd50:v313"); Wed, 17 Apr 2024 09:39:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0a673bc8948e3749 X-CR-MTA-TID: 64aa7808 Received: from c5134c002e9b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 69652363-11DA-4074-A78A-83D101D0A03B.1; Wed, 17 Apr 2024 09:39:00 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c5134c002e9b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 17 Apr 2024 09:39:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGzd8xPsRE8dFuQtrE1GOOH+ZgvKDA0Rh1qaNP+0l8s7LTZJyRsFPpYCOP0QbK7wd5+BxU2QG8xM1xBuvOWt0i7iGlga11TQZZ44UGC3g0O5BZ1BfPkDJabnhKOa2Cuy7Dpe01gewSvWgYGsdTPzt1lA1rhPAgReqIwtvFeClzjQM9/yPbkUEpGgZWA5EV40GgQV9t0XBh/XOF0STSE90n+zDwQ4mrIIyX+Ym7NaLLY7ssWosiKTu4ABugeQ09KR/Bv6MDva4x6MhuVBNVxPfusJx5Q708lU/7WjMUtF49yUG86iU4s2WYOgREWUKgN3l0fyN9tw7TEL67iDqR3rdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ShfkiW+h2MZCnckZKBSl4O1ahKtW/GQ/2Qi/j0TOePY=; b=eq9tE3AO7Jp0Bpm3KId+U6WJQmdhCoSZfOMFKggfUQK02LENMQe4y8ztPpIbeqDmHnqz9qSld12MDqk3Qmhw+g2UjTiWjBIB1po1HYnDKu4j9TczRy/xyRG4sp5uPJrg6yPMc7yvk3DcskC00Y8yhQe8o/1+z3pwdnpAJiEOVdmBv5lcRGvrpYGH6NXwB47ZwZ5EKIZP5A1dlLZxtMN0VApSs1yrwSaXbrpEy43fYdvr6o7w7NstXGzN4jP3YzCiPaMlUWoYcZsKrwLIQjJg460MihFupVg7rmoDu813SOZt1jfbiJUS4fTN5avsMvS718s9z2Vt5JY6RwfybfKCjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ShfkiW+h2MZCnckZKBSl4O1ahKtW/GQ/2Qi/j0TOePY=; b=phQa7G2gmgBw3/Az2o6pQAGd47ZHXTNOjtJYqL/JAnKf4WmaOx9R41FPv2VB9YUl6IqSJSNw2egleWhCfv1oQap7EeHYKV3JOa+y6rOaJi1l93mG9Bw/s8aIulAMOq8FlBAgZE1vXtWrdT29YqIqIXwqx61bSp/sfvDIsJamt9M= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AS4PR08MB7688.eurprd08.prod.outlook.com (2603:10a6:20b:507::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.51; Wed, 17 Apr 2024 09:38:58 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::77d4:d040:b19d:6472]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::77d4:d040:b19d:6472%4]) with mapi id 15.20.7452.049; Wed, 17 Apr 2024 09:38:58 +0000 Message-ID: <704f5b93-c0f8-4e50-8180-f57466833e35@arm.com> Date: Wed, 17 Apr 2024 10:38:56 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 7/8] gdb/testsuite: Add unittest for qIsAddressTagged packet Content-Language: en-US To: Gustavo Romero , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com References: <20240416140728.198163-1-gustavo.romero@linaro.org> <20240416140728.198163-8-gustavo.romero@linaro.org> From: Luis Machado In-Reply-To: <20240416140728.198163-8-gustavo.romero@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P123CA0102.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::17) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS4PR08MB7688:EE_|DB1PEPF000509F9:EE_|AM8PR08MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a50f83d-17dd-403f-8704-08dc5ec239e7 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: opGqgDXNLtVS5TK18LVi/ea10ck3TwDW31D32NseCZ8uPiLj51dLFhBHiMv6YSvwEkjmiacNz2P9I33rCgpmjpAR8n7rscZp9+awRX72al8a8ozA0PuOyayRZXv3snMZ2ZqruM7+blIEiFQ2vmrZqd6/dmXMU0LOmW+mJOfayKp3PyLITRQBasHn1yaUsl4hTRg3KVgEXK8Fvgx6Fe6dVw8mNBAZonIEPrCCx2JOJ1e9gnc3SjOv90LsDSTWiOOG8VQjv3D4hCSmuKBavCOCXfGZaKDl0KYApw+i3u7YaeOXrDvV/uknVcCoEhA0IEpQQzm2sQL9h96fczADUMJFvLYdbcm7nu+erxeFNZxYMYuzugeeXP1CaftlMKDy6zmcwIjgFu7LCLiM5CmMSNREs21HzfKXMC35Tj5/a28ASzmpUvuPx45bRdwz+FTZ+t4Iv7/d6csPALTo7Q0oQvrkKShoB9iDHRL7RVOIjYc+bKKZFrS5Gdg74DrNdouGz7cMHgtSI7p+aodEJGd0Vz4mUqcqAsuk//Tx6IQxYsgy24rws7tmme3NkcPugvn02zHdir2frpOLzDXIBPKWij96GXA+cZa7aYGStAKx66RJ9CVThLDOxHKMciDnjscvXHsvv9ZGuAaozwa4LqE014AKXPEXMsS1OJBC0PwAaMdL+YQ= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7688 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF000509F9.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 398b7719-eddf-4576-87fc-08dc5ec234c9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t2Xl2SZ6ihkZ+IyH0YNkdNummXus/kNbS4jH/30L+1wJb1dpITC+dvtHLE8HmcW1/HU3FwfiKbHlIbdUF1BGgqPaEjds3fC+cHndufzmVDUFV64hnWD5ud/3xFzX7O3a2H8jLebe6DDfzLlSWN2OLKSrqdS/F5bi4RRispXaFcdsHuMLqoyIWJ3XZqhPSIq0EgGj6d//quXBFa77uQyNV8X1aNXz6TUBOEhkqueCzU3scI6RAE7wD7/lOeYM99ygviOQqCvLnSS2RBUt4IuDelToLeHhnQvaiurt90ZxL7CwO92v3htCgL+MaGGocdNkgB6TsuBoAtIoPetTxn0+uFr1wRbmtdC0BQm8GH/BTbPR/uZu8u1G6piQsdI2UzB6BQ12coSEbPSRLjNJbFtUdHBNm3N+0XlGxca0qkcWIbnzgDYr0wsu4UBUJ9S1Ep3B+rnMe6odsurvOehmY9vTDezZelPAqdga+onSg8gH9J1QFm4rNJVdP0eyIoRl2gkWlvv4su34twsW+zFtPAjeXh0DN1GRdeyF+3l52L3LAADh/7gc03jvdVngEzQhrkps2NMHGdb+zeSJwaoSpt92xH5GmFqtND5/UhBkYf1uxJZ4QbCcSidke0Y2SitYIrlUMucQ9Tm8s49Hk1T3Zm9q3kDjnVOpxF/6DJwdrrqXkPo3QTFON8ct/qn9NT4h2phSOMFRko3Zq7sYwBHcIPrAZCQQtKsT7E6iG8u0NwXQuGZ8Ggy/EH8soUPje1iCugt+ X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(376005)(1800799015)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2024 09:39:06.7752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a50f83d-17dd-403f-8704-08dc5ec239e7 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F9.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6578 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY 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, A few comments, mostly dependent on the previous patch's (06/08) behavior. On 4/16/24 15:07, Gustavo Romero wrote: > Add unittests for testing qIsAddressTagged packet request creation and > reply checks. > > Signed-off-by: Gustavo Romero > --- > gdb/remote.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/gdb/remote.c b/gdb/remote.c > index 63799ac5e3f..42f34a03c95 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -15658,6 +15658,8 @@ test_memory_tagging_functions () > scoped_restore restore_memtag_support_ > = make_scoped_restore (&config->support); > > + struct gdbarch *gdbarch = current_inferior ()->arch (); > + > /* Test memory tagging packet support. */ > config->support = PACKET_SUPPORT_UNKNOWN; > SELF_CHECK (remote.supports_memory_tagging () == false); > @@ -15724,6 +15726,46 @@ test_memory_tagging_functions () > create_store_memtags_request (packet, 0xdeadbeef, 255, 1, tags); > SELF_CHECK (memcmp (packet.data (), expected.c_str (), > expected.length ()) == 0); > + > + /* Test creating a qIsAddressTagged request. */ > + expected = "qIsAddressTagged:deadbeef"; > + create_is_address_tagged_request (gdbarch, packet, 0xdeadbeef); > + SELF_CHECK (strcmp (packet.data (), expected.c_str ()) == 0); > + > + /* Test empty reply on qIsAddressTagged request. */ > + reply = "E00"; The comment seems to be out of sync with what's being tested. Should we be testing an empty reply instead of E00? > + /* is_tagged must not changed, hence it's tested too. */ s/must not changed/must not change > + bool is_tagged = false; > + strcpy (packet.data (), reply.c_str ()); > + SELF_CHECK (check_is_address_tagged_reply (packet, &is_tagged) == false); > + SELF_CHECK (is_tagged == false); > + > + /* Test if only the first byte (01) is correctly extracted from a long > + numerical reply, with remaining garbage. */ > + reply = "0104A590001234006mC0fe"; > + /* Because the first byte is 01, is_tagged should be set to true. */ > + is_tagged = false; > + strcpy (packet.data (), reply.c_str ()); > + SELF_CHECK (check_is_address_tagged_reply (packet, &is_tagged) == true); I think this particular reply (malformed) should make the packet check fail, as we risk the remote returning garbage values and things working just because the first byte was the expected number. We should be more strict with the packet reply format and check its length. > + SELF_CHECK (is_tagged == true); > + > + /* Test if only the first byte (00) is correctly extracted from a long > + numerical reply, with remaining garbage. */ > + reply = "0004A590001234006mC0fe"; > + /* Because the first byte is 00, is_tagged should be set to false. */ > + is_tagged = true; > + strcpy (packet.data (), reply.c_str ()); > + SELF_CHECK (check_is_address_tagged_reply (packet, &is_tagged) == true); > + SELF_CHECK (is_tagged == false); Same case for the above test. > + > + /* Test if only the first byte, 04, is correctly extracted and recognized > + as invalid (only 00 and 01 are valid replies). */ > + reply = "0404A590001234006mC0fe"; > + /* Because the first byte is invalid is_tagged must not change. */ > + is_tagged = false; > + strcpy (packet.data (), reply.c_str ()); > + SELF_CHECK (check_is_address_tagged_reply (packet, &is_tagged) == false); > + SELF_CHECK (is_tagged == false); > } > > static void Also a similar situation. We should exercise the following: - Empty reply - Not tagged - "00" - Tagged - "01" - Error - "E??" - Malformed - packets of incorrect length and values.