From patchwork Sat May 18 04:00:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101342 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="htfmNOcR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WgM4dtxz9s4Y for ; Sat, 18 May 2019 14:01:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5A2FDC21D83; Sat, 18 May 2019 04:01:24 +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_MSPIKE_H2, 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 17990C21E02; Sat, 18 May 2019 04:01:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DC0B3C21E1A; Sat, 18 May 2019 04:01:19 +0000 (UTC) Received: from mail-it1-f194.google.com (mail-it1-f194.google.com [209.85.166.194]) by lists.denx.de (Postfix) with ESMTPS id 19946C21E39 for ; Sat, 18 May 2019 04:01:19 +0000 (UTC) Received: by mail-it1-f194.google.com with SMTP id m3so11296902itl.1 for ; Fri, 17 May 2019 21:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QI04DiKkQwet3xi4YXjqTHeUGcZlv+jKPoSccwvohFY=; b=htfmNOcR9CkSM6O3WE9t+STc7ZffqrTMmRqv5NYZPE7Asn0yBs1E0KYzuuN6Aniph7 JIk2mGXV4pQYkIwa8KP0Nmhg98Kznu7ylV/AQqWECnWbjrbRRYouldBq01IWOCEBrGuw 2f8XkVFyOgozz+6EA46kM8Uy+xuTYFDSat7dw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QI04DiKkQwet3xi4YXjqTHeUGcZlv+jKPoSccwvohFY=; b=Elr66GORMkbwe1Fr6JD8GAlygZgcPHS3RG0RlabUpOZnNIAbyUda5fq+kje1K1luPz gYzIKpVHEc1VLj8YazFihQQeoQFFMPWczu/wIon0x9vynSfMBdfagkLTLO/uCFOGav9s FWcjxKjZhjBDDPvoqq2sWh4uUUFWjL0hgwugwAiTAXPpuvH36ECIzMhxvPRz0qVh/X0L sKQJGIoGr6rIolbVKoJmjUYyrTpYsrd3IuWGRHohliigX9LarkAPPBtBzxtkfEWOlvh0 U5gwqdTsYH5iqifYhnwTR2iUEXKx3Y3y63GQQLIa6fsB0Ces5BkLzmXrxVeirK4N6nsC DYkQ== X-Gm-Message-State: APjAAAXwaoBKI1vvSSKGTAbJ+H/VY/2CwY244qgv9B9NxQohC99bTw+e KRe5GeWhkVoyzzHZBH6IBGDd2j2biMg= X-Google-Smtp-Source: APXvYqwT7IzKtyc2agr+XJ1Pt3MNeq6q1oP65uALfAfe/+gstFUAwoEggV0E7EuBND26V//Vv60aQQ== X-Received: by 2002:a05:6638:221:: with SMTP id f1mr37833509jaq.1.1558152077787; Fri, 17 May 2019 21:01:17 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:31 -0600 Message-Id: <20190518040054.230179-2-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 01/24] dtoc: Adjust code for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update a few things in this tool so that they support Python 3: - print statements - iteritems() - xrange() Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 4 ++-- tools/dtoc/dtoc.py | 8 +++++--- tools/dtoc/test_dtoc.py | 4 +++- tools/dtoc/test_fdt.py | 8 +++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 17a3dccb116..4aeeab6fba9 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -449,7 +449,7 @@ class DtbPlatdata(object): self.out(';\n') self.out('};\n') - for alias, struct_name in self._aliases.iteritems(): + for alias, struct_name in self._aliases.items(): if alias not in sorted(structs): self.out('#define %s%s %s%s\n'% (STRUCT_PREFIX, alias, STRUCT_PREFIX, struct_name)) @@ -498,7 +498,7 @@ class DtbPlatdata(object): vals.append(get_value(prop.type, val)) # Put 8 values per line to avoid very long lines. - for i in xrange(0, len(vals), 8): + for i in range(0, len(vals), 8): if i: self.buf(',\n\t\t') self.buf(', '.join(vals[i:i + 8])) diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py index 2277af9bf78..c1a1d3534d4 100755 --- a/tools/dtoc/dtoc.py +++ b/tools/dtoc/dtoc.py @@ -25,6 +25,8 @@ options. For more information about the use of this options and tool please see doc/driver-model/of-plat.txt """ +from __future__ import print_function + from optparse import OptionParser import os import sys @@ -64,11 +66,11 @@ def run_tests(args): suite = unittest.TestLoader().loadTestsFromTestCase(module) suite.run(result) - print result + print(result) for _, err in result.errors: - print err + print(err) for _, err in result.failures: - print err + print(err) def RunTestCoverage(): """Run the tests and check that we get 100% coverage""" diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index cb6d6e7baf9..ae59a0a52a1 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -8,6 +8,8 @@ This includes unit tests for some functions and functional tests for the dtoc tool. """ +from __future__ import print_function + import collections import os import struct @@ -97,7 +99,7 @@ class TestDtoc(unittest.TestCase): if expected != actual: self._WritePythonString('/tmp/binman.expected', expected) self._WritePythonString('/tmp/binman.actual', actual) - print 'Failures written to /tmp/binman.{expected,actual}' + print('Failures written to /tmp/binman.{expected,actual}') self.assertEquals(expected, actual) def test_name(self): diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 8d70dd2a294..2d1d7dc452c 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -4,6 +4,8 @@ # Written by Simon Glass # +from __future__ import print_function + from optparse import OptionParser import glob import os @@ -535,11 +537,11 @@ def RunTests(args): suite = unittest.TestLoader().loadTestsFromTestCase(module) suite.run(result) - print result + print(result) for _, err in result.errors: - print err + print(err) for _, err in result.failures: - print err + print(err) if __name__ != '__main__': sys.exit(1) From patchwork Sat May 18 04:00:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101343 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UEW/SxtN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wgk2Lyjz9s4Y for ; Sat, 18 May 2019 14:01:54 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E4931C21E15; Sat, 18 May 2019 04:01:39 +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_MSPIKE_H2, 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 88DA8C21DE8; Sat, 18 May 2019 04:01:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D9593C21DA1; Sat, 18 May 2019 04:01:20 +0000 (UTC) Received: from mail-it1-f194.google.com (mail-it1-f194.google.com [209.85.166.194]) by lists.denx.de (Postfix) with ESMTPS id 90EADC21E49 for ; Sat, 18 May 2019 04:01:19 +0000 (UTC) Received: by mail-it1-f194.google.com with SMTP id i63so15189976ita.3 for ; Fri, 17 May 2019 21:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zqVpI3tDlFHSIDIBJ7Q6K2rQh6ZwaVrg+/VpqyVhWm8=; b=UEW/SxtNrb14QAmD1zqfU6uzRZ5JCYwrefhuIkGGtdM74GMjDGaSCnGdmsn37eKHXm GumRKWma9J1O2y9k2fxAbOVCktcmzbfn81ZXG7eITGpHAMJy12HQsRF8AU8Fvam1wLi9 fAFWzhHgDafDQQxHH5SKfCmodUemWuPAZQuHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zqVpI3tDlFHSIDIBJ7Q6K2rQh6ZwaVrg+/VpqyVhWm8=; b=Q0nsBarkoMyPVhLNe/obWHwZps/aomfFktxzpgX3nQA5FFFaqa2e328dp6iawoidFi WcHBlddzN0hPetLeg4e3WRB6mrpgJP6SgoMTD1wNQr2jSIUxZiUc+WVW+J0nvVfTY6Y1 oC4QyCbEMBvfFjfrjXxbN0hIJz08RWrvddGGLAjyZ0+C0Wo2MmitYshEMHwGZxCRV63D cTt4OJA+NRET+Zrfnq1lO46crq8Qg4weMPjFV1LPhrOKm61enkOiXhNXVLUjQkBiXE4l GytKeq90efuKoZGHYzdQDH/24G76T2fnS8Gu9sz09Hx3fWVoLJUy/WU5qylfV+mA0a9d K+bg== X-Gm-Message-State: APjAAAWzYA4EnZV7icyvy1Ch6SJQzDWqM+OkXEU+2fCHvmtmhWKEdcNx fMyAOTGQLo/MpEfJcguYI4hEogxfNes= X-Google-Smtp-Source: APXvYqzVo1AWUw/The8Zv8cmv5uaNKIBng6cTvXcVe/W2574Tvek33lVS2Iojr/j8WQd1arZWSCGMg== X-Received: by 2002:a05:6638:2a4:: with SMTP id d4mr4884369jaq.118.1558152078474; Fri, 17 May 2019 21:01:18 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:32 -0600 Message-Id: <20190518040054.230179-3-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 02/24] dtoc: Sort platdata output from dtoc 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present the order of struct field emitted by this tool depends on the internal workings of a Python dictionary. Sort the fields to remove this uncertainty, so that tests are deterministic. Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 3 ++- tools/dtoc/test_dtoc.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 4aeeab6fba9..3b66af8df78 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -464,7 +464,8 @@ class DtbPlatdata(object): var_name = conv_name_to_c(node.name) self.buf('static const struct %s%s %s%s = {\n' % (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) - for pname, prop in node.props.items(): + for pname in sorted(node.props): + prop = node.props[pname] if pname in PROP_IGNORE_LIST or pname[0] == '#': continue member_name = conv_name_to_c(prop.name) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index ae59a0a52a1..b915b278560 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -199,16 +199,16 @@ struct dtd_sandbox_spl_test_2 { data = infile.read() self._CheckStrings(C_HEADER + ''' static const struct dtd_sandbox_spl_test dtv_spl_test = { +\t.boolval\t\t= true, \t.bytearray\t\t= {0x6, 0x0, 0x0}, \t.byteval\t\t= 0x5, +\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0}, \t.intval\t\t\t= 0x1, -\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0}, \t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, \t\t0x11}, -\t.stringval\t\t= "message", -\t.boolval\t\t= true, -\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0}, +\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0}, \t.stringarray\t\t= {"multi-word", "message", ""}, +\t.stringval\t\t= "message", }; U_BOOT_DEVICE(spl_test) = { \t.name\t\t= "sandbox_spl_test", @@ -219,12 +219,12 @@ U_BOOT_DEVICE(spl_test) = { static const struct dtd_sandbox_spl_test dtv_spl_test2 = { \t.bytearray\t\t= {0x1, 0x23, 0x34}, \t.byteval\t\t= 0x8, +\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0}, \t.intval\t\t\t= 0x3, \t.longbytearray\t\t= {0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \t\t0x0}, -\t.stringval\t\t= "message2", -\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0}, \t.stringarray\t\t= {"another", "multi-word", "message"}, +\t.stringval\t\t= "message2", }; U_BOOT_DEVICE(spl_test2) = { \t.name\t\t= "sandbox_spl_test", From patchwork Sat May 18 04:00:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101345 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AJyTTYWb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wjm2pbhz9s4Y for ; Sat, 18 May 2019 14:03:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 078F7C21E45; Sat, 18 May 2019 04:02:30 +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=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 C4142C21E0D; Sat, 18 May 2019 04:01:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C110EC21DF8; Sat, 18 May 2019 04:01:20 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id 6F886C21E2B for ; Sat, 18 May 2019 04:01:20 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id m7so7060343ioa.6 for ; Fri, 17 May 2019 21:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W1jIJpLqKFV0fvlSo5FX0PTP5BJ0lz5Zv8HD8nFdFUc=; b=AJyTTYWbCUeqLPn1vV0qpmNQdcMpxfVBQbTvahlrtmDFuV4QJDRaYMcB7Lr/pKTVoR JUjffXcpNe54ftUvMxWvoZoT0UZyMT/yrkV+ebGMx9dVf0gmx/OLjMJmCKwCKf8KxjKS 89fXJmS4+09n1NtaJXe3nDUGjNGCK92C2SMsg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W1jIJpLqKFV0fvlSo5FX0PTP5BJ0lz5Zv8HD8nFdFUc=; b=X8VRYXqGUlHZYO+0xP5xLFHPuay5VoL22WGkm1PeND/b+D4Pxiz8oCp81UPlEG1H7+ UVWqkGfah+ODuFOaWpIMyPleZ8vJnpo7aB0bRzhOJvj/o69dFyESlICAMB4k/sOTOmyd 3TF2zT1WK/hGMM65zEW/ykDbXoet1WU1BExS5HpFlQXR5o7Qz7n7RgnjCM3/5/jQ19SQ vTlfn8mYwAKGWTURnuzo8v/PqV/7TfvB9VzV90nWgoW9A+vKcS3/vAfywStUnsOT1V5n AskUG1Mc7O3dNeKlcvguj9MtuLwfvRuArvq4nrUfO9qvH8yVIwIQWZg6cDl98y+F0xHc 2LKQ== X-Gm-Message-State: APjAAAX9r0wK+E8Xf1/+OYUsLi9TGOQ3gjuNl6ivrAMEOBF9r02rmPxb 7fXXyKxbG3bodANfkKD/YzLuPzWAV8g= X-Google-Smtp-Source: APXvYqxeidyhXtUgQyH3m3P611M7XeLiA8KpF2uYwRsXjqvb2LvqBWufG8piI02FawA6se/b/tE5hQ== X-Received: by 2002:a5e:9901:: with SMTP id t1mr470262ioj.150.1558152079086; Fri, 17 May 2019 21:01:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:33 -0600 Message-Id: <20190518040054.230179-4-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 03/24] dtoc: Use GetBytes() to obtain repeating bytes 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use this helper function which works on both Python 2 and Python 3. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 6 ++++-- tools/dtoc/test_fdt.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 031b3a00843..9518a287a26 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -11,6 +11,7 @@ import sys import fdt_util import libfdt from libfdt import QUIET_NOTFOUND +import tools # This deals with a device tree, presenting it as an assortment of Node and # Prop objects, representing nodes and properties, respectively. This file @@ -334,7 +335,8 @@ class Node: Args: prop_name: Name of property """ - self.props[prop_name] = Prop(self, None, prop_name, '\0' * 4) + self.props[prop_name] = Prop(self, None, prop_name, + tools.GetBytes(0, 4)) def AddEmptyProp(self, prop_name, len): """Add a property with a fixed data size, for filling in later @@ -346,7 +348,7 @@ class Node: prop_name: Name of property len: Length of data in property """ - value = chr(0) * len + value = tools.GetBytes(0, len) self.props[prop_name] = Prop(self, None, prop_name, value) def SetInt(self, prop_name, val): diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 2d1d7dc452c..79f97d8013c 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -279,7 +279,7 @@ class TestProp(unittest.TestCase): """Tests the GetEmpty() function for the various supported types""" self.assertEqual(True, fdt.Prop.GetEmpty(fdt.TYPE_BOOL)) self.assertEqual(chr(0), fdt.Prop.GetEmpty(fdt.TYPE_BYTE)) - self.assertEqual(chr(0) * 4, fdt.Prop.GetEmpty(fdt.TYPE_INT)) + self.assertEqual(tools.GetBytes(0, 4), fdt.Prop.GetEmpty(fdt.TYPE_INT)) self.assertEqual('', fdt.Prop.GetEmpty(fdt.TYPE_STRING)) def testGetOffset(self): From patchwork Sat May 18 04:00:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101346 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nfS/01NF"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wjy1SHJz9s4Y for ; Sat, 18 May 2019 14:03:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B3CE7C21DED; Sat, 18 May 2019 04:02:59 +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=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 7DB84C21DC1; Sat, 18 May 2019 04:01:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11C57C21E1E; Sat, 18 May 2019 04:01:21 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id D3AB4C21E0B for ; Sat, 18 May 2019 04:01:20 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id s20so7060001ioj.7 for ; Fri, 17 May 2019 21:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YcnwHyrl4LTwGdr23N7vApz1TdCUUz1xHQurogxSnNo=; b=nfS/01NFwMwvnkvshO2nrXpRBcGOTA0T7TKKEetlu9OE/SQEC6yEuXKR4sCgzBr0qB q/6lAv1327JHp37mC8Ck8WBssSuRGxq1DyNuKqrz/0Tx22kleGzcEFah04xTzCi6Z7mM JscSdTka1+Vx3O/+qrWC6nU1s4IXQEmjFEvKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YcnwHyrl4LTwGdr23N7vApz1TdCUUz1xHQurogxSnNo=; b=MXesre1xShnZismPpiM6Y4akUI/0uLVhTndY/yquQ1JZuSUfchcYZBucKVUDBbcTf1 iEulrBMv/UuXS0ehlpGBt/z4lE5ts1BRqXByTLeoL28qmqimghcLCoJBxPHnot12duOD AcUb5U0IwmSpmKmwMhxa90QMEKUn5BYJ9xU+dFqEfZvFVr7FdWHX0fC4IS5VqoHT6v3g yWhmvpieEoK043M1qsuJQ5UmaZuqunzG3gNXp2kSarxhoU+dSiB+9BGFSzDOLPfh7LO+ uDTcdb1YJtkQUBkg2y8ft+fhh8E5t3rOrblwd3mkw4tp2rWJYzN21tJKDr4yJlOYK302 hpiw== X-Gm-Message-State: APjAAAX3+06Poa9tu6zQJ3ulnulnP4ZciQ52GJw9FU7SRux3e8CPMoQl OnPbtpUx6lPPt8VvzMvGTEzYrZnno0g= X-Google-Smtp-Source: APXvYqwf0ndWZS+uGDIsEDI8S3x6gTFL3yUn3L9bI+t7tQfLObb2+wCtgINoYg0XWNvrc17dS2CmFw== X-Received: by 2002:a6b:b343:: with SMTP id c64mr17539990iof.258.1558152079629; Fri, 17 May 2019 21:01:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:34 -0600 Message-Id: <20190518040054.230179-5-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 04/24] dtoc: Move BytesToValue() out of the Prop class 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This method does not actually use any members of the Prop class. Move it out of the class so that it is easier to add unit tests. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 104 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 9518a287a26..35453fbed9a 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -29,6 +29,57 @@ def CheckErr(errnum, msg): raise ValueError('Error %d: %s: %s' % (errnum, libfdt.fdt_strerror(errnum), msg)) + +def BytesToValue(bytes): + """Converts a string of bytes into a type and value + + Args: + A string containing bytes + + Return: + A tuple: + Type of data + Data, either a single element or a list of elements. Each element + is one of: + TYPE_STRING: string value from the property + TYPE_INT: a byte-swapped integer stored as a 4-byte string + TYPE_BYTE: a byte stored as a single-byte string + """ + bytes = str(bytes) + size = len(bytes) + strings = bytes.split('\0') + is_string = True + count = len(strings) - 1 + if count > 0 and not strings[-1]: + for string in strings[:-1]: + if not string: + is_string = False + break + for ch in string: + if ch < ' ' or ch > '~': + is_string = False + break + else: + is_string = False + if is_string: + if count == 1: + return TYPE_STRING, strings[0] + else: + return TYPE_STRING, strings[:-1] + if size % 4: + if size == 1: + return TYPE_BYTE, bytes[0] + else: + return TYPE_BYTE, list(bytes) + val = [] + for i in range(0, size, 4): + val.append(bytes[i:i + 4]) + if size == 4: + return TYPE_INT, val[0] + else: + return TYPE_INT, val + + class Prop: """A device tree property @@ -49,7 +100,7 @@ class Prop: self.type = TYPE_BOOL self.value = True return - self.type, self.value = self.BytesToValue(bytes) + self.type, self.value = BytesToValue(bytes) def RefreshOffset(self, poffset): self._offset = poffset @@ -88,55 +139,6 @@ class Prop: while len(self.value) < len(newprop.value): self.value.append(val) - def BytesToValue(self, bytes): - """Converts a string of bytes into a type and value - - Args: - A string containing bytes - - Return: - A tuple: - Type of data - Data, either a single element or a list of elements. Each element - is one of: - TYPE_STRING: string value from the property - TYPE_INT: a byte-swapped integer stored as a 4-byte string - TYPE_BYTE: a byte stored as a single-byte string - """ - bytes = str(bytes) - size = len(bytes) - strings = bytes.split('\0') - is_string = True - count = len(strings) - 1 - if count > 0 and not strings[-1]: - for string in strings[:-1]: - if not string: - is_string = False - break - for ch in string: - if ch < ' ' or ch > '~': - is_string = False - break - else: - is_string = False - if is_string: - if count == 1: - return TYPE_STRING, strings[0] - else: - return TYPE_STRING, strings[:-1] - if size % 4: - if size == 1: - return TYPE_BYTE, bytes[0] - else: - return TYPE_BYTE, list(bytes) - val = [] - for i in range(0, size, 4): - val.append(bytes[i:i + 4]) - if size == 4: - return TYPE_INT, val[0] - else: - return TYPE_INT, val - @classmethod def GetEmpty(self, type): """Get an empty / zero value of the given type @@ -183,7 +185,7 @@ class Prop: bytes: New property value to set """ self.bytes = str(bytes) - self.type, self.value = self.BytesToValue(bytes) + self.type, self.value = BytesToValue(bytes) self.dirty = True def Sync(self, auto_resize=False): From patchwork Sat May 18 04:00:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101349 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DOv0I/Ij"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wnj6v93z9s4Y for ; Sat, 18 May 2019 14:07:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 89AAAC21E07; Sat, 18 May 2019 04:06:42 +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=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 77A4DC21E47; Sat, 18 May 2019 04:01:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EED51C21E3E; Sat, 18 May 2019 04:01:21 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id 6B51DC21E0B for ; Sat, 18 May 2019 04:01:21 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id m7so7060356ioa.6 for ; Fri, 17 May 2019 21:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q0T8116dBQkKRaknihlmUKZYJ6Su2IQSnVrdvYpqTt4=; b=DOv0I/IjMZLiLxMe/B1I0JA5CvYux7AjoEFyV2e36gUBeYehnEcY7v4KHsJnF4GMCH l6kTAchD90mj1KiEbiGjrqQlmBnsJAy8YD3tiXY5R6l8nuWSxfiH2CXIN/IJqH+vv9up WlPusMoSWpKdvY2DOiySeaylb8D0juPQ8jvfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q0T8116dBQkKRaknihlmUKZYJ6Su2IQSnVrdvYpqTt4=; b=iEAik2Azk+R7+ulkwcgYQ7WNpDFgGnP1ulNnUKJXDstJWN8ldU+HhYKgdnxe0m4Qzy exPvWi/aTWAQvDjz3RqVJ8Gz1d2rO+TEz5kZFdiaMl5AiCW6T8YZp2ywXCi2rcI5Uvts tiP0CmukNENKJWKGsYPG5Ng2TghSp1RV62+2FziT2fnd5kx/Oqu+2SJJCCOnwriqs/SW Vejq5YXBZx1wNraWy0Gyj+gsYF6C3ufaNXoauX3/wNP639XHg1u4RTAA3bIVEgSutXU6 b3pPfHzyer9AvHAK+5OqF3tSuPjP1Nm6XXH3ntwuROGdk9ohNFt7H3YvbCYsd6wsbgwt RNsw== X-Gm-Message-State: APjAAAUrp9av0zXcfyvwpgLlUtINy/T+wABqKxXcXaCDGqbwJbiQi5pD GTvzvOaz9tEAkGbYDo6wBPs80GlXerE= X-Google-Smtp-Source: APXvYqw4tlPHKIfaUqJ8erOx9GpgyeNT8TX0wwY8Kgsw3na6Fpqbd5GHu6AeyjXY7SEJiuHxgRfLeg== X-Received: by 2002:a5d:8b46:: with SMTP id c6mr618491iot.204.1558152080273; Fri, 17 May 2019 21:01:20 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:35 -0600 Message-Id: <20190518040054.230179-6-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 05/24] dtoc: Updates BytesToValue() for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The difference between the bytes and str types in Python 3 requires a number of minor changes to this function. Update it to handle the input data using the 'bytes' type. Create two useful helper functions which can be used by other modules too. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 39 ++++++++++++++++++++++++--------------- tools/patman/tools.py | 27 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 35453fbed9a..d539248430a 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -30,50 +30,59 @@ def CheckErr(errnum, msg): (errnum, libfdt.fdt_strerror(errnum), msg)) -def BytesToValue(bytes): +def BytesToValue(data): """Converts a string of bytes into a type and value Args: - A string containing bytes + A bytes value (which on Python 2 is an alias for str) Return: A tuple: Type of data Data, either a single element or a list of elements. Each element is one of: - TYPE_STRING: string value from the property - TYPE_INT: a byte-swapped integer stored as a 4-byte string - TYPE_BYTE: a byte stored as a single-byte string + TYPE_STRING: str/bytes value from the property + TYPE_INT: a byte-swapped integer stored as a 4-byte str/bytes + TYPE_BYTE: a byte stored as a single-byte str/bytes """ - bytes = str(bytes) - size = len(bytes) - strings = bytes.split('\0') + data = bytes(data) + size = len(data) + strings = data.split(b'\0') is_string = True count = len(strings) - 1 - if count > 0 and not strings[-1]: + if count > 0 and not len(strings[-1]): for string in strings[:-1]: if not string: is_string = False break for ch in string: - if ch < ' ' or ch > '~': + # Handle Python 2 treating bytes as str + if type(ch) == str: + ch = ord(ch) + if ch < 32 or ch > 127: is_string = False break else: is_string = False if is_string: if count == 1: - return TYPE_STRING, strings[0] + if sys.version_info[0] >= 3: + return TYPE_STRING, strings[0].decode() + else: + return TYPE_STRING, strings[0] else: - return TYPE_STRING, strings[:-1] + if sys.version_info[0] >= 3: + return TYPE_STRING, [s.decode() for s in strings[:-1]] + else: + return TYPE_STRING, strings[:-1] if size % 4: if size == 1: - return TYPE_BYTE, bytes[0] + return TYPE_BYTE, tools.ToChar(data[0]) else: - return TYPE_BYTE, list(bytes) + return TYPE_BYTE, [tools.ToChar(ch) for ch in list(data)] val = [] for i in range(0, size, 4): - val.append(bytes[i:i + 4]) + val.append(data[i:i + 4]) if size == 4: return TYPE_INT, val[0] else: diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 7e6a45a3b07..976670ef006 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -290,3 +290,30 @@ def FromUnicode(val): if sys.version_info[0] >= 3: return val return val if isinstance(val, str) else val.encode('utf-8') + +def ToByte(ch): + """Convert a character to an ASCII value + + This is useful because in Python 2 bytes is an alias for str, but in + Python 3 they are separate types. This function converts the argument to + an ASCII value in either case. + + Args: + ch: A string (Python 2) or byte (Python 3) value + + Returns: + integer ASCII value for ch + """ + return ord(ch) if type(ch) == str else ch + +def ToChar(byte): + """Convert a byte to a character + + This is useful because in Python 2 bytes is an alias for str, but in + Python 3 they are separate types. This function converts an ASCII value to + a value with the appropriate type in either case. + + Args: + byte: A byte or str value + """ + return chr(byte) if type(byte) != str else byte From patchwork Sat May 18 04:00:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101347 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YE7Ytw+5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wkq6CBJz9s4Y for ; Sat, 18 May 2019 14:04:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5A451C21DB5; Sat, 18 May 2019 04:03:14 +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=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 3455FC21DD7; Sat, 18 May 2019 04:01:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 566C6C21DFB; Sat, 18 May 2019 04:01:25 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id 154FEC21D9A for ; Sat, 18 May 2019 04:01:22 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id f22so7026695iol.11 for ; Fri, 17 May 2019 21:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RyItpSMTcTs4UnLNC59V5d5SEny0UhY1tveJn7kIZfw=; b=YE7Ytw+5xiMDeg1Ha4fhjxzCs464YrLBG1pT4ZfN1P9isLgseXY/55G20p39g0QIXO K5SqtGmDVKlyruWnSkOBCY185NnGYTwS0lxEg4klA/2o2R6YPwPWKWSPsVR1U6qMST6x bXSTanyaN0FKtj3J2amcNLQzn5MftTIWkJ2TY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RyItpSMTcTs4UnLNC59V5d5SEny0UhY1tveJn7kIZfw=; b=fh8fFOuxKt2ocCHitweuqrsj5mutXTNN283l0ko5pUFqLcZCe8TRnnxyIfkZ66E+dC e7ahZx6AJvctXlzNvrpCoAmSzvF7XM5LJtBAO8bxbnKHQRvc9VUOaTmwC2q7OFTrG1k7 1ChxK93ws1dx02kzZQ5scP+x4UWTuap+TQ8h2O5FDTxqAPgBjtgeEyHfVZ01u213ypwx efZ6ryB5sFr3jKM42ITvt19cniRRd4tgnSnRloT938m/OW+z1FxaBLO+K9KsVuy/W57u kB4IsXLo4siiYbW4cFHgZFjK2rnKIdF88q2VKrhr79b2mlqvMt89amcpy4foesBI5hbb V4TA== X-Gm-Message-State: APjAAAWVGXV3+HtlVREJJFEWuRWO9GE0af7frN0EmmSLIwz6B+/7VRej qpSBTZZRw4Ja9XtRabuWQ3NP0XdPRJE= X-Google-Smtp-Source: APXvYqyd2XdaWd70dZSQYOLSssy4nplwf4v2o04geKFC9YF+iQY4Kuz2WF3FMB8rKkyaYKS08ZnwqA== X-Received: by 2002:a5d:9616:: with SMTP id w22mr7594331iol.40.1558152080919; Fri, 17 May 2019 21:01:20 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:36 -0600 Message-Id: <20190518040054.230179-7-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 06/24] dtoc: Use byte type instead of str in fdt 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In Python 3 bytes and str are separate types. Use bytes to ensure that the code functions correctly with Python 3. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 14 +++++++++----- tools/dtoc/test_fdt.py | 18 +++++++++--------- tools/patman/tools.py | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index d539248430a..cbd9cbabe31 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -193,7 +193,7 @@ class Prop: Args: bytes: New property value to set """ - self.bytes = str(bytes) + self.bytes = bytes self.type, self.value = BytesToValue(bytes) self.dirty = True @@ -398,7 +398,9 @@ class Node: prop_name: Name of property to set val: String value to set (will be \0-terminated in DT) """ - self.props[prop_name].SetData(val + chr(0)) + if sys.version_info[0] >= 3: + val = bytes(val, 'utf-8') + self.props[prop_name].SetData(val + b'\0') def AddString(self, prop_name, val): """Add a new string property to a node @@ -410,7 +412,9 @@ class Node: prop_name: Name of property to add val: String value of property """ - self.props[prop_name] = Prop(self, None, prop_name, val + chr(0)) + if sys.version_info[0] >= 3: + val = bytes(val, 'utf-8') + self.props[prop_name] = Prop(self, None, prop_name, val + b'\0') def AddSubnode(self, name): """Add a new subnode to the node @@ -496,7 +500,7 @@ class Fdt: Fdt object containing the data """ fdt = Fdt(None) - fdt._fdt_obj = libfdt.Fdt(bytearray(data)) + fdt._fdt_obj = libfdt.Fdt(bytes(data)) return fdt def LookupPhandle(self, phandle): @@ -586,7 +590,7 @@ class Fdt: Returns: The FDT contents as a string of bytes """ - return self._fdt_obj.as_bytearray() + return bytes(self._fdt_obj.as_bytearray()) def GetFdtObj(self): """Get the contents of the FDT diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 79f97d8013c..3cd34b745ed 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -47,7 +47,7 @@ def _GetPropertyValue(dtb, node, prop_name): # Add 12, which is sizeof(struct fdt_property), to get to start of data offset = prop.GetOffset() + 12 data = dtb.GetContents()[offset:offset + len(prop.value)] - return prop, [chr(x) for x in data] + return prop, [tools.ToChar(x) for x in data] class TestFdt(unittest.TestCase): @@ -383,7 +383,7 @@ class TestProp(unittest.TestCase): self.node.AddString('string', val) self.dtb.Sync(auto_resize=True) data = self.fdt.getprop(self.node.Offset(), 'string') - self.assertEqual(val + '\0', data) + self.assertEqual(tools.ToBytes(val) + b'\0', data) self.fdt.pack() self.node.SetString('string', val + 'x') @@ -393,21 +393,21 @@ class TestProp(unittest.TestCase): self.node.SetString('string', val[:-1]) prop = self.node.props['string'] - prop.SetData(val) + prop.SetData(tools.ToBytes(val)) self.dtb.Sync(auto_resize=False) data = self.fdt.getprop(self.node.Offset(), 'string') - self.assertEqual(val, data) + self.assertEqual(tools.ToBytes(val), data) self.node.AddEmptyProp('empty', 5) self.dtb.Sync(auto_resize=True) prop = self.node.props['empty'] - prop.SetData(val) + prop.SetData(tools.ToBytes(val)) self.dtb.Sync(auto_resize=False) data = self.fdt.getprop(self.node.Offset(), 'empty') - self.assertEqual(val, data) + self.assertEqual(tools.ToBytes(val), data) - self.node.SetData('empty', '123') - self.assertEqual('123', prop.bytes) + self.node.SetData('empty', b'123') + self.assertEqual(b'123', prop.bytes) def testFromData(self): dtb2 = fdt.Fdt.FromData(self.dtb.GetContents()) @@ -508,7 +508,7 @@ class TestFdtUtil(unittest.TestCase): self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb)) def testGetPlainBytes(self): - self.assertEqual('fred', fdt_util.get_plain_bytes('fred')) + self.assertEqual(b'fred', fdt_util.get_plain_bytes('fred')) def RunTestCoverage(): diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 976670ef006..bdc1953936c 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -317,3 +317,28 @@ def ToChar(byte): byte: A byte or str value """ return chr(byte) if type(byte) != str else byte + +def ToChars(byte_list): + """Convert a list of bytes to a str/bytes type + + Args: + byte_list: List of ASCII values representing the string + + Returns: + string made by concatenating all the ASCII values + """ + return ''.join([chr(byte) for byte in byte_list]) + +def ToBytes(string): + """Convert a str type into a bytes type + + Args: + string: string to convert value + + Returns: + Python 3: A bytes type + Python 2: A string type + """ + if sys.version_info[0] >= 3: + return string.encode('utf-8') + return string From patchwork Sat May 18 04:00:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101348 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="h6KlIyNl"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wmv5XVhz9s4Y for ; Sat, 18 May 2019 14:06:23 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 56878C21DA1; Sat, 18 May 2019 04:06:16 +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=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 299AEC21E29; Sat, 18 May 2019 04:01:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A72E9C21E0B; Sat, 18 May 2019 04:01:26 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id 9FBFDC21E0B for ; Sat, 18 May 2019 04:01:22 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id e19so7086366iob.3 for ; Fri, 17 May 2019 21:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mByJALSfY3Bbl/+dkKLzHkk8jFdwEphWuUfgyiHs1mQ=; b=h6KlIyNl0LOXzXASf+1lGzFt6cMZUjyGXeZwW7tmrfJX+tV6H2zI9aS8pCud4qAkuh gf5K/2sUOPYUvxjml2+39V/mtJBwMeqn8zswFj4TCN9nTGO3x+810Iq9BmeLmm49ejGi C8uuEtA2+JMkw5GhMwSptkW19Ow8YYxFOPlmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mByJALSfY3Bbl/+dkKLzHkk8jFdwEphWuUfgyiHs1mQ=; b=rlxOJF85nyAdNF3TConZrOKH+d1QlWot4jTE6s2TQKGCpfYBWBXPfcyoARAQyn2mwp 237Ng/ldX2Ghm/RiETq0T0rsrFMN56T6Rlfa5PLcHdvhh4zT3OkAGn54q0D5YtpttATW 7WohpYVwNGzSInwInn8WZpwCVF46Pl1RarH4S3Vq341eYJlI8tsxk9HC+EO5QIdNkIGB t9mjbaUJh+vs+SgXBATiQ5FhqGL0ym0NvHZUxRp4ldY0ekdZ3K8IwyaQi7bKAHTFSUTu caBgwjrPhOL6vc9a4dDxODY6w5pb/uHrVSbjSfowYe5N++ysPujyBoZv0dT/SwRnWEuP mHIg== X-Gm-Message-State: APjAAAVAo/fsVdZHOcYgVRXzI4hImkLIHZK40FZiQOWmPxlw39ZaOy8G bOcSmvoRbYWbAzHzdTO25Ywwut/Cp1w= X-Google-Smtp-Source: APXvYqyLA1NfqhP2PL8SODaqOU4HaOLgmWPgZmdnyA8B4IFhjam6+xnfgrsDrsj7wi42Ec+TG/hO4Q== X-Received: by 2002:a6b:b503:: with SMTP id e3mr2313675iof.216.1558152081516; Fri, 17 May 2019 21:01:21 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:37 -0600 Message-Id: <20190518040054.230179-8-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 07/24] dtoc: Convert the Fdt.Prop class to Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update this class to work correctly on Python 3 and to pass its unit tests. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index cbd9cbabe31..f051ce67632 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -98,18 +98,18 @@ class Prop: bytes type: Value type """ - def __init__(self, node, offset, name, bytes): + def __init__(self, node, offset, name, data): self._node = node self._offset = offset self.name = name self.value = None - self.bytes = str(bytes) + self.bytes = bytes(data) self.dirty = False - if not bytes: + if not data: self.type = TYPE_BOOL self.value = True return - self.type, self.value = BytesToValue(bytes) + self.type, self.value = BytesToValue(bytes(data)) def RefreshOffset(self, poffset): self._offset = poffset From patchwork Sat May 18 04:00:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101344 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="RlGtiZvT"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Whs3lR5z9s4Y for ; Sat, 18 May 2019 14:02:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3146BC21E0D; Sat, 18 May 2019 04:02:14 +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=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 37AA9C21DED; Sat, 18 May 2019 04:01:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 77EC4C21E52; Sat, 18 May 2019 04:01:27 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id 3D3D9C21E13 for ; Sat, 18 May 2019 04:01:23 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id m7so7060393ioa.6 for ; Fri, 17 May 2019 21:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cP4814Hu323m0gQmHo7XxxFF+oZUrDCZb2gJbzFaXas=; b=RlGtiZvT3ygyIVzk6Gs2vPI6NRqCRggp50HOfLOSdrNbBqao+5UBcaVg0vLABAFHt7 BzUx998WvZWDHlztwQRAbwkrsj55C8lFwnjO7M7zmD3XFbTGzQbl1EII5e14LgrBJCzL iG4ehgjXBfchJ7DQBkMz0cB1FnIdht3PH4Dfs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cP4814Hu323m0gQmHo7XxxFF+oZUrDCZb2gJbzFaXas=; b=mHqu8kc4tdJ17GuUlkxV7maEEdFUz8vprBCABgcN11m9mn/PKsBbmBhX7ZduK1nl7g GaWx/g5Tozd9dFgLGEiCw+r2rhkAcDBL+BfIMeWuqgPtHVxsL3aVhPWHaAhzPNjSnB1t E993FsRoko7kFnxcA8mf6mnc/fr2nO5CzEvwh0cmu73PRKLAwtSrdfqo1n3JiCbBiUkQ Luj1UBWw6U3gArDg2MCAJDi7VLgDrDjb282lx69yzf7F6KEB60i2GEpIlkbzu07/+zAf k2AB71RzcpGqWucnC+XQ0dBMA5ZXaYNcqgvqPgMHD+fdAolonjK2hcR4MmOwbPSqpdjn hRMQ== X-Gm-Message-State: APjAAAUxgIiWlHZ5ICsPhH57+jdMMa6a6T02u5NiLUGqwO1SS0Npfjrz skxyQZydIp7XUdxcvV+p6eRb9iKuHOA= X-Google-Smtp-Source: APXvYqwecj/iA6JREieWyf9r1kwZfg2Wdg2tNmCsfRvKftthUAngiRjTezE3jt2GDL96ebMI6hRmRw== X-Received: by 2002:a6b:8b49:: with SMTP id n70mr6905625iod.198.1558152082125; Fri, 17 May 2019 21:01:22 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:38 -0600 Message-Id: <20190518040054.230179-9-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 08/24] dtoc: Convert the Fdt.Node class to Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update this class to work correctly on Python 3 and to pass its unit tests. The only required change is to deal with a difference in the behaviour of sorting with a None value. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index f051ce67632..26e683c2a4f 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -465,8 +465,11 @@ class Node: # Sync properties now, whose offsets should not have been disturbed. # We do this after subnodes, since this disturbs the offsets of these - # properties. - prop_list = sorted(self.props.values(), key=lambda prop: prop._offset, + # properties. Note that new properties will have an offset of None here, + # which Python 3 cannot sort against int. So use a large value instead + # to ensure that the new properties are added first. + prop_list = sorted(self.props.values(), + key=lambda prop: prop._offset or 1 << 31, reverse=True) for prop in prop_list: prop.Sync(auto_resize) From patchwork Sat May 18 04:00:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101350 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jnY3I1zj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WpL6Dzlz9s4Y for ; Sat, 18 May 2019 14:07:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 80267C21DA1; Sat, 18 May 2019 04:06:29 +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=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 E814BC21E31; Sat, 18 May 2019 04:01:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0E9B3C21E1D; Sat, 18 May 2019 04:01:28 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id DC5DAC21DFB for ; Sat, 18 May 2019 04:01:23 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id x24so7067763ion.5 for ; Fri, 17 May 2019 21:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a31BS+TDoGaU+TL4GcO9H707UaTr73mbjut+7SpAE2o=; b=jnY3I1zjoadYdwrZ1dKTECyKUTch0buIOx7r6j6ueT9fnHbl9UrgQpMGgGJkEzYqGf ptttvkwdsc1qUrgQ1VgFmhuSUXqOI6VbgVllC23nO9xcRor8tDAb3ecDCITnRnU99dw7 7vk8XDRaVldjbsHUPnbN9Vi9Drifs57PXJmg0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a31BS+TDoGaU+TL4GcO9H707UaTr73mbjut+7SpAE2o=; b=syE2wxfI6s6S4U4e3/M44ixncC1IWc6RQoQZX5RGEmlffopx0WSj1v/G7PSRnrji9P S75zG13bKZneMgUT6cuIPG7j7OGn2iZBWKyFj8VCR6nCuckDlHJ4REY6N75ztYZhRRr7 MHYF11bU6suTfvZUhacs0vDCWURnwUzjENqhEhDitPeR3rMShDBdak8RjvfozoVxWjms 875nKi21nVi/WWnPdQqYXYVloUf5Lt9sIC7qWYe4hYHaajzsI76ZqZRMymX6cDm8s8QB IIaHgNTMAhdLTrlgZjZO4OikrcAwEctTr0VDIhuQp5GD8FMSvVeO1sHDMX7QGzGz+8/m J1Cw== X-Gm-Message-State: APjAAAXMsdDJ4GEey8LZrD7j3N8RarfSLJP86qVbBzPKl8CLdsNCEf6f do3WLq2WE37aNxsv+S58ZPnmMZn82kA= X-Google-Smtp-Source: APXvYqza1lUE8q5FENOVqcvPlfYsJRcUoij0RZBZFbSrE1Mk6knbeHD8kwaeDj9oEElzborQP2cp0g== X-Received: by 2002:a5e:8217:: with SMTP id l23mr8559824iom.84.1558152082777; Fri, 17 May 2019 21:01:22 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:39 -0600 Message-Id: <20190518040054.230179-10-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 09/24] dtoc: Use binary mode for reading files 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The .dtb files are binary so we should open them as binary files. This allows Python 3 to use the correct 'bytes' type. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 3cd34b745ed..4c39f9a3e28 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -85,13 +85,13 @@ class TestFdt(unittest.TestCase): def testFlush(self): """Check that we can flush the device tree out to its file""" fname = self.dtb._fname - with open(fname) as fd: + with open(fname, 'rb') as fd: data = fd.read() os.remove(fname) with self.assertRaises(IOError): - open(fname) + open(fname, 'rb') self.dtb.Flush() - with open(fname) as fd: + with open(fname, 'rb') as fd: data = fd.read() def testPack(self): From patchwork Sat May 18 04:00:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101358 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="e2PtGuGg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WvP5GFmz9s4Y for ; Sat, 18 May 2019 14:12:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6A437C21DFD; Sat, 18 May 2019 04:08:10 +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=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 D1423C21E96; Sat, 18 May 2019 04:01:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BAD81C21E52; Sat, 18 May 2019 04:01:28 +0000 (UTC) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by lists.denx.de (Postfix) with ESMTPS id 8403BC21E2B for ; Sat, 18 May 2019 04:01:24 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id u2so7071643ioc.4 for ; Fri, 17 May 2019 21:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mT/xLyXx+yLecjhV/nhu8LSzaKQE3mjTQQLmxAoy5nw=; b=e2PtGuGgm3uNmWHarnwgmCa+ILg2nzeKO2uGpN6r593VNRTYz1A74MqWB1oJcKlMQa fah03GeqadA50l7LL/4kQr5Nsa4p5yIrrWDp6N17qsgEbR9wmldf7wm1+gZO9v/3VJ4r mhDbG52lMeNDIXaWsbiRPxEXskTVYlvzvQoYU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mT/xLyXx+yLecjhV/nhu8LSzaKQE3mjTQQLmxAoy5nw=; b=m5ZQS40GhNufCnev/kmvity6hQeR3c0P8OYwZ9buaGjqHmcgV8VzF6+wGrKCB47M3Q RTPQb693rcKarIsd1vkHthGFegesTo7B+dde9Arg+5nQBLlGnUzZQ76kD7cVfB1ET5Jp iJaMUWhLl0MqKuXPELYx82ftmmBbBpG8JNYm2uFMXGg+c2TQLHGs5/RSKniiU4JK3II6 FVAYeeVX1c8aJyAJ2Anp64VhpzQxsZ1bLgU1t2LtL7SEyZxFxyJlUgDjEj4r93htsMS2 H85tdRWzqyUsIejaLP8+nf1wVswORdEBhzE6DwuWVCF5jhB8JPuPWGLiVd3o/2p5LcPP 8kdA== X-Gm-Message-State: APjAAAVQWuWMoUV4vG1tapfWJEnHd7t/vNNtwoaAwaDf1XNAEAtkfWNW 93ShdE11pYqo5rJH7l66tzCOqXUXXq0= X-Google-Smtp-Source: APXvYqyGfkldkF1xvVRT+5Si2NyezOmoqsnH+W5oCuCy8/JLgwss9J6MW2t8kM11y3w4S3vzq8ScQQ== X-Received: by 2002:a6b:c94f:: with SMTP id z76mr36085878iof.133.1558152083390; Fri, 17 May 2019 21:01:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:40 -0600 Message-Id: <20190518040054.230179-11-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 10/24] dtoc: Test full 64-bit properties with FdtCellsToCpu() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present this test does not check the upper 32 bits of the returned value. Add some additional tests to cover this. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 4c39f9a3e28..a5234ce1e88 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -498,10 +498,17 @@ class TestFdtUtil(unittest.TestCase): self.assertEqual(2, fdt_util.fdt_cells_to_cpu(val, 1)) dtb2 = fdt.FdtScan('tools/dtoc/dtoc_test_addr64.dts') - node2 = dtb2.GetNode('/test1') - val = node2.props['reg'].value + node1 = dtb2.GetNode('/test1') + val = node1.props['reg'].value self.assertEqual(0x1234, fdt_util.fdt_cells_to_cpu(val, 2)) + node2 = dtb2.GetNode('/test2') + val = node2.props['reg'].value + self.assertEqual(0x1234567890123456, fdt_util.fdt_cells_to_cpu(val, 2)) + self.assertEqual(0x9876543210987654, fdt_util.fdt_cells_to_cpu(val[2:], + 2)) + self.assertEqual(0x12345678, fdt_util.fdt_cells_to_cpu(val, 1)) + def testEnsureCompiled(self): """Test a degenerate case of this function""" dtb = fdt_util.EnsureCompiled('tools/dtoc/dtoc_test_simple.dts') From patchwork Sat May 18 04:00:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101356 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ce5myF1C"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WtY2DM7z9s4Y for ; Sat, 18 May 2019 14:11:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D3DDFC21DF8; Sat, 18 May 2019 04:07:58 +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=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 1B1ACC21E74; Sat, 18 May 2019 04:01:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 82868C21E53; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id 176EDC21DA1 for ; Sat, 18 May 2019 04:01:25 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id g84so7086633ioa.1 for ; Fri, 17 May 2019 21:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TqLivxp8J4F6KinKgLzxe4wAUgZHTZgFMenJcPu0A5w=; b=Ce5myF1C7r7QANd7l1SXV1qol2/aITXksY7fqj9bQiobVNKugs1r5zj6VZ+XwkVNDc g9QMBiUu+DgV5k+UWFhWB9pnXKM5JGGbhV0eP90AcOsIsQloN71pjr6+a8CFuiomI470 vaARdWK9vIiaWZxGkdo0iw4D/pLcFPymXjVNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TqLivxp8J4F6KinKgLzxe4wAUgZHTZgFMenJcPu0A5w=; b=SZusqDnYZZeZqlP09sz23sv+Nan1KkIteMUY5gQHCFlx6r8fFZJmOBX6pHpAmZarfS 5LlPtjMAm2V07ge6p0VdDw4y8k9XV5U7ONG1sekj81cVlIrd0qGQqq2b3asoCoggmksw MYL1Xiz8ohJx50U+1t5H/g/b49514R9MSSGLZwsbVG5WUkFhnY10vnq8DC5YAPbrtKTo QvyIDKEWSGaUIHsbqhC+8lYqP99+XuYmuwbxxxME2ihOrB9uaCQBOO0ksHEcvrmxFL8u +oTdPiRGkmjVYJTzKqygcJ7BwyfCa2Jjtu5Pz6CBoGGwJQMrmifD2isIjjuoIJoMGSKf ezhg== X-Gm-Message-State: APjAAAVhN4ymnj5wTNDPTgljlQpbWScIi/TnfIRt43uNp2bYZ3wSIR/C yGEOhbTDx2tkbKmKrohG+3UoTR0B8Xg= X-Google-Smtp-Source: APXvYqxsLjIa4FpXWCIr2rNXHvVqC4r2vEK+PmOrDy/KExQJTiClMCsHflfOBjH7FE7xhbhZkSsQow== X-Received: by 2002:a5d:8055:: with SMTP id b21mr30881704ior.241.1558152083961; Fri, 17 May 2019 21:01:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:41 -0600 Message-Id: <20190518040054.230179-12-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 11/24] dtoc: Add a unit test for BytesToValue() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a simple unit test for one of the cases of this function, so that any fault can be seen directly, rather than appearing through the failure of another test. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index a5234ce1e88..32a020bad2e 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -19,7 +19,7 @@ for dirname in ['../patman', '..']: import command import fdt -from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL +from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, BytesToValue import fdt_util from fdt_util import fdt32_to_cpu import libfdt @@ -121,6 +121,10 @@ class TestFdt(unittest.TestCase): node = self.dtb.GetNode('/spl-test') self.assertEqual(self.dtb, node.GetFdt()) + def testBytesToValue(self): + self.assertEqual(BytesToValue(b'this\0is\0'), + (TYPE_STRING, ['this', 'is'])) + class TestNode(unittest.TestCase): """Test operation of the Node class""" From patchwork Sat May 18 04:00:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101362 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="A7f6v4op"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wwl0ZSyz9s4Y for ; Sat, 18 May 2019 14:13:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BDD25C21DD7; Sat, 18 May 2019 04:08:48 +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_MSPIKE_H2, 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 92AB0C21DEC; Sat, 18 May 2019 04:02:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E47FBC21DD4; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: from mail-it1-f196.google.com (mail-it1-f196.google.com [209.85.166.196]) by lists.denx.de (Postfix) with ESMTPS id B654BC21E3B for ; Sat, 18 May 2019 04:01:25 +0000 (UTC) Received: by mail-it1-f196.google.com with SMTP id 9so15180027itf.4 for ; Fri, 17 May 2019 21:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GFbBOzRzisGuQl/2tVXbcnP1vN/giUrYeBiUGlrNYeM=; b=A7f6v4op18Hb4Ov1a8gitPq287L0nuF6iU1idXZBTErssB4wKeUDy7o+h4Yu6S5Idr hnjSGixk7dwYx7tCyej32d09C5SwxP2EJP32A8bcH7aVLVfNkv9TfTzB5IBrX5MYIq+w UM16K7KSRg3zy7/pVh2mH5mh+5s/audsflNbQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GFbBOzRzisGuQl/2tVXbcnP1vN/giUrYeBiUGlrNYeM=; b=j3y3nnCnZlWjNkRevmpqFW7NgaAKzRojcvXXseVASAGzxeHZESV5WXiXmK60UTujht BzsUp+c7TTA4bdO/NYpetIxSAqhyWOHRdIA9uKcaq+l00zn91mapJ+rV9n7LzHLA/614 PICWguIxw7YTIJeMynsvYj/cY93BfVJ1VqCNNEOr4orgXCj47gzweiAd42Mfut/y/bea SBgWOnoa44f82v/4SObyN4jIqp5+rqzu0LCb4msWoP9pt8dym+YyRsJaV8BLyA+w3e4q ZHZKdpwkUwx0G6s+ne+fN5o+wYhjmBzY2f+KQY6LtIqNZqbB06xO2wvKP09tMpti0Y1Y PGDQ== X-Gm-Message-State: APjAAAWYfH9hxml5ldxWEtodlqvPuuizJkucdLk0UkK5MLek+hZOTUES 7eWxy8tRuxt381ZpcxFavHDern1wC94= X-Google-Smtp-Source: APXvYqwaXxLJ/DR//Ryk42JN7kaVpkclKWlpF4vWzF4ySfbBdKbFXEcLjcb6q2E7NlnX5Vig/e6dJA== X-Received: by 2002:a24:7595:: with SMTP id y143mr5188626itc.42.1558152084589; Fri, 17 May 2019 21:01:24 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:42 -0600 Message-Id: <20190518040054.230179-13-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 12/24] dtoc: Update fdt_util for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since we are now using the bytes type in Python 3, the conversion in fdt32_to_cpu() is not necessary, so drop it. Also use 'int' instead of 'long' to convert the integer value, since 'long' is not present in Python 3. With this, test_fdt passes with both Python 2 and 3: PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \ ./tools/dtoc/test_fdt -t PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \ ./tools/dtoc/test_fdt -t Signed-off-by: Simon Glass --- tools/dtoc/fdt_util.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py index 5fbfc8877bd..f47879ac006 100644 --- a/tools/dtoc/fdt_util.py +++ b/tools/dtoc/fdt_util.py @@ -16,14 +16,6 @@ import tempfile import command import tools -VERSION3 = sys.version_info > (3, 0) - -def get_plain_bytes(val): - """Handle Python 3 strings""" - if isinstance(val, bytes): - val = val.decode('utf-8') - return val.encode('raw_unicode_escape') - def fdt32_to_cpu(val): """Convert a device tree cell to an integer @@ -33,9 +25,6 @@ def fdt32_to_cpu(val): Return: A native-endian integer value """ - if VERSION3: - # This code is not reached in Python 2 - val = get_plain_bytes(val) # pragma: no cover return struct.unpack('>I', val)[0] def fdt_cells_to_cpu(val, cells): @@ -45,11 +34,11 @@ def fdt_cells_to_cpu(val, cells): Value to convert (array of one or more 4-character strings) Return: - A native-endian long value + A native-endian integer value """ if not cells: return 0 - out = long(fdt32_to_cpu(val[0])) + out = int(fdt32_to_cpu(val[0])) if cells == 2: out = out << 32 | fdt32_to_cpu(val[1]) return out From patchwork Sat May 18 04:00:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101359 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mO/b3JYo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wvl6Q4zz9s4Y for ; Sat, 18 May 2019 14:12:19 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9407FC21DE8; Sat, 18 May 2019 04:09:26 +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_MSPIKE_H2, 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 F054AC21E75; Sat, 18 May 2019 04:02:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D54B2C21DA6; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: from mail-it1-f194.google.com (mail-it1-f194.google.com [209.85.166.194]) by lists.denx.de (Postfix) with ESMTPS id 539CEC21E3E for ; Sat, 18 May 2019 04:01:26 +0000 (UTC) Received: by mail-it1-f194.google.com with SMTP id q132so15050698itc.5 for ; Fri, 17 May 2019 21:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8+CT/3YUcTfkSaGi5o8r9/24LRpRcjD5x6Ms+ySz9Ss=; b=mO/b3JYoWhqb5ONQ+svzVhUGncu2/ZeT79GF7uFP3cd8xZZtt7yjqtYfDjtAOgsWmS jZwp0RfBGpZygBrsdIXB78PF87f1YXSSF6IXV9jI4dllRv26ZcHUypngjc8gHAH+yUfE h0oOiYfsHFWsCMRYabMLWo/aIABFgwBr9NxeU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8+CT/3YUcTfkSaGi5o8r9/24LRpRcjD5x6Ms+ySz9Ss=; b=mmFjiD8KI5BV07qHy9dHFEEfEOj/qlLdStfvECaSJhqiVi0gF4pjeX3c6aVvzxtgMF vux3O0Z9fHWp6FF8rcyYnPchvUKqbBu1yw2V/LAw6YSw27NTEjGkkbBfj98yefoLnkqq 7JmbSFeYDpRvSIako0GCI9SuOxF/mZe4i9NSepJXc1HG/Z9NblwAHpw8akHnV1Vt0IwM jniDfHoP73s8O1LCWv7Av5OvWkZvMrtsTsq8gXnjvZwKb4T51a7udTXMlLpQ2Wb4AELI z/jak+kWXHkycu1+M8NhSiPDhN0HSgpdhBtBFxy6idofTbVw2TN4yvxjERqxCEv8u3OO SeUA== X-Gm-Message-State: APjAAAXQbWsUNMHBGYwS8Mtvb98VVruAN5HtilzQmstnAWW1ys1AJ1x3 uh26M98FNmkk62XS+AkD44I+El6g/18= X-Google-Smtp-Source: APXvYqxvcjKi8DrgRHMXvXGI5LhJZ0YA9ojQgEFXexSWmL5wi45zZ9e3zNYfE1loCrWSgF1Wja2rug== X-Received: by 2002:a02:3ecb:: with SMTP id s194mr40251467jas.29.1558152085213; Fri, 17 May 2019 21:01:25 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:43 -0600 Message-Id: <20190518040054.230179-14-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 13/24] dtoc: Update dtb_platdata to support Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The only change needed is to update get_value() to support the 'bytes' type correctly with Python 3. With this the dtoc unit tests pass with both Python 2 and 3: PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \ ./tools/dtoc/dtoc -t PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \ ./tools/dtoc/dtoc -t Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 3b66af8df78..037e82c8bbd 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -17,6 +17,7 @@ import sys import fdt import fdt_util +import tools # When we see these properties we ignore them - i.e. do not create a structure member PROP_IGNORE_LIST = [ @@ -99,7 +100,7 @@ def get_value(ftype, value): if ftype == fdt.TYPE_INT: return '%#x' % fdt_util.fdt32_to_cpu(value) elif ftype == fdt.TYPE_BYTE: - return '%#x' % ord(value[0]) + return '%#x' % tools.ToByte(value[0]) elif ftype == fdt.TYPE_STRING: return '"%s"' % value elif ftype == fdt.TYPE_BOOL: From patchwork Sat May 18 04:00:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101360 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CIMrVpA5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Ww43Hr4z9s4Y for ; Sat, 18 May 2019 14:12:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 15631C21D56; Sat, 18 May 2019 04:06:54 +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_MSPIKE_H2, 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 EF583C21DF3; Sat, 18 May 2019 04:01:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 84337C21E2C; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id E69B1C21DFA for ; Sat, 18 May 2019 04:01:26 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id m141so15066845ita.3 for ; Fri, 17 May 2019 21:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KycPn3L13B77B1lpKQlhLkw71XLtcKPhetZAYHZyrqY=; b=CIMrVpA5Zrw3rpgSTVX5AiPGOP7oMjIb4HgnjHBm22p2se+YocWDW8FyjkJFCp4EvM tg5HXxuBlTUXLEI2coy5naJ55DRqTqEm0pM2YLLg34Ah/uCpqnJXqy7ZOcmVEICS45JN QbOxqVslItv7Nq0t/3CbdpgwbA+Nkjn2noipU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KycPn3L13B77B1lpKQlhLkw71XLtcKPhetZAYHZyrqY=; b=ScdKroxh+mjZQ6aJ5m16+Lmoi6xro/kVfm7pmrAH58IL0rIdMqXo2/ltun/mnb/FP2 zlw+0MWMH/ECDdLtpac+JQFNBorpjB9Tu4TXOM7tQhmzR0UaqWngG10aFmsQEjolLDh7 9MLRYPyNkoPqwSWI0sVtvl7XKE4TJx2k08nIT86VCUbqITB/+F8u0DqbLHYhkFjo9nzQ oSkMMw2P2ix9LFcdtIfYuQuWXsYfj5U4mjqrEJuC2G/J23m/kIVy+EhDrBpQs0X3x3th O+1je0yAINECyPJAGBRtO8JTQg6IKXlg0D+uM/D4fOReuQtFI1vNmMrNVKTPeg7kwGfQ jbMA== X-Gm-Message-State: APjAAAVf5dpWxYUwaQHO9P4DDIqnvTjtl3rrdKwm2ldfZzKskWnYrTxS 3vO77kFYFoyCNcBbsPefcHv21F8zJPw= X-Google-Smtp-Source: APXvYqy5UNRTsRu22q9cXyG22wqwpsSuR93bN2IVvnE1nJexARHR70kWwCBWt2+C2fl3njFEybhzOQ== X-Received: by 2002:a24:10c6:: with SMTP id 189mr5495112ity.147.1558152085773; Fri, 17 May 2019 21:01:25 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:44 -0600 Message-Id: <20190518040054.230179-15-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 14/24] patman: Allow reading files in text mode 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" While reading files in binary mode is the norm, sometimes we want to use text mode. Add an optional parameter to handle this. Signed-off-by: Simon Glass --- tools/patman/tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/patman/tools.py b/tools/patman/tools.py index bdc1953936c..8e9f22afe8a 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -214,7 +214,7 @@ def Filename(fname): # If not found, just return the standard, unchanged path return fname -def ReadFile(fname): +def ReadFile(fname, binary=True): """Read and return the contents of a file. Args: @@ -223,7 +223,7 @@ def ReadFile(fname): Returns: data read from file, as a string. """ - with open(Filename(fname), 'rb') as fd: + with open(Filename(fname), binary and 'rb' or 'r') as fd: data = fd.read() #self._out.Info("Read file '%s' size %d (%#0x)" % #(fname, len(data), len(data))) From patchwork Sat May 18 04:00:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101353 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="arDEsuEo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WsV4SHKz9s4Y for ; Sat, 18 May 2019 14:10:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1B3CDC21DA2; Sat, 18 May 2019 04:07:45 +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_MSPIKE_H2, 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 80A46C21D65; Sat, 18 May 2019 04:01:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 39566C21C93; Sat, 18 May 2019 04:01:31 +0000 (UTC) Received: from mail-it1-f180.google.com (mail-it1-f180.google.com [209.85.166.180]) by lists.denx.de (Postfix) with ESMTPS id A82FDC21E18 for ; Sat, 18 May 2019 04:01:27 +0000 (UTC) Received: by mail-it1-f180.google.com with SMTP id e184so15223287ite.1 for ; Fri, 17 May 2019 21:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BskNXfg3Bc0qaw3GvG/xgWC6QpRGOjzArQsamZMZaNM=; b=arDEsuEoqo3e+F0T2U2c0ghexD2hyaLNS78D7wWv6XcxVFnfKeD/agwqfqzq/Wrubx SFoJ1eawRagmW/tHD8+xNm86YarfwfPdqI93BuLNu6RJbtYY6L4v8hPAnhC1i3IAukSn No5s/oVCC2LO/2297CIvlVse2Ba+IOnvqCHmY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BskNXfg3Bc0qaw3GvG/xgWC6QpRGOjzArQsamZMZaNM=; b=S/MxnAYHf5ohmnT1uIpZMb1Jl8SVE6FyD5hczAnEwQ6Dz0HQz/6htSYZP0fuYey1/F y8A5DtDkcw0Iha2nZD6izx/CrAvt0cOmplUuOEdyyD6Y6hsXxGIAvqKs/pl63fyJV9yt gfA/WtYYU5DTASdfBE3hgcP2Jqf1GR6MdgSP9M9Pd/xfGtBz+F8/1soVsQlIjcaMhcXn WnWNCZmU8lkCpvidK0UorFVmPMem7J4x6bx6vLctBtjG7nDn0QZdVTr0Srn0os8MXuCF NiZTXCT9nbjiyVmOLzPM3PU4MC3OMNdEIihlcQBn2hfG6WMKmFvwTMvsYPye2ZU0Vdot dyYQ== X-Gm-Message-State: APjAAAWSGGeb6uP9Sq1EnjQ90OCq7pug1/RsCj5J7NPRfe7evkSkHypn tKkhbcVemjLaPeqGEeyq/YsdFsjLfZI= X-Google-Smtp-Source: APXvYqyuQEoDpaxvKi/G7pJNuRZFUBwqlhfwlMZb7h4ScpW8d2CZkrBOl0/Dfyv3P1OIVTI3ZZbfCw== X-Received: by 2002:a24:a943:: with SMTP id x3mr16168990iti.64.1558152086390; Fri, 17 May 2019 21:01:26 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:45 -0600 Message-Id: <20190518040054.230179-16-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 15/24] binman: Avoid changing a dict during iteration 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This code works OK in Python 2 but Python 3 complains. Adjust it to avoid deleting elements from a dict while iterating through it. Signed-off-by: Simon Glass --- tools/binman/control.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/binman/control.py b/tools/binman/control.py index ce25eb54858..20186ee1980 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -131,10 +131,13 @@ def Binman(options, args): if options.image: skip = [] + new_images = OrderedDict() for name, image in images.items(): - if name not in options.image: - del images[name] + if name in options.image: + new_images[name] = image + else: skip.append(name) + images = new_images if skip and options.verbosity >= 2: print('Skipping images: %s' % ', '.join(skip)) From patchwork Sat May 18 04:00:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101361 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="oBY74Igm"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wwh1kwNz9s4Y for ; Sat, 18 May 2019 14:13:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EAFD3C21DA2; Sat, 18 May 2019 04:08:25 +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_MSPIKE_H2, 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 7FE8AC21E6C; Sat, 18 May 2019 04:02:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6DA1DC21DF8; Sat, 18 May 2019 04:01:32 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id D5299C21D65 for ; Sat, 18 May 2019 04:01:28 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id i10so15100341ite.0 for ; Fri, 17 May 2019 21:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eLH/bUeCXVOAhmzEGGvuSu2kd8J8KNmFi46Va8S5WeE=; b=oBY74IgmryiWxlePezM+pbuQt3BtxM8j0ctXmxhwTPBRod7yWheujPbpnbIX9kU0kH bvfUVA9/XyvGvPutRoZVO+XGK92Ttq8aFkDqjVRrqDwW23bDXy1AdGrkQRIckeLp//Kd SV+jtAzwAy6/E8+V9uasxfetFtLnu/kCE2lBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eLH/bUeCXVOAhmzEGGvuSu2kd8J8KNmFi46Va8S5WeE=; b=MsD0L1UbyIifSJZAzH9mew+AUYO5b86MA2nczxFLCPmo7JEl/HozYpRSUau1zTylXW HOom+/XoBaS3nirl6cX+2HHnKEuywW37hPkJ9gO5SZaWHlr4hgrWRwIRTAxXYGIBOVhA V4NdV4K8xF0yyfIGfeKCUEKuYz+PsgueGcrdGZewobqfkOGA7Ii5EQ4ABKL7LMyv2KoH 1fyGO8zlTthD3wousBYccE8CvIJLmY6vtax3gUA+3GYzNQ0V87xqe4YhqL2RU9evhXw3 8n/Ku/qFby13AyZMSMzOIfCenZMAsYC9/If8CBOYQ2BAIwK4Xnu42aosQyi0Zjd5r3jc pNYQ== X-Gm-Message-State: APjAAAW1cd3QyQo5Vue4Ixdi+yGlIuWD/U2nBhyGJ6ZKfw8FGmKxdvUn taTpp9cw36mgTxVjYXfAK1MXzzWYYIw= X-Google-Smtp-Source: APXvYqxd0PajkrrnrhhHlrUjlh/5mJFfeDyi5ahm9uFeA1effs2FCbvTWiD4SOE9tm02gJ1ERUWfxg== X-Received: by 2002:a24:d241:: with SMTP id z62mr5707705itf.141.1558152087244; Fri, 17 May 2019 21:01:27 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:46 -0600 Message-Id: <20190518040054.230179-17-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 16/24] binman: Convert to use bytes type 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the code accordingly so that it works on both Python 2 and Python 3. Signed-off-by: Simon Glass --- tools/binman/elf_test.py | 5 +- tools/binman/etype/_testing.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 4 +- tools/binman/etype/u_boot_ucode.py | 4 +- tools/binman/etype/vblock.py | 2 +- tools/binman/ftest.py | 132 ++++++++++---------- 6 files changed, 77 insertions(+), 72 deletions(-) diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py index 3d55cb1946e..42d94cbbbe2 100644 --- a/tools/binman/elf_test.py +++ b/tools/binman/elf_test.py @@ -22,7 +22,7 @@ class FakeEntry: """ def __init__(self, contents_size): self.contents_size = contents_size - self.data = 'a' * contents_size + self.data = tools.GetBytes(ord('a'), contents_size) def GetPath(self): return 'entry_path' @@ -122,7 +122,8 @@ class TestElf(unittest.TestCase): section = FakeSection(sym_value=None) elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms') syms = elf.LookupAndWriteSymbols(elf_fname, entry, section) - self.assertEqual(tools.GetBytes(255, 16) + 'a' * 4, entry.data) + self.assertEqual(tools.GetBytes(255, 16) + tools.GetBytes(ord('a'), 4), + entry.data) def testDebug(self): """Check that enabling debug in the elf module produced debug output""" diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py index 3e345bd9526..ac62d2e2005 100644 --- a/tools/binman/etype/_testing.py +++ b/tools/binman/etype/_testing.py @@ -75,7 +75,7 @@ class Entry__testing(Entry): def ObtainContents(self): if self.return_unknown_contents or not self.return_contents: return False - self.data = 'a' + self.data = b'a' self.contents_size = len(self.data) if self.return_contents_once: self.return_contents = False diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index 444c51b8b72..188888e022b 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -26,7 +26,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): """ def __init__(self, section, etype, node): Entry_blob_dtb.__init__(self, section, etype, node) - self.ucode_data = '' + self.ucode_data = b'' self.collate = False self.ucode_offset = None self.ucode_size = None @@ -65,7 +65,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): for node in self.ucode.subnodes: data_prop = node.props.get('data') if data_prop: - self.ucode_data += ''.join(data_prop.bytes) + self.ucode_data += data_prop.bytes if self.collate: node.DeleteProp('data') return True diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py index a00e530295b..dee8848db7a 100644 --- a/tools/binman/etype/u_boot_ucode.py +++ b/tools/binman/etype/u_boot_ucode.py @@ -69,7 +69,7 @@ class Entry_u_boot_ucode(Entry_blob): if entry and entry.target_offset: found = True if not found: - self.data = '' + self.data = b'' return True # Get the microcode from the device tree entry. If it is not available # yet, return False so we will be called later. If the section simply @@ -87,7 +87,7 @@ class Entry_u_boot_ucode(Entry_blob): if not fdt_entry.collate: # This binary can be empty - self.data = '' + self.data = b'' return True # Write it out to a file diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py index 334ff9f966a..91fa2f7808f 100644 --- a/tools/binman/etype/vblock.py +++ b/tools/binman/etype/vblock.py @@ -51,7 +51,7 @@ class Entry_vblock(Entry): def ObtainContents(self): # Join up the data files to be signed - input_data = '' + input_data = b'' for entry_phandle in self.content: data = self.section.GetContentsByPhandle(entry_phandle, self) if data is None: diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 971fade3432..48fec501790 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -29,38 +29,38 @@ import tools import tout # Contents of test files, corresponding to different entry types -U_BOOT_DATA = '1234' -U_BOOT_IMG_DATA = 'img' -U_BOOT_SPL_DATA = '56780123456789abcde' -U_BOOT_TPL_DATA = 'tpl' -BLOB_DATA = '89' -ME_DATA = '0abcd' -VGA_DATA = 'vga' -U_BOOT_DTB_DATA = 'udtb' -U_BOOT_SPL_DTB_DATA = 'spldtb' -U_BOOT_TPL_DTB_DATA = 'tpldtb' -X86_START16_DATA = 'start16' -X86_START16_SPL_DATA = 'start16spl' -X86_START16_TPL_DATA = 'start16tpl' -PPC_MPC85XX_BR_DATA = 'ppcmpc85xxbr' -U_BOOT_NODTB_DATA = 'nodtb with microcode pointer somewhere in here' -U_BOOT_SPL_NODTB_DATA = 'splnodtb with microcode pointer somewhere in here' -U_BOOT_TPL_NODTB_DATA = 'tplnodtb with microcode pointer somewhere in here' -FSP_DATA = 'fsp' -CMC_DATA = 'cmc' -VBT_DATA = 'vbt' -MRC_DATA = 'mrc' +U_BOOT_DATA = b'1234' +U_BOOT_IMG_DATA = b'img' +U_BOOT_SPL_DATA = b'56780123456789abcde' +U_BOOT_TPL_DATA = b'tpl' +BLOB_DATA = b'89' +ME_DATA = b'0abcd' +VGA_DATA = b'vga' +U_BOOT_DTB_DATA = b'udtb' +U_BOOT_SPL_DTB_DATA = b'spldtb' +U_BOOT_TPL_DTB_DATA = b'tpldtb' +X86_START16_DATA = b'start16' +X86_START16_SPL_DATA = b'start16spl' +X86_START16_TPL_DATA = b'start16tpl' +PPC_MPC85XX_BR_DATA = b'ppcmpc85xxbr' +U_BOOT_NODTB_DATA = b'nodtb with microcode pointer somewhere in here' +U_BOOT_SPL_NODTB_DATA = b'splnodtb with microcode pointer somewhere in here' +U_BOOT_TPL_NODTB_DATA = b'tplnodtb with microcode pointer somewhere in here' +FSP_DATA = b'fsp' +CMC_DATA = b'cmc' +VBT_DATA = b'vbt' +MRC_DATA = b'mrc' TEXT_DATA = 'text' TEXT_DATA2 = 'text2' TEXT_DATA3 = 'text3' -CROS_EC_RW_DATA = 'ecrw' -GBB_DATA = 'gbbd' -BMPBLK_DATA = 'bmp' -VBLOCK_DATA = 'vblk' -FILES_DATA = ("sorry I'm late\nOh, don't bother apologising, I'm " + - "sorry you're alive\n") -COMPRESS_DATA = 'data to compress' -REFCODE_DATA = 'refcode' +CROS_EC_RW_DATA = b'ecrw' +GBB_DATA = b'gbbd' +BMPBLK_DATA = b'bmp' +VBLOCK_DATA = b'vblk' +FILES_DATA = (b"sorry I'm late\nOh, don't bother apologising, I'm " + + b"sorry you're alive\n") +COMPRESS_DATA = b'data to compress' +REFCODE_DATA = b'refcode' class TestFunctional(unittest.TestCase): @@ -803,7 +803,7 @@ class TestFunctional(unittest.TestCase): def testPackX86RomMeNoDesc(self): """Test that an invalid Intel descriptor entry is detected""" - TestFunctional._MakeInputFile('descriptor.bin', '') + TestFunctional._MakeInputFile('descriptor.bin', b'') with self.assertRaises(ValueError) as e: self._DoTestFile('031_x86-rom-me.dts') self.assertIn("Node '/binman/intel-descriptor': Cannot find FD " @@ -900,8 +900,8 @@ class TestFunctional(unittest.TestCase): """ first, pos_and_size = self._RunMicrocodeTest('034_x86_ucode.dts', U_BOOT_NODTB_DATA) - self.assertEqual('nodtb with microcode' + pos_and_size + - ' somewhere in here', first) + self.assertEqual(b'nodtb with microcode' + pos_and_size + + b' somewhere in here', first) def _RunPackUbootSingleMicrocode(self): """Test that x86 microcode can be handled correctly @@ -932,8 +932,8 @@ class TestFunctional(unittest.TestCase): pos_and_size = struct.pack('<2L', 0xfffffe00 + ucode_pos, len(ucode_data)) first = data[:len(U_BOOT_NODTB_DATA)] - self.assertEqual('nodtb with microcode' + pos_and_size + - ' somewhere in here', first) + self.assertEqual(b'nodtb with microcode' + pos_and_size + + b' somewhere in here', first) def testPackUbootSingleMicrocode(self): """Test that x86 microcode can be handled correctly with fdt_normal. @@ -1068,8 +1068,8 @@ class TestFunctional(unittest.TestCase): self._SetupSplElf('u_boot_ucode_ptr') first, pos_and_size = self._RunMicrocodeTest(dts, U_BOOT_SPL_NODTB_DATA, ucode_second=ucode_second) - self.assertEqual('splnodtb with microc' + pos_and_size + - 'ter somewhere in here', first) + self.assertEqual(b'splnodtb with microc' + pos_and_size + + b'ter somewhere in here', first) def testPackUbootSplMicrocode(self): """Test that x86 microcode can be handled correctly in SPL""" @@ -1123,8 +1123,9 @@ class TestFunctional(unittest.TestCase): def testSections(self): """Basic test of sections""" data = self._DoReadFile('055_sections.dts') - expected = (U_BOOT_DATA + '!' * 12 + U_BOOT_DATA + 'a' * 12 + - U_BOOT_DATA + '&' * 4) + expected = (U_BOOT_DATA + tools.GetBytes(ord('!'), 12) + + U_BOOT_DATA + tools.GetBytes(ord('a'), 12) + + U_BOOT_DATA + tools.GetBytes(ord('&'), 4)) self.assertEqual(expected, data) def testMap(self): @@ -1282,8 +1283,10 @@ class TestFunctional(unittest.TestCase): } data, _, _, _ = self._DoReadFileDtb('066_text.dts', entry_args=entry_args) - expected = (TEXT_DATA + tools.GetBytes(0, 8 - len(TEXT_DATA)) + - TEXT_DATA2 + TEXT_DATA3 + 'some text') + expected = (tools.ToBytes(TEXT_DATA) + + tools.GetBytes(0, 8 - len(TEXT_DATA)) + + tools.ToBytes(TEXT_DATA2) + tools.ToBytes(TEXT_DATA3) + + b'some text') self.assertEqual(expected, data) def testEntryDocs(self): @@ -1304,32 +1307,33 @@ class TestFunctional(unittest.TestCase): """Basic test of generation of a flashrom fmap""" data = self._DoReadFile('067_fmap.dts') fhdr, fentries = fmap_util.DecodeFmap(data[32:]) - expected = U_BOOT_DATA + '!' * 12 + U_BOOT_DATA + 'a' * 12 + expected = (U_BOOT_DATA + tools.GetBytes(ord('!'), 12) + + U_BOOT_DATA + tools.GetBytes(ord('a'), 12)) self.assertEqual(expected, data[:32]) - self.assertEqual('__FMAP__', fhdr.signature) + self.assertEqual(b'__FMAP__', fhdr.signature) self.assertEqual(1, fhdr.ver_major) self.assertEqual(0, fhdr.ver_minor) self.assertEqual(0, fhdr.base) self.assertEqual(16 + 16 + fmap_util.FMAP_HEADER_LEN + fmap_util.FMAP_AREA_LEN * 3, fhdr.image_size) - self.assertEqual('FMAP', fhdr.name) + self.assertEqual(b'FMAP', fhdr.name) self.assertEqual(3, fhdr.nareas) for fentry in fentries: self.assertEqual(0, fentry.flags) self.assertEqual(0, fentries[0].offset) self.assertEqual(4, fentries[0].size) - self.assertEqual('RO_U_BOOT', fentries[0].name) + self.assertEqual(b'RO_U_BOOT', fentries[0].name) self.assertEqual(16, fentries[1].offset) self.assertEqual(4, fentries[1].size) - self.assertEqual('RW_U_BOOT', fentries[1].name) + self.assertEqual(b'RW_U_BOOT', fentries[1].name) self.assertEqual(32, fentries[2].offset) self.assertEqual(fmap_util.FMAP_HEADER_LEN + fmap_util.FMAP_AREA_LEN * 3, fentries[2].size) - self.assertEqual('FMAP', fentries[2].name) + self.assertEqual(b'FMAP', fentries[2].name) def testBlobNamedByArg(self): """Test we can add a blob with the filename coming from an entry arg""" @@ -1597,7 +1601,7 @@ class TestFunctional(unittest.TestCase): files = entries['files'] entries = files._section._entries - orig = '' + orig = b'' for i in range(1, 3): key = '%d.dat' % i start = entries[key].image_pos @@ -1625,10 +1629,10 @@ class TestFunctional(unittest.TestCase): """Test an expanding entry""" data, _, map_data, _ = self._DoReadFileDtb('088_expand_size.dts', map=True) - expect = ('a' * 8 + U_BOOT_DATA + - MRC_DATA + 'b' * 1 + U_BOOT_DATA + - 'c' * 8 + U_BOOT_DATA + - 'd' * 8) + expect = (tools.GetBytes(ord('a'), 8) + U_BOOT_DATA + + MRC_DATA + tools.GetBytes(ord('b'), 1) + U_BOOT_DATA + + tools.GetBytes(ord('c'), 8) + U_BOOT_DATA + + tools.GetBytes(ord('d'), 8)) self.assertEqual(expect, data) self.assertEqual('''ImagePos Offset Size Name 00000000 00000000 00000028 main-section @@ -1660,7 +1664,7 @@ class TestFunctional(unittest.TestCase): hash_node = dtb.GetNode('/binman/u-boot/hash').props['value'] m = hashlib.sha256() m.update(U_BOOT_DATA) - self.assertEqual(m.digest(), ''.join(hash_node.value)) + self.assertEqual(m.digest(), b''.join(hash_node.value)) def testHashNoAlgo(self): with self.assertRaises(ValueError) as e: @@ -1683,8 +1687,8 @@ class TestFunctional(unittest.TestCase): hash_node = dtb.GetNode('/binman/section/hash').props['value'] m = hashlib.sha256() m.update(U_BOOT_DATA) - m.update(16 * 'a') - self.assertEqual(m.digest(), ''.join(hash_node.value)) + m.update(tools.GetBytes(ord('a'), 16)) + self.assertEqual(m.digest(), b''.join(hash_node.value)) def testPackUBootTplMicrocode(self): """Test that x86 microcode can be handled correctly in TPL @@ -1699,14 +1703,14 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('tpl/u-boot-tpl', fd.read()) first, pos_and_size = self._RunMicrocodeTest('093_x86_tpl_ucode.dts', U_BOOT_TPL_NODTB_DATA) - self.assertEqual('tplnodtb with microc' + pos_and_size + - 'ter somewhere in here', first) + self.assertEqual(b'tplnodtb with microc' + pos_and_size + + b'ter somewhere in here', first) def testFmapX86(self): """Basic test of generation of a flashrom fmap""" data = self._DoReadFile('094_fmap_x86.dts') fhdr, fentries = fmap_util.DecodeFmap(data[32:]) - expected = U_BOOT_DATA + MRC_DATA + 'a' * (32 - 7) + expected = U_BOOT_DATA + MRC_DATA + tools.GetBytes(ord('a'), 32 - 7) self.assertEqual(expected, data[:32]) fhdr, fentries = fmap_util.DecodeFmap(data[32:]) @@ -1714,21 +1718,21 @@ class TestFunctional(unittest.TestCase): self.assertEqual(0, fentries[0].offset) self.assertEqual(4, fentries[0].size) - self.assertEqual('U_BOOT', fentries[0].name) + self.assertEqual(b'U_BOOT', fentries[0].name) self.assertEqual(4, fentries[1].offset) self.assertEqual(3, fentries[1].size) - self.assertEqual('INTEL_MRC', fentries[1].name) + self.assertEqual(b'INTEL_MRC', fentries[1].name) self.assertEqual(32, fentries[2].offset) self.assertEqual(fmap_util.FMAP_HEADER_LEN + fmap_util.FMAP_AREA_LEN * 3, fentries[2].size) - self.assertEqual('FMAP', fentries[2].name) + self.assertEqual(b'FMAP', fentries[2].name) def testFmapX86Section(self): """Basic test of generation of a flashrom fmap""" data = self._DoReadFile('095_fmap_x86_section.dts') - expected = U_BOOT_DATA + MRC_DATA + 'b' * (32 - 7) + expected = U_BOOT_DATA + MRC_DATA + tools.GetBytes(ord('b'), 32 - 7) self.assertEqual(expected, data[:32]) fhdr, fentries = fmap_util.DecodeFmap(data[36:]) @@ -1736,16 +1740,16 @@ class TestFunctional(unittest.TestCase): self.assertEqual(0, fentries[0].offset) self.assertEqual(4, fentries[0].size) - self.assertEqual('U_BOOT', fentries[0].name) + self.assertEqual(b'U_BOOT', fentries[0].name) self.assertEqual(4, fentries[1].offset) self.assertEqual(3, fentries[1].size) - self.assertEqual('INTEL_MRC', fentries[1].name) + self.assertEqual(b'INTEL_MRC', fentries[1].name) self.assertEqual(36, fentries[2].offset) self.assertEqual(fmap_util.FMAP_HEADER_LEN + fmap_util.FMAP_AREA_LEN * 3, fentries[2].size) - self.assertEqual('FMAP', fentries[2].name) + self.assertEqual(b'FMAP', fentries[2].name) def testElf(self): """Basic test of ELF entries""" From patchwork Sat May 18 04:00:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101351 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mZuR4pYI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wpx6691z9s4Y for ; Sat, 18 May 2019 14:08:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7026EC21D83; Sat, 18 May 2019 04:07:32 +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_MSPIKE_H2, 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 D8614C21E49; Sat, 18 May 2019 04:01:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 14282C21E08; Sat, 18 May 2019 04:01:32 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id F2DF0C21E49 for ; Sat, 18 May 2019 04:01:28 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id m140so15212810itg.2 for ; Fri, 17 May 2019 21:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CcxnHhdNA9G8BnQHDVOuQNilSvyXCfolmj6Wn5C33/g=; b=mZuR4pYIkBFdr7BvpnIVfQiERzKCe63Y/+MyV6kXk4CUHaT1dV80hE455piUSz7xpM Rfwf8UQIsDo8Yur0meTILlG3cRqlR7F596qY6U+2vYiIaGH+SyI4B44Ke8DjIv4Hpxo6 fY4ioyoLqBE4jU6n8uMDIg/vKVBNd2tt2dZ18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CcxnHhdNA9G8BnQHDVOuQNilSvyXCfolmj6Wn5C33/g=; b=fDpScjNHYh+yGC2fG8xMsFuFtoA5eVDU1WgmRZTlogK4rqAoF9WWHggiF2ZxpqPlPZ +7qLqY8/l6iwaaLqhdIPYlGZxjj8FbclvD33hedeVltXVqxufRrQo8e9bv7KToICe078 YJ7aAPREG23U8gsZb11ltotd4G6o5YYL66GXM1eBhsDThzWeFzyhuSGpVWmUJuOUCdgB HYPngQCwX8W+mfyEZDwFtYR9FiXtRnyOQJaBrDNv0SFlVbtV4lBYikb8f0cKYjkLenVQ zIV4n92nOBhjRYHN8MekqHPJiRKzJNmhhNOmmpAFRnFisJphwucJNUveQR+AYFoxQplL cyYQ== X-Gm-Message-State: APjAAAVJP0POb5mpg2XOtjqiSvuZ7ZCusWE18GPQCZGb3yibYqUZtZFS DpnWN6/4cDUfHXCb8v0Cy0JLeyR91PM= X-Google-Smtp-Source: APXvYqyOyXn3fW6nzn6tqTXpytu1ZI4xPaDL2c1ZM++KY6H+v/GsaCBhoYgSqYduyWUeXD004/nBCw== X-Received: by 2002:a24:7a90:: with SMTP id a138mr20169707itc.95.1558152087849; Fri, 17 May 2019 21:01:27 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:47 -0600 Message-Id: <20190518040054.230179-18-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 17/24] binman: Update entry_test to support Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The reload() function is in a different place in Python 3. Update the code to handle this. Signed-off-by: Simon Glass --- tools/binman/entry_test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py index 1f7ff5b4e41..b30a7beecc8 100644 --- a/tools/binman/entry_test.py +++ b/tools/binman/entry_test.py @@ -41,7 +41,11 @@ class TestEntry(unittest.TestCase): del sys.modules['importlib'] global entry if entry: - reload(entry) + if sys.version_info[0] >= 3: + import importlib + importlib.reload(entry) + else: + reload(entry) else: import entry entry.Entry.Create(None, self.GetNode(), 'u-boot-spl') From patchwork Sat May 18 04:00:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101355 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="UldNtpiX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WtK1zStz9s4Y for ; Sat, 18 May 2019 14:11:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ED73BC21E0D; Sat, 18 May 2019 04:09:39 +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_MSPIKE_H2, 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 A07F8C21E4F; Sat, 18 May 2019 04:02:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 49D0FC21DA6; Sat, 18 May 2019 04:01:33 +0000 (UTC) Received: from mail-it1-f194.google.com (mail-it1-f194.google.com [209.85.166.194]) by lists.denx.de (Postfix) with ESMTPS id A7935C21E50 for ; Sat, 18 May 2019 04:01:29 +0000 (UTC) Received: by mail-it1-f194.google.com with SMTP id i10so15100370ite.0 for ; Fri, 17 May 2019 21:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WvO/KghLBoMJt7LlWoqdfLV4FrvJ7Mw/+Y24HpPar4w=; b=UldNtpiXFn2GY8UZlErrxwqN7A12ZWW/5EpN5qi3ofZNcXy34CFmQMctH7axuBhQ2O Xs/pyz/wIvOGF960ZK/exReBVp+Hisn5sCVXVXuWeFvjUlGOwyBFUAG+qi/y9Og9AgOX yZ1JEcCqqp2iygf9uOfiZBEL7rDrm5Tbs9yVw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WvO/KghLBoMJt7LlWoqdfLV4FrvJ7Mw/+Y24HpPar4w=; b=BfpM1ql/xH6ekkrb5j+n+WO2dQ02dN2Fu1aiU4efujWqkAdycumALr24KZItPn2opy VH8Lj09fXxxiREXC/rOCIwE6Z1VUuTaG3gVZHnXkOmyzaVbwA/PQsHADxiHXx3KyHC48 vrQeRFtkGWTUpJ6PyUR0WlOZw5+qcWwT3X2UNZf+5BgkhY2oJ9Znq510yGo5jA+lzs/E aZGGg0xBOzyKOQAzGaJaUwTOSr5vNbJRMcaz9fDXhDiE5Q8oqZh8ZJlkWg1tCgKUpBoQ ohcf9+vd9axTRdT25IpXzW6GcxvyoO0APjJ9rSHxrHiY5CtsmbL01s9WRMZJqFQqNBxZ RxfA== X-Gm-Message-State: APjAAAUl9zOPx64JY+SwIm0LSMatT6FzMK/A6LyzyKXPUDG5UYLyjl5E xjgbA4Z2DERC4Y6QLm2jSQwusI3G+nc= X-Google-Smtp-Source: APXvYqx5c4PTazzsN0Xgi2h8zOF+dae79jqfvPR0/cYvfhkzPRRJSWVfhlF7tA6mlrEXxsRaMWyczQ== X-Received: by 2002:a02:9042:: with SMTP id y2mr34226928jaf.113.1558152088489; Fri, 17 May 2019 21:01:28 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:48 -0600 Message-Id: <20190518040054.230179-19-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 18/24] patman: Update fmap code for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This needs special care to ensure that the bytes type is used for binary data. Add conversion code to deal with strings and bytes correctly. Signed-off-by: Simon Glass --- tools/binman/etype/fmap.py | 3 ++- tools/binman/fmap_util.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py index bf35a5bbf4e..e6b5c5c74c0 100644 --- a/tools/binman/etype/fmap.py +++ b/tools/binman/etype/fmap.py @@ -7,6 +7,7 @@ from entry import Entry import fmap_util +import tools class Entry_fmap(Entry): @@ -46,7 +47,7 @@ class Entry_fmap(Entry): if pos is not None: pos -= entry.section.GetRootSkipAtStart() areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0, - entry.name, 0)) + tools.FromUnicode(entry.name), 0)) entries = self.section._image.GetEntries() areas = [] diff --git a/tools/binman/fmap_util.py b/tools/binman/fmap_util.py index be3cbee87bd..d0f956b6221 100644 --- a/tools/binman/fmap_util.py +++ b/tools/binman/fmap_util.py @@ -8,9 +8,12 @@ import collections import struct +import sys + +import tools # constants imported from lib/fmap.h -FMAP_SIGNATURE = '__FMAP__' +FMAP_SIGNATURE = b'__FMAP__' FMAP_VER_MAJOR = 1 FMAP_VER_MINOR = 0 FMAP_STRLEN = 32 @@ -50,6 +53,8 @@ FmapArea = collections.namedtuple('FmapArea', FMAP_AREA_NAMES) def NameToFmap(name): + if type(name) == bytes and sys.version_info[0] >= 3: + name = name.decode('utf-8') # pragma: no cover (for Python 2) return name.replace('\0', '').replace('-', '_').upper() def ConvertName(field_names, fields): @@ -65,7 +70,7 @@ def ConvertName(field_names, fields): value: value of that field (string for the ones we support) """ name_index = field_names.index('name') - fields[name_index] = NameToFmap(fields[name_index]) + fields[name_index] = tools.ToBytes(NameToFmap(fields[name_index])) def DecodeFmap(data): """Decode a flashmap into a header and list of areas @@ -106,7 +111,8 @@ def EncodeFmap(image_size, name, areas): ConvertName(names, params) return struct.pack(fmt, *params) - values = FmapHeader(FMAP_SIGNATURE, 1, 0, 0, image_size, name, len(areas)) + values = FmapHeader(FMAP_SIGNATURE, 1, 0, 0, image_size, + tools.FromUnicode(name), len(areas)) blob = _FormatBlob(FMAP_HEADER_FORMAT, FMAP_HEADER_NAMES, values) for area in areas: blob += _FormatBlob(FMAP_AREA_FORMAT, FMAP_AREA_NAMES, area) From patchwork Sat May 18 04:00:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101352 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AhYxBF0w"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WrT2g6Tz9s4Y for ; Sat, 18 May 2019 14:09:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 012ADC21DAF; Sat, 18 May 2019 04:07:19 +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=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 4867DC21DA2; Sat, 18 May 2019 04:01:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A4E4CC21DF3; Sat, 18 May 2019 04:01:34 +0000 (UTC) Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by lists.denx.de (Postfix) with ESMTPS id 45014C21E02 for ; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: by mail-io1-f51.google.com with SMTP id v7so7023016iob.10 for ; Fri, 17 May 2019 21:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C6M8oKbkbASlxjZjOBQWCeKVBKBs5EDCODAFrv0Zsgg=; b=AhYxBF0wWYB+NY2OYR+0aQkdAIdhlbkIK2IBs690Gq/OMhlUwUBMaEgDp8ljXFbtCV G+43fy+Dwjh1Ezu+kzs3QPnIKJRpTGCZQ3Ha+45EVIEtqqAIPkgO4fgLNW8k3zx8KqXy kBBlxElOY2kkcHk1aazR3ZsXT49/N1ULFJZH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C6M8oKbkbASlxjZjOBQWCeKVBKBs5EDCODAFrv0Zsgg=; b=W/sKJPeidadq3Jt6wmWri0ylubpMyXGHl1S4QA650WM4RDyyQa9eH74DSjE/PbIICl UjUQmgQGy5KzqRy8qxdrGwAUTyCV9jO/Uw1TctqFQhDQvxBq9ep2+7c9QvIQfmVkyRNj WqAtto3MqsDJ7ShYy0IT5T1OcyoCzRsC6r4lk/fCWhQe2Vwe8HwDz0DSCpxorTr4RYKb u+g8n2z89TJnuOgFxAGA27FYTbajPTXw7+PCruYdF3JuFraH/yuJA7tGfSXrO8y0Uk6i 18O8iNhKJ3voB5kSGIcjWN01pd4VmY25EccJSr1Inhd8tztlX1NgNQbpCYctwNJYfOAO nBoQ== X-Gm-Message-State: APjAAAVNrsrWZOGDWbuTVoSA9ts+Zz0vvOcpUfKXEinJhcMi2Do4LmYr pqdzv5KGYvvob56XWImo6rHtJT5V7nY= X-Google-Smtp-Source: APXvYqzpK9IyHKSLdBrMDF07SsQz1o6gcwyCZ+2QtZJxqZuIadrMt0hRe78sfMD18JqiSTHkspAwsw== X-Received: by 2002:a6b:6619:: with SMTP id a25mr34558402ioc.131.1558152089117; Fri, 17 May 2019 21:01:29 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:49 -0600 Message-Id: <20190518040054.230179-20-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 19/24] binman: Update 'text' entry for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This code reads a binary value and then uses it as a string to look up another value. Add conversions to make this work as expected on Python 3. Signed-off-by: Simon Glass --- tools/binman/etype/text.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py index c4aa510a87b..9ee04d7c9d8 100644 --- a/tools/binman/etype/text.py +++ b/tools/binman/etype/text.py @@ -7,6 +7,7 @@ from collections import OrderedDict from entry import Entry, EntryArg import fdt_util +import tools class Entry_text(Entry): @@ -48,9 +49,11 @@ class Entry_text(Entry): """ def __init__(self, section, etype, node): Entry.__init__(self, section, etype, node) - self.text_label, = self.GetEntryArgsOrProps( - [EntryArg('text-label', str)]) - self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)]) + label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)]) + self.text_label = tools.ToStr(label) if type(label) != str else label + value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)]) + value = tools.ToBytes(value) if value is not None else value + self.value = value def ObtainContents(self): if not self.value: From patchwork Sat May 18 04:00:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101357 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DNnk3sgg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wv12YRXz9s4Y for ; Sat, 18 May 2019 14:11:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 05C6CC21DF8; Sat, 18 May 2019 04:10:04 +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_MSPIKE_H2, 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 210A1C21EA8; Sat, 18 May 2019 04:02:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 08906C21E15; Sat, 18 May 2019 04:01:34 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id D9619C21DD7 for ; Sat, 18 May 2019 04:01:30 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id i63so15190326ita.3 for ; Fri, 17 May 2019 21:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4spe2R833PVUbatrjoVHwP0KBi0UTP1EDq0DZAFWnJo=; b=DNnk3sgg1v/Xt/PvS1XYNUxJDGIGR5zX5F+lRpMJQsTbx2PbOfWZN2kyfH0K7TYA6i EHoECf1YOI0+M9ZJftvxI+OSDs/ACfMxGLLeg94I8vs7o1pwpOE/pvfOAs8i6gW2swEx ffwzTNg9iHOw5ZR/KpIXapd+gWaeOLUIIyCI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4spe2R833PVUbatrjoVHwP0KBi0UTP1EDq0DZAFWnJo=; b=ihLQoCScTOw+2gA1ZmO3eM5QVV4/4NKXKijsVFVyp8F7WCKG9V0yJP9eizuThNvnJs 0s6Z8QKBjwELHblLnH+uaOPGHQZ5TirfPMN8fcSDSbpcSpWieg+dVW/J1c0ogSOoDAK5 tDgtt2IMiZnEXqQ0NO7/CGPpMKfmFazNEG0D4i0moahiyB/9K2ZRW/o3zceMKVwr+ge0 MWpMtacZU+Ov0PP4EpbULI8gxmVZSqKB7HUsOZbWCYcMfnZ/ULbJIG02gNOg/a6q4Dzw 2nt+2kpcfA41JdHFA6t/hAhTYZw3Wv3zrHI+IWXNfMTLQIxYLyVNpBEAw/2D76yB/4zw sn/A== X-Gm-Message-State: APjAAAXbEtCui57QArn6sK3ZraxFG/++oDSODGV+4kv1exo1qh/1ZkEo M/T/79byw1AcqH4p8oQ07mq6qois5JE= X-Google-Smtp-Source: APXvYqyCN4leEZmylVWq/lbSrkd+GIfnwWmW5+yqokdRbdFOzt1Kxsx1AA84lB90hTs2s95n+SeHxw== X-Received: by 2002:a24:9412:: with SMTP id j18mr5294535ite.124.1558152089772; Fri, 17 May 2019 21:01:29 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:50 -0600 Message-Id: <20190518040054.230179-21-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 20/24] binman: Fix up a format string in AssertInList() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add the missing 's' to the required '%s' here. Signed-off-by: Simon Glass --- tools/binman/ftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 48fec501790..d0a8b751a2c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -395,7 +395,7 @@ class TestFunctional(unittest.TestCase): for grep in grep_list: if grep in target: return - self.fail("Error: '%' not found in '%s'" % (grep_list, target)) + self.fail("Error: '%s' not found in '%s'" % (grep_list, target)) def CheckNoGaps(self, entries): """Check that all entries fit together without gaps From patchwork Sat May 18 04:00:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101354 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HXUHPBkc"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WtC3Wv7z9s4Y for ; Sat, 18 May 2019 14:10:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E3502C21DED; Sat, 18 May 2019 04:09:13 +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_MSPIKE_H2, 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 CC6FFC21D74; Sat, 18 May 2019 04:02:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 53D8FC21E85; Sat, 18 May 2019 04:01:35 +0000 (UTC) Received: from mail-it1-f195.google.com (mail-it1-f195.google.com [209.85.166.195]) by lists.denx.de (Postfix) with ESMTPS id 88945C21E0F for ; Sat, 18 May 2019 04:01:31 +0000 (UTC) Received: by mail-it1-f195.google.com with SMTP id q65so15094982itg.2 for ; Fri, 17 May 2019 21:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l7H5RZoG6AT/FQQbtdUwjQPSTEA1zO90PgIY+pMmK48=; b=HXUHPBkciXonz2/8XmGNyaySG6tZeKCMUxvm1abIjfw5Bo7Q+/Md2trr9Cle/thUrL LozpZXebEMMl/Qd1Ozz9Fs5sFmLSPUglNLh7FuyAUTxSJSC7z61qWpecHjQmBidRTez5 gxwvjMGEI2pOik6+cXuXC+bEjTcHT1COo9Vwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l7H5RZoG6AT/FQQbtdUwjQPSTEA1zO90PgIY+pMmK48=; b=mEZcMPi1v5u/v5vp/K0kWm6juxj6rtzOPuCETN0iQpwS30VvVOwHfR98i1PDOY9WvN 2mFD97K10H1qkgugHR/AvIJ/huq91rNPSsZjkOCTOwKUCcoPJpwrgJf5w+u2Fc7rZW/5 UquWbUKtu6WT1PVIcMsQpZ3UENVUw1GM4dQHfdiCF3rmHA8ICYv8zxVUZTWlMJaXxpB6 LgNrNVL2M2i0quGKHM8VxteUX6v5CDBJUOjxqwHCh+UpnAn7XtQN9DiMzafROuKDNNI+ Po5wVyrkuIBhGg8u5IXwxz31MgZvixLuDirbP5bu11yu7ABOQrKFUY20dcrfRCZ8bqTn gfsQ== X-Gm-Message-State: APjAAAW03cQKPyh+S/RAuMkRr1t/pu9rzUuKOEHNSKr0r6LA/qXHLnA9 dcn6W+AVqZ6xooeSsL2kEwgBoz8i0PA= X-Google-Smtp-Source: APXvYqyJbrV/3ZkwUHloRjjNB6rDfsoEGGgFkky97CRTjjrQbovehOsG8APJSgnip4jdHsrSxhfNRg== X-Received: by 2002:a24:1f06:: with SMTP id d6mr13215737itd.166.1558152090388; Fri, 17 May 2019 21:01:30 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:51 -0600 Message-Id: <20190518040054.230179-22-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 21/24] binman: Read map files as text 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" These files are text files so should be read as such, so that string-equality assertions work as expected. With this binman tests work correctly on Python 2 and Python 3: PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt \ python ./tools/binman/binman -t Change first line of binman.py to end "python3": PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman \ python3 ./tools/binman/binman -t Signed-off-by: Simon Glass --- tools/binman/ftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index d0a8b751a2c..cc57ef3e04a 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1777,7 +1777,7 @@ class TestFunctional(unittest.TestCase): # We should not get an inmage, but there should be a map file self.assertFalse(os.path.exists(tools.GetOutputFilename('image.bin'))) self.assertTrue(os.path.exists(map_fname)) - map_data = tools.ReadFile(map_fname) + map_data = tools.ReadFile(map_fname, binary=False) self.assertEqual('''ImagePos Offset Size Name 00000000 00000007 main-section 00000000 00000004 u-boot From patchwork Sat May 18 04:00:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101363 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="X7m2U+hI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455WxF593dz9s3q for ; Sat, 18 May 2019 14:13:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6688BC21DF3; Sat, 18 May 2019 04:07:07 +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_MSPIKE_H2, 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 927D3C21E08; Sat, 18 May 2019 04:01:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E07AC21DF3; Sat, 18 May 2019 04:01:35 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id 18103C21D56 for ; Sat, 18 May 2019 04:01:32 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id e184so15223418ite.1 for ; Fri, 17 May 2019 21:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dAqjtjI1eja5Kt/4G79r4n6fr7/FRSXqWlcHE4RQj10=; b=X7m2U+hIaQQeuJTep/yPwcAP1H26mH29kpw5ZzCnXdA9CP3vCkkmd4aVP0BecyDr0y 59gnWhxnqio21qko6E9BSEaXyL1M8NzWmtRhWBNLtB+OI3+Omt9MzzIKwS4qrK00TkI1 g0eb1aeNfN8XmoLUtQ232mWozTLE+7MLyUzg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dAqjtjI1eja5Kt/4G79r4n6fr7/FRSXqWlcHE4RQj10=; b=Xx2bski1PGr9Edk6YIveIdiokuQCY6VW/3JVYL9HjTjaq9Gqw3k3J8T8P4qriELmfI drTL2DZhiMzKYODHZgA/Il4LBnkXxzn1tb5G/I1UjT8+aU1Wl91/Zt1U97ydnL/tDmwZ r57I43D8rVgRTHi11f5osSH5NUcPbMH1ifJzSLnbdy24Zzg1iC6okYGWlCCeLZ8OPxAM GLLh2oLMwdmPVlIaqxDM1ObA0onSrC2pqZ6mV9fA8UrFDrDa6bVkzLGvlaOcwzZujB/a Iv3k4P5tqsnpcjC3+rx/CG1PwU8Q9KIbnY3ZrtvN9zA98OsPN9oLMXtuybreC53dc4Vg tZQw== X-Gm-Message-State: APjAAAXCwpTcObsSinCd4wUOR02N+XrJ0KUXQt4z/nkgVUePn5aK4RwC 9iVsUSDGnR9e0Yqf6tawvgVvjiB2xcQ= X-Google-Smtp-Source: APXvYqzkTimBxXgujtce2YrVFzyOLXeUeECEX9bvn4nvEOpkO8ZQiz3+11ttPzvhzhDY0PHDy6jZKQ== X-Received: by 2002:a24:6588:: with SMTP id u130mr5536043itb.138.1558152090993; Fri, 17 May 2019 21:01:30 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:52 -0600 Message-Id: <20190518040054.230179-23-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 22/24] binman: Document parallel tests 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since binman can run tests in parallel, document this. Signed-off-by: Simon Glass --- tools/binman/README | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/binman/README b/tools/binman/README index 927fa856acf..ac193f16cf7 100644 --- a/tools/binman/README +++ b/tools/binman/README @@ -702,6 +702,20 @@ To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): $ sudo apt-get install python-coverage python-pytest +Concurrent tests +---------------- + +Binman tries to run tests concurrently. This means that the tests make use of +all available CPUs to run. + + To enable this: + + $ sudo apt-get install python-subunit python3-subunit + +Use '-P 1' to disable this. It is automatically disabled when code coverage is +being used (-T) since they are incompatible. + + Advanced Features / Technical docs ---------------------------------- From patchwork Sat May 18 04:00:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101365 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="MSHyuNYX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wyx1rdRz9s3q for ; Sat, 18 May 2019 14:15:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EDDC3C21D72; Sat, 18 May 2019 04:09:01 +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=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 2B7C7C21E76; Sat, 18 May 2019 04:02:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 51755C21E4F; Sat, 18 May 2019 04:01:37 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id C7FB8C21E29 for ; Sat, 18 May 2019 04:01:32 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id x24so7067898ion.5 for ; Fri, 17 May 2019 21:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CQmRz/yBEtPNvbWaIVw523j4eM9MAQvhitHKnakGtnw=; b=MSHyuNYX7m/2W1pl1Z+05wghhbg5dTm2Dt+HuAvBbeADCSc0dfeo6nFP6bUtbjLhBk hc5AIu3s0JM2DTo59/73NSDk4+O2lfmmg3G/hsAGm8yOF+LybftoY1RcuuGDjqhMpCYg 9s2yBvhVH2eBJctgAE6ynAif28biMK8j97LKU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CQmRz/yBEtPNvbWaIVw523j4eM9MAQvhitHKnakGtnw=; b=TaGH3MMxnbSKHwv3ZXpinyexpCuIQfT9oiIzWt25fxE/WywNBq64Hp0cQmwgQMVyha c1bSgER7K+EUKah1Q7tZLb7Fe2vEa+Xska4Skhi/4w4pYvNbkWOoztPbYQHvuh+XuzBa T3ntymd5+p9xPd4tROq0I0fXTIih/g854Yk4BN3wWsUE46OrXlU/9TH9EKCl4FdJhe1Y VZJCTkrxIdV798yk536ZkRegiB9C2BHNHMAktUmc/1t3aoyennrDFEwySuXC5ukUp7sb n0dTgflXox16/peYPl9HgTlCLYNkdy4Nkg+9MsepFxcC8RcGR87bRJXnBZbzPkq4MaKr 5hAw== X-Gm-Message-State: APjAAAXREGYS8PlSPy/FhFfANdB+MOvOuC59W15KE4hcngqNBNWRxM3M eI7t7ij4124TrwvRCYlvR2Hl/hLLjJ4= X-Google-Smtp-Source: APXvYqwyR4lsKDdYHdOAAPtpYXmw8I4736ihodrBudCIE+9UdazxiXU/3fLkIrwjSUDPFXDju+AXwg== X-Received: by 2002:a6b:3fd7:: with SMTP id m206mr37037871ioa.120.1558152091681; Fri, 17 May 2019 21:01:31 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:53 -0600 Message-Id: <20190518040054.230179-24-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 23/24] binman: Update the README.entries file 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" A few minor changes have been made including one new entry. Update the documentation with: $ binman -E >tools/binman/README.entries Signed-off-by: Simon Glass --- tools/binman/README.entries | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/binman/README.entries b/tools/binman/README.entries index 9fc2f83280e..357946d6305 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -224,6 +224,20 @@ See README.x86 for information about x86 binary blobs. +Entry: intel-refcode: Entry containing an Intel Reference Code file +------------------------------------------------------------------- + +Properties / Entry arguments: + - filename: Filename of file to read into entry + +This file contains code for setting up the platform on some Intel systems. +This is executed by U-Boot when needed early during startup. A typical +filename is 'refcode.bin'. + +See README.x86 for information about x86 binary blobs. + + + Entry: intel-vbt: Entry containing an Intel Video BIOS Table (VBT) file ----------------------------------------------------------------------- @@ -627,6 +641,7 @@ Entry: vblock: An entry which contains a Chromium OS verified boot block ------------------------------------------------------------------------ Properties / Entry arguments: + - content: List of phandles to entries to sign - keydir: Directory containing the public keys to use - keyblock: Name of the key file to use (inside keydir) - signprivate: Name of provide key file to use (inside keydir) From patchwork Sat May 18 04:00:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1101364 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" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PNES79Is"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 455Wxm00Twz9s3q for ; Sat, 18 May 2019 14:14:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B6D04C21E1D; Sat, 18 May 2019 04:09:52 +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_MSPIKE_H2, 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 57D3BC21E44; Sat, 18 May 2019 04:02:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 952AFC21E15; Sat, 18 May 2019 04:01:37 +0000 (UTC) Received: from mail-it1-f193.google.com (mail-it1-f193.google.com [209.85.166.193]) by lists.denx.de (Postfix) with ESMTPS id 6620FC21D9A for ; Sat, 18 May 2019 04:01:33 +0000 (UTC) Received: by mail-it1-f193.google.com with SMTP id g71so15177769ita.5 for ; Fri, 17 May 2019 21:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lR/BQ2rMxdAjH5/da7lYg3LhPfgTr7DXEkkWb6ajV58=; b=PNES79IskRMZpD/yaRQLT+VQSwhfeQ8yEIkqQBK29hb5B1gcjDDWFmYIPxfkBq8dBo 7fBUHGLGaGabmPeCGc62LVlyz5c16rNDmv5zhm8WXnIdYC/LpU0BJotmDLN3vh1fTqQ6 3e1NJSvep6nQp0sPRWQ6YgqgnbvrBBqmoo2iU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lR/BQ2rMxdAjH5/da7lYg3LhPfgTr7DXEkkWb6ajV58=; b=shAoaaPXnjAJD8Wx/qe5Vd7KzmEuzMFqEPXccdFHRlepVGTFosJCPkWvTRI1HLQ5NP xA2czJBkjCE+YN+dInhH2asFZd6XUUP+7RtxUEDDyiiuTHbGqe/x5v/l2L+ZGKnrz2pU 2HStdQa8AGhMmw4jOUVAbvbSqfWheLjya9wZoheuB/f3XhcCb0VyIt09dQY7XN4aJugR 86SfB9zfD1pIvFrn+x5NryhUctwT3C5FjItMzLbVep88Rn5wWIHRpUmlI0uTyncyIeBm JTXFYJ5+Q7D6zIfukdet1+GD+w5pg6aitykAg2dN2tl7+xxC07j4A0wwt7OaIiTdnlOc uNLw== X-Gm-Message-State: APjAAAVwZvjaCYISUixMFemD0NFDexQynw9tkvbKcJMcWWhGZ2BrWGMK d39JmYruPRMvHdgZDJwOdtcZ7+LRHIk= X-Google-Smtp-Source: APXvYqydFLPVLDYvRIGERq7Xp5H+Nm+cz5CvjLBftrgcFxxDeL2vc/uhvCaDk0DCUsEbYvYl2g2m/A== X-Received: by 2002:a05:660c:552:: with SMTP id w18mr19125887itk.26.1558152092287; Fri, 17 May 2019 21:01:32 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e7sm1284986itc.44.2019.05.17.21.01.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 21:01:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 17 May 2019 22:00:54 -0600 Message-Id: <20190518040054.230179-25-sjg@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190518040054.230179-1-sjg@chromium.org> References: <20190518040054.230179-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 24/24] patman: Update cover-coverage tests for Python 3 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We need slightly different commands to run code coverage with Python 3. Update the RunTestCoverage() function to handle this. Signed-off-by: Simon Glass --- tools/patman/test_util.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index e462ec8f72b..ea36cd16339 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -17,6 +17,8 @@ try: except ImportError: from io import StringIO +PYTHON = 'python%d' % sys.version_info[0] + def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): """Run tests and check that we get 100% coverage @@ -43,11 +45,12 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): else: glob_list = [] glob_list += exclude_list - glob_list += ['*libfdt.py', '*site-packages*'] - cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools python-coverage run ' - '--omit "%s" %s -P1 -t' % (build_dir, ','.join(glob_list), prog)) + glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*'] + cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run ' + '--omit "%s" %s -P1 -t' % (build_dir, PYTHON, ','.join(glob_list), + prog)) os.system(cmd) - stdout = command.Output('python-coverage', 'report') + stdout = command.Output('%s-coverage' % PYTHON, 'report') lines = stdout.splitlines() if required: # Convert '/path/to/name.py' just the module name 'name' @@ -65,8 +68,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): print(coverage) if coverage != '100%': print(stdout) - print("Type 'python-coverage html' to get a report in " - 'htmlcov/index.html') + print("Type '%s-coverage html' to get a report in " + 'htmlcov/index.html' % PYTHON) print('Coverage error: %s, but should be 100%%' % coverage) ok = False if not ok: