From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E351EC00140 for ; Sun, 31 Jul 2022 16:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbiGaQBH (ORCPT ); Sun, 31 Jul 2022 12:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbiGaQBG (ORCPT ); Sun, 31 Jul 2022 12:01:06 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5764CB7E7 for ; Sun, 31 Jul 2022 09:01:05 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EE4E415; Sun, 31 Jul 2022 18:01:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659283263; bh=953SnjDqVT+tS/Ne0YSsVWsyXpeHWOqXT3cNmQqfLOQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b8HQx+E7FUB5PradP805Mvz/tJ+Y86x7cMMVX+JwzUBLQczT/BWKgR4V5I/zJUelw h2Ip19sUQbCkAZTfwWmR26A3tYuU4xqEzU7xjtcve1aUm39g1SkQteWcUq679Nyq0t lMdkgfUnJX9sf/W67RLUzjMscjZ4DJCL7tsXfzIU= Date: Sun, 31 Jul 2022 19:00:59 +0300 From: Laurent Pinchart To: Takanari Hayama Cc: linux-renesas-soc@vger.kernel.org, kieran.bingham+renesas@ideasonboard.com Subject: Re: [PATCH 1/3] tests: Support enum property type Message-ID: References: <20220704025632.3911253-1-taki@igel.co.jp> <20220704025632.3911253-2-taki@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220704025632.3911253-2-taki@igel.co.jp> Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Hayama-san, Thank you for the patch. On Mon, Jul 04, 2022 at 11:56:30AM +0900, Takanari Hayama wrote: > Add a support for enum property type to AtomicRequest. > > Signed-off-by: Takanari Hayama > --- > tests/kmstest.py | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/tests/kmstest.py b/tests/kmstest.py > index 11cc328b5b32..224c160e32fa 100755 > --- a/tests/kmstest.py > +++ b/tests/kmstest.py > @@ -269,8 +269,18 @@ class AtomicRequest(pykms.AtomicReq): > > min, max = prop.values > v = min + int((max - min) * int(v[:-1]) / 100) > - else: > + elif v.isnumeric(): > v = int(v) > + else: > + prop = obj.get_prop(k) > + if prop.type != pykms.PropertyType.Enum: > + raise RuntimeError(f'Unsupported property type {prop.type} for value {v}') > + for value, mode in prop.enums.items(): I'd replace "mode" with "name" here. Apart from that, Reviewed-by: Laurent Pinchart I'll change this when applying the patch. > + if mode == v: > + v = value > + break > + else: > + raise RuntimeError(f'Enum value with name "{v}" not found in property {k}') > > if not isinstance(v, int): > raise RuntimeError(f'Unsupported value type {type(v)} for property {k}') -- Regards, Laurent Pinchart