From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id A1134384AB7E for ; Fri, 19 Apr 2024 14:00:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A1134384AB7E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A1134384AB7E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::536 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713535254; cv=none; b=ID5wolRDyEMY/p1dSUIfzBZIq0fLQxkPQBh/OH+Ors9xj+kGLQswUrCcDTQGQLaYK9bTZdCjznwEyCvuiydCXnUGn3frsRYETsj08kCd6H7Nk/GRA9m6MB1wDOJgZSZbyuVBLuaOY54EHGmITpeqEBKZ4pjgocNVLH3yGMIFtlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713535254; c=relaxed/simple; bh=RgPoFzNvPvBAdLi/OsNe6LUVYKp6u5szbH5Zu61Tcn0=; h=DKIM-Signature:Subject:To:From:Message-ID:Date:MIME-Version; b=f/5VWgfSVoZQCO2ud1HNU67WS1CVeNYGBLFkl5ESny1oR50CZu2OY/8/mU7Qc30B3scgHlYFUpGmU8P96WoAiFS2+YHZTFc5kIiut8jCPWar6V1eGF2LF7lWYia0YNAZCmL8IZBAFVEFGKRuLnfOH0iD0Z3G5pLWGMIybFL7c7w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5d4a1e66750so1399314a12.0 for ; Fri, 19 Apr 2024 07:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713535242; x=1714140042; darn=sourceware.org; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=q0KX92gFFZBh+XAEjy1XDSWhnuoBrTZuoGp7owlvN2w=; b=H1XHP7OhnxOjuymF/h6uhdnkupTobzGaLzhYttUnLTNrZtgAEZJw7xxrtuNnA8alqX GQpE5DV61dz1Pvn51m/Qgb/dveKaVeh1Nt1RclmD6mD5BQfVdfNjcrSyVdtHPGlQD9nq ox+l2rW59QQ5j5BxvBaL2Am5oc3s7xIpfy5W0JWJIxnMS7D1vgftqwaZgU/6THupMMl+ 6a13PLiGjPMfc9Y2Egn1rayc6jzYsgzrhpS7j/X2vpkYUZwkIGz5CTwE1DZ7nuMEj8yo m/sdAqmHJqAKHQKLkKvv5X4ct+DT7cZvFHBMPcVY5rueVDpBILGB3qew8XQc6xabK8aR +Skw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713535242; x=1714140042; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q0KX92gFFZBh+XAEjy1XDSWhnuoBrTZuoGp7owlvN2w=; b=rZxnoQ648Htuwy70x0LRUnHZ3l2yF33TE8lnFbx7ovzc3p8T8ReVoFaOvNJiCU9nNC viO24iuY2Gl6RrYwoGi+oionupfAeI4mDSdI51kYLZa338eyWVUgvhjwK+tUbI3fo2Lj ll2qhY1zhKPkDIz47mDy9+XOsHHdq+lpjYObeqplJmKwDU4HCBlJxp7ZC331hSaZj61j HSXArRfr4CzRtnzv+q3FHh6PDyTDqbFfi1hGoaUKmkNO916AAABT/TWjbAvRBabCOk9P vgBxYBbpmHE3uMDUu6AZT5Q3DPSSpRpLQ3da80h9mQ6Gb7NRStyRsVV8YJ6lMTdwgOJp Hp5Q== X-Forwarded-Encrypted: i=1; AJvYcCXevNq//dWdrEwH74DGy6o88mYk6lGSGWqYjoaWpYZm/T+JA4oqCJcMOlrKTaq48lIuZvMnBv6bbs/ANbURcsFqFjX1QHPAV3rGjQ== X-Gm-Message-State: AOJu0Ywp2LmZulfkz1brH0CUsp3vluDRd90LtQqWYh/0AZfdKFwhEdkq 8g0/fGtb04f91hj/woEdO8EDJIVqjkkMIyZ4e/JGGxtt/9/yxbBRdr5vXQzjwcM= X-Google-Smtp-Source: AGHT+IFF9ofmHp/ZeJmrW6m9oesby4t4v0LKiRpYQGdpcOHZihZggeqYjajCHh9jxHkzYQWDKcMAYQ== X-Received: by 2002:a17:90a:898b:b0:2a2:e0b8:2ceb with SMTP id v11-20020a17090a898b00b002a2e0b82cebmr2333274pjn.15.1713535242357; Fri, 19 Apr 2024 07:00:42 -0700 (PDT) Received: from [192.168.0.102] ([177.139.3.230]) by smtp.gmail.com with ESMTPSA id x5-20020a17090a388500b002a53b33afa3sm5356413pjb.8.2024.04.19.07.00.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 07:00:41 -0700 (PDT) Subject: Re: [PATCH v6 7/8] gdb/testsuite: Add unit tests for qIsAddressTagged packet To: Luis Machado , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com References: <20240418201039.236867-1-gustavo.romero@linaro.org> <20240418201039.236867-8-gustavo.romero@linaro.org> <787f69b7-9aa7-4287-8f8d-1ea571a403c2@arm.com> From: Gustavo Romero Message-ID: <4693ce98-b5d5-bf2c-fd09-1ff97fd07092@linaro.org> Date: Fri, 19 Apr 2024 11:00:37 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <787f69b7-9aa7-4287-8f8d-1ea571a403c2@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 Luis, Thiago, Eli, and Tom, On 4/19/24 4:53 AM, Luis Machado wrote: > On 4/18/24 21:10, Gustavo Romero wrote: >> Add unit tests for testing qIsAddressTagged packet request creation and >> reply checks. >> >> Signed-off-by: Gustavo Romero >> --- >> gdb/remote.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 67 insertions(+) >> >> diff --git a/gdb/remote.c b/gdb/remote.c >> index 3d034bb1ef8..cfb54de157d 100644 >> --- a/gdb/remote.c >> +++ b/gdb/remote.c >> @@ -15682,6 +15682,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); >> @@ -15748,6 +15750,71 @@ 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 error reply on qIsAddressTagged request. */ >> + reply = "E00"; >> + strcpy (packet.data (), reply.c_str ()); >> + /* is_tagged must not change, hence it's tested too. */ >> + bool is_tagged = false; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + false); >> + SELF_CHECK (is_tagged == false); >> + >> + /* Test 'tagged' as reply. */ >> + reply = "01"; >> + strcpy (packet.data (), reply.c_str ()); >> + /* Because the byte is 01, is_tagged should be set to true. */ >> + is_tagged = false; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + true); >> + SELF_CHECK (is_tagged == true); >> + >> + /* Test 'not tagged' as reply. */ >> + reply = "00"; >> + strcpy (packet.data (), reply.c_str ()); >> + /* Because the byte is 00, is_tagged should be set to false. */ >> + is_tagged = true; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + true); >> + SELF_CHECK (is_tagged == false); >> + >> + /* Test an invalid reply (neither 00 nor 01). */ >> + reply = "04"; >> + strcpy (packet.data (), reply.c_str ()); >> + /* Because the byte is invalid is_tagged must not change. */ >> + is_tagged = false; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + false); >> + SELF_CHECK (is_tagged == false); >> + >> + /* Test malformed reply of incorrect length. */ >> + reply = "0104A590001234006"; >> + strcpy (packet.data (), reply.c_str ()); >> + /* Because this is a malformed reply is_tagged must not change. */ >> + is_tagged = false; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + false); >> + SELF_CHECK (is_tagged == false); >> + >> + /* Test empty reply. */ >> + reply = ""; >> + strcpy (packet.data (), reply.c_str ()); >> + /* is_tagged must not change, hence it's tested too. */ >> + is_tagged = true; >> + /* On the previous tests, qIsAddressTagged packet was auto detected and set >> + as supported. But an empty reply means the packet is unsupported, so for >> + testing the empty reply the support is reset to unknown state, otherwise >> + packet_ok will complain. */ >> + remote.m_features.m_protocol_packets[PACKET_qIsAddressTagged].support = >> + PACKET_SUPPORT_UNKNOWN; >> + SELF_CHECK (check_is_address_tagged_reply (&remote, packet, is_tagged) == >> + false); >> + SELF_CHECK (is_tagged == true); >> } >> >> static void > > This is OK. Thanks for the series. > > Let us know if you need us to push it for you. > > Approved-By: Luis Machado > Tested-By: Luis Machado Thanks a lot for all the reviews! Yip, I need somebody to push the patchset. :-) Cheers, Gustavo