From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QCNsEiEg6l/vSQAAWB0awg (envelope-from ) for ; Mon, 28 Dec 2020 13:12:49 -0500 Received: by simark.ca (Postfix, from userid 112) id 3DFFF1F0AA; Mon, 28 Dec 2020 13:12:49 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E04191E590 for ; Mon, 28 Dec 2020 13:12:48 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E828386103B; Mon, 28 Dec 2020 18:12:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E828386103B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609179168; bh=lb2to6ccfz/y59bUlEmu9JG+hFGAOGFlrt7XxNGvRdA=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sc47c8M2sYhB8Qd7Q8r93NJB8tOEv2xftZHoTYIVdmFdfT2qPI6lM+cwIHMnMiXPh it2n3xWHA2TP4Br94jFq/WR+zoIoXrSRLr6mZHZoaP0gU44pbejUk7iWnRTXRcgHu/ TgKqN1/DzKzsSSZVDiCFvX/tytzjpo6pyW+EhRr8= Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by sourceware.org (Postfix) with ESMTPS id 4296E385043A for ; Mon, 28 Dec 2020 18:12:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4296E385043A Received: by mail-qv1-xf2b.google.com with SMTP id h16so5297463qvu.8 for ; Mon, 28 Dec 2020 10:12:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lb2to6ccfz/y59bUlEmu9JG+hFGAOGFlrt7XxNGvRdA=; b=KrVy+7r6kMUJPPv8C1VrCqXea7Hvkb7q9ThDBKP/ZXrHbm7eZVxK1FXAvDxM05bcZ4 Ivs6c7kQc7vRhWbmmz5a6Mq63XOVZAyFhJNErvEh8xsU77WrJyaBvhlUhHyX2mD3cNSF gf85q415AUEE2YuYHzAUKk5nuawFDm4M33ktPNPR9BTwFUUGJe0RChFBr+dgISWRe+NU heVUJ/31e4LE9gvsz3etFz9jrooKn5IeYewLO+gXTXY/kNBe0YoGe/+IZpC9Oa++lXs9 IioTSCNjC0XQ+oUQ+lp2OnHGRKDUdTgWnVwBPsWVn+MnBcqwJKJ9QiwuZJJI86cBC351 M/BA== X-Gm-Message-State: AOAM532qehOKqI4G33pzsr3E/sRmNN4+JDz6H2HSuramHFu0RP1Nysu2 rmwzIaPbbzz8ymRBS1JpnELUNQ== X-Google-Smtp-Source: ABdhPJxJoFSkH1lapLIUkBNH0uw2lN9pfwTi8ECwxTC+608t2rIIfLMW57WBE9lOGULHm+hGKpNxmw== X-Received: by 2002:ad4:4108:: with SMTP id i8mr48083416qvp.49.1609179164267; Mon, 28 Dec 2020 10:12:44 -0800 (PST) Received: from ?IPv6:2804:7f0:8284:370e:19e7:527f:e109:2734? ([2804:7f0:8284:370e:19e7:527f:e109:2734]) by smtp.gmail.com with ESMTPSA id p13sm23640374qtp.66.2020.12.28.10.12.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Dec 2020 10:12:43 -0800 (PST) Subject: Re: [PATCH v3 06/24] Unit tests for gdbserver memory tagging remote packets To: Simon Marchi , gdb-patches@sourceware.org References: <20201109170435.15766-1-luis.machado@linaro.org> <20201109170435.15766-7-luis.machado@linaro.org> Message-ID: <9fc07856-534f-dc8e-790f-8e66247fbd92@linaro.org> Date: Mon, 28 Dec 2020 15:12:41 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Cc: david.spickett@linaro.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 12/25/20 5:13 PM, Simon Marchi wrote: > > > On 2020-11-09 12:04 p.m., Luis Machado via Gdb-patches wrote: >> Updates on v2: >> >> - Update unit tests to cope with additional tag type field in the remote >> packets. >> >> -- >> >> Add some unit testing to exercise the functions handling the qMemTags and >> QMemTags packets as well as feature support. >> >> gdbserver/ChangeLog: >> >> YYYY-MM-DD Luis Machado >> >> * server.cc (test_memory_tagging_functions): New function. >> (captured_main): Register test_memory_tagging_functions. >> --- >> gdbserver/server.cc | 100 ++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 100 insertions(+) >> >> diff --git a/gdbserver/server.cc b/gdbserver/server.cc >> index 7eddd0e01f..6812b624f8 100644 >> --- a/gdbserver/server.cc >> +++ b/gdbserver/server.cc >> @@ -3647,6 +3647,103 @@ detach_or_kill_for_exit_cleanup () >> } >> } >> >> +#if GDB_SELF_TEST >> + >> +namespace selftests { >> + >> +static void >> +test_memory_tagging_functions (void) >> +{ >> + /* Setup testing. */ >> + gdb::char_vector packet; >> + gdb::byte_vector tags, bv; >> + std::string expected; >> + packet.resize (32000); >> + CORE_ADDR addr; >> + size_t len; >> + int type; >> + >> + /* Test parsing a qMemTags request. */ >> + >> + /* Invalid request, addr len and type unchanged. */ >> + addr = 0xff; >> + len = 255; >> + type = 255; >> + strcpy (packet.data (), "qMemTags_wrong:0,0:0"); >> + SELF_CHECK (parse_fmemtags_request (packet.data (), &addr, &len, &type) != 0); >> + SELF_CHECK (addr == 0xff && len == 255 && type == 255); > > As I said earlier, I would have made parse_fmemtags_request assert that the > packet begins with "qMemTags:" (instead of returning an error value), but it's > really a nit and I can live with both. Fixed now and removed the tests that cause an assertion. > > Otherwise this patch LGTM. > > Simon >