From patchwork Wed Jun 6 00:46:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 925669 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="tGsltdAY"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 410qnk29phz9s02 for ; Wed, 6 Jun 2018 10:49:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ED9EFC22004; Wed, 6 Jun 2018 00:48:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 18024C21F9F; Wed, 6 Jun 2018 00:47:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C99C4C21FB3; Wed, 6 Jun 2018 00:47:22 +0000 (UTC) Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by lists.denx.de (Postfix) with ESMTPS id DD487C21F67 for ; Wed, 6 Jun 2018 00:47:16 +0000 (UTC) Received: by mail-it0-f66.google.com with SMTP id v83-v6so5838453itc.3 for ; Tue, 05 Jun 2018 17:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=YJzoB5tKWiSu4e/2bONHfbQelCMxFLKj6RgOQX6YYVQ=; b=tGsltdAYLJ2nVpr6O8fvkYeKPmPRJfS2oMyoP4LMpLlf+U9WnzN/SmN9rKcscQtSRJ kQfuaWW/onSPakQgDGHTwe7BbvVNQIDzinP3VxsxCRNG1w5i1ZZvc7fkM2pBymMG95Af iIs1UUhKfEn/xRvU3WDgvXIXCv/Oc/lUz/IK7cDD4JJZOl8sGLbRWtIpgvOFD5ZhaEj4 Izm2PDDemSeGsTuH9Z9XRmAvqnfrmmvHfNWg7YuNZmbRsMAGmY7Oog/mMoqupeckCj43 QRtDiHzPofjEw79eTuIurDQV7FepMkktr9sWO2IqJHJ85mtydFPiwCj9MdwzDWlubF7W Tq8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=YJzoB5tKWiSu4e/2bONHfbQelCMxFLKj6RgOQX6YYVQ=; b=E+va20ZthsXP5L/SaY3j4fr1cn1iEofRu7HuXurrhZ6kRW+qx7rxYG0DaOhtdglIPK /Gnay1ZaY68pwnbjru9v4CXqm3E/Ks4Boz+ybtLYvuLS40/2DcwQHSvI7ByOPkPmaO9j Gd1KPJ5uJ6WJguLzzR+d5ldnZ/lG8O2TrswuaS5gr8ZVtVN17zA5IyWNeFSNFGP5Vm34 63Al48op2NZArlUe6qrLUJwLC6FIJ7WSeDjUO0UL7gWDfhgu1St6upxwtIGKznkehgAa edtdUpL074/EJVt7cFC4padAbppJW1VKhQoz1YkiseGVovHuzu3PnfGMSdyIYLFUewo3 Sa8Q== X-Gm-Message-State: APt69E0jsdKAhG1sJ1P4FgD6/nV5j0gSSNb+7TPXeWEZYxVwL6DlCmxl DrZa2SHRp72KMkSeNV2LpnyDWw== X-Google-Smtp-Source: ADUXVKJ/IMMnap+02Au6o8qci88B737snkiUYJvm1h7s2LGPc5Nf/zE2J0PYIJbfWZ8d3e5UP/7IJA== X-Received: by 2002:a24:19ca:: with SMTP id b193-v6mr466614itb.135.1528246035140; Tue, 05 Jun 2018 17:47:15 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id p20-v6sm126697itf.4.2018.06.05.17.47.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 17:47:14 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id C4BDB140700; Tue, 5 Jun 2018 18:47:12 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 5 Jun 2018 18:46:38 -0600 Message-Id: <20180606004705.79641-3-sjg@chromium.org> X-Mailer: git-send-email 2.17.1.1185.g55be947832-goog In-Reply-To: <20180606004705.79641-1-sjg@chromium.org> References: <20180606004705.79641-1-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 02/29] binman: Make the operation of Entry__testing explicit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This fake entry is used for testing. At present it only has one behaviour which is to return an invalid set of entry positions, to cause an error. The fake entry will need to be used for other things too. Allow the test .dts file to specify the behaviour of the fake entry, so we can control its behaviour easily. While we are here, drop the ReadContents() method, since this only applies to subclasses of Entry_blob, which Entry__testing is not. Signed-off-by: Simon Glass --- tools/binman/etype/_testing.py | 14 ++++++++++---- tools/binman/test/41_unknown_pos_size.dts | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py index c376dd5c9ca..0b1eaefc3ce 100644 --- a/tools/binman/etype/_testing.py +++ b/tools/binman/etype/_testing.py @@ -10,16 +10,22 @@ import fdt_util import tools class Entry__testing(Entry): + """A fake entry used for testing + + Properties: + return_invalid_entry: Return an invalid entry from GetPositions() + """ def __init__(self, section, etype, node): Entry.__init__(self, section, etype, node) + self.return_invalid_entry = fdt_util.GetBool(self._node, + 'return-invalid-entry') def ObtainContents(self): self.data = 'a' self.contents_size = len(self.data) return True - def ReadContents(self): - return True - def GetPositions(self): - return {'invalid-entry': [1, 2]} + if self.return_invalid_entry : + return {'invalid-entry': [1, 2]} + return {} diff --git a/tools/binman/test/41_unknown_pos_size.dts b/tools/binman/test/41_unknown_pos_size.dts index a8e7d8aa227..94fe821c470 100644 --- a/tools/binman/test/41_unknown_pos_size.dts +++ b/tools/binman/test/41_unknown_pos_size.dts @@ -6,6 +6,7 @@ binman { _testing { + return-invalid-entry; }; }; };