From patchwork Sun Sep 23 22:47:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973765 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JMvT57zFz9rxp for ; Mon, 24 Sep 2018 08:48:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 53F42C21F05; Sun, 23 Sep 2018 22:47: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=none 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 798AEC21F45; Sun, 23 Sep 2018 22:47:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6FF23C21F3D; Sun, 23 Sep 2018 22:47:40 +0000 (UTC) Received: from mail-oi0-f73.google.com (mail-oi0-f73.google.com [209.85.218.73]) by lists.denx.de (Postfix) with ESMTPS id 1624EC21E89 for ; Sun, 23 Sep 2018 22:47:35 +0000 (UTC) Received: by mail-oi0-f73.google.com with SMTP id e15-v6so2515215oie.16 for ; Sun, 23 Sep 2018 15:47:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qDqb5fJDLP1dfRloVU8wmYgD+xCvpLQ8ZmW5d+tq39w=; b=q/8vzSnBYsExTpEtOP6m8AxNpVSZDT8WLUX7cvs84E1QtfQN8Nm2L6+HKlkuaXN/yZ PlFy0CDs/xqi86ClovY5wzqHmQGRifoi0A3rVjCpMF8gJTnkhXkyXXpEcHyaTMhHCsJg 7lPdbaJKiyhu6oeZOuE0NNm+32lt4gK/QuRYa349edJpeM+tX+Flel1FfCo2e87eT1P2 M0z5AIs48vl1DrEeTHIRSRL9fCWR0e5rpZDsQefP3cW3HV2JfZEm0QMmS438uT9WyWBu nVBUR2CiQM7Fr+brkGalsyHSTQq4uLEiRrFmhZ8G1MasI/7FpnFttFo9jeAV0spDywX9 kQpA== X-Gm-Message-State: APzg51DcTn7CBJA4rMrPC88rcMPD+eX8fUYNx98ySw32FqgxSIoKW8SW KgXGEBZPbBl+GqaYEmh4B3r0tgw= X-Google-Smtp-Source: ANB0VdZ7ME2RZmkAzUcUx+rB8tvvjyn1vAzbhwX6L7zD8x3yBtxN+xzPsCk3n27FTuj7PTKB2AG6akY= X-Received: by 2002:aca:4c13:: with SMTP id z19-v6mr8258883oia.52.1537742853937; Sun, 23 Sep 2018 15:47:33 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:13 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-2-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH 01/15] sandbox: Unprotect DATA regions in bus 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" On my Ubuntu 18.04.1 machine two driver-model bus tests have started failing recently. The problem appears to be that the DATA region of the executable is protected. This does not seem correct, but perhaps there is a reason. To work around it, unprotect the regions in these tests before accessing them. Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 11 +++++++++++ include/os.h | 11 +++++++++++ test/dm/bus.c | 12 ++++++++++++ 3 files changed, 34 insertions(+) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 5839932b005..8b860959f05 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -651,3 +651,14 @@ void os_longjmp(ulong *jmp, int ret) { longjmp((struct __jmp_buf_tag *)jmp, ret); } + +int os_mprotect_allow(void *start, size_t len) +{ + int page_size = getpagesize(); + + /* Move start to the start of a page, len to the end */ + start = (void *)(((ulong)start) & ~(page_size - 1)); + len = (len + page_size * 2) & ~(page_size - 1); + + return mprotect(start, len, PROT_READ | PROT_WRITE); +} diff --git a/include/os.h b/include/os.h index c8e0f52d306..54b6044df29 100644 --- a/include/os.h +++ b/include/os.h @@ -351,4 +351,15 @@ int os_setjmp(ulong *jmp, int size); */ void os_longjmp(ulong *jmp, int ret); +/** + * os_mprotect_allow() - Remove write-protection on a region of memory + * + * The start and length will be page-aligned before use. + * + * @start: Region start + * @len: Region length in bytes + * @return 0 if OK, -1 on error from mprotect() + */ +int os_mprotect_allow(void *start, size_t len); + #endif diff --git a/test/dm/bus.c b/test/dm/bus.c index e9a4028f047..08137a2216a 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -4,6 +4,9 @@ */ #include +#ifdef CONFIG_SANDBOX +#include +#endif #include #include #include @@ -297,6 +300,11 @@ static int dm_test_bus_parent_data_uclass(struct unit_test_state *uts) ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus)); drv = (struct driver *)bus->driver; size = drv->per_child_auto_alloc_size; + +#ifdef CONFIG_SANDBOX + os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv)); + os_mprotect_allow(drv, sizeof(*drv)); +#endif bus->uclass->uc_drv->per_child_auto_alloc_size = size; drv->per_child_auto_alloc_size = 0; ret = test_bus_parent_data(uts); @@ -440,6 +448,10 @@ static int dm_test_bus_parent_platdata_uclass(struct unit_test_state *uts) ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus)); drv = (struct driver *)bus->driver; size = drv->per_child_platdata_auto_alloc_size; +#ifdef CONFIG_SANDBOX + os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv)); + os_mprotect_allow(drv, sizeof(*drv)); +#endif bus->uclass->uc_drv->per_child_platdata_auto_alloc_size = size; drv->per_child_platdata_auto_alloc_size = 0; ret = test_bus_parent_platdata(uts); From patchwork Sun Sep 23 22:47:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973767 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JMwv6vQnz9rxp for ; Mon, 24 Sep 2018 08:50:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 85B1EC21EFB; Sun, 23 Sep 2018 22:48:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none 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 4BAF5C21F48; Sun, 23 Sep 2018 22:47:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B32D2C21F31; Sun, 23 Sep 2018 22:47:40 +0000 (UTC) Received: from mail-oi0-f73.google.com (mail-oi0-f73.google.com [209.85.218.73]) by lists.denx.de (Postfix) with ESMTPS id 801C1C21F0B for ; Sun, 23 Sep 2018 22:47:36 +0000 (UTC) Received: by mail-oi0-f73.google.com with SMTP id l14-v6so18050806oii.9 for ; Sun, 23 Sep 2018 15:47:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=E0ZKQLGoTtTXshuAQIN5Gk5ywIkQ5llqd3TT3jGErUs=; b=f6SufTFmdMyriXA3EfjOwSF0ojxcXbXqg35I1pzmwwBsSt2QZ+Xke8aQ2PP//EslcJ MFkjLLQGQiziGJ7hnxwEi/e2VTDfzVsh6Iz9ojS3neM2jXmokoqm9v71TLWtQpEprBqY UzB3wD3MmCxK2y7J1AQ6oAvNvGfm/1H/Qbfuv0eDVUuH6nCmimyh9MmpfkP6hvSD0VwC 69mlxcbYtKQDAEpyK899YkoaAeekYmCZjI28zJWQhv0SwNbjZfwKockMdrlsSv6mnqEL ABm6GhVBOvhFNvXHK1DTPu+4UCIpwvDWP1lmf7hTsPK1UxO4OY3e674g+0CDf2gZhyIi nzPg== X-Gm-Message-State: APzg51BVX7hoFT2n+M/kFTe3ChpGK+DJtwDQe/lsehxj1eNQ7Frohoss irAsMtFA9XVX4gqsYr3otuF7Org= X-Google-Smtp-Source: ANB0VdY8VqzYD9lE0hasEl/D+1uqv5KIBVeph9VjQGmljmyELBP08KiNF81nFJN0Gth/bYTs5iKtSRE= X-Received: by 2002:aca:c48e:: with SMTP id u136-v6mr8476394oif.33.1537742855539; Sun, 23 Sep 2018 15:47:35 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:14 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-3-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 02/15] patman: Handle unicode in _ProjectConfigParser 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" With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately started returning unicode, for unknown reasons. Adjust the code to handle this by converting everything to unicode. We cannot convert things to ASCII since email addresses may be encoded with UTF-8. Signed-off-by: Simon Glass --- tools/patman/settings.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/patman/settings.py b/tools/patman/settings.py index ca4334426ba..ea2bc74f759 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -58,25 +58,25 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): >>> config = _ProjectConfigParser("zzz") >>> config.readfp(StringIO(sample_config)) >>> config.get("alias", "enemies") - 'Evil ' + u'Evil ' # Check to make sure that alias gets overridden by project. >>> config = _ProjectConfigParser("sm") >>> config.readfp(StringIO(sample_config)) >>> config.get("alias", "enemies") - 'Green G. ' + u'Green G. ' # Check to make sure that settings get merged with project. >>> config = _ProjectConfigParser("linux") >>> config.readfp(StringIO(sample_config)) >>> sorted(config.items("settings")) - [('am_hero', 'True'), ('process_tags', 'False')] + [(u'am_hero', u'True'), (u'process_tags', u'False')] # Check to make sure that settings works with unknown project. >>> config = _ProjectConfigParser("unknown") >>> config.readfp(StringIO(sample_config)) >>> sorted(config.items("settings")) - [('am_hero', 'True')] + [(u'am_hero', u'True')] """ def __init__(self, project_name): """Construct _ProjectConfigParser. @@ -99,6 +99,17 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): for setting_name, setting_value in project_defaults.items(): self.set(project_settings, setting_name, setting_value) + def _to_unicode(self, val): + """Make sure a value is of type 'unicode' + + Args: + val: string or unicode object + + Returns: + unicode version of val + """ + return val if isinstance(val, unicode) else val.decode('utf-8') + def get(self, section, option, *args, **kwargs): """Extend SafeConfigParser to try project_section before section. @@ -108,14 +119,15 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): See SafeConfigParser. """ try: - return ConfigParser.SafeConfigParser.get( + val = ConfigParser.SafeConfigParser.get( self, "%s_%s" % (self._project_name, section), option, *args, **kwargs ) except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): - return ConfigParser.SafeConfigParser.get( + val = ConfigParser.SafeConfigParser.get( self, section, option, *args, **kwargs ) + return self._to_unicode(val) def items(self, section, *args, **kwargs): """Extend SafeConfigParser to add project_section to section. @@ -150,7 +162,8 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): item_dict = dict(top_items) item_dict.update(project_items) - return item_dict.items() + return {(self._to_unicode(item), self._to_unicode(val)) + for item, val in item_dict.iteritems()} def ReadGitAliases(fname): """Read a git alias file. This is in the form used by git: From patchwork Sun Sep 23 22:47:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973766 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JMw92bQ0z9rxp for ; Mon, 24 Sep 2018 08:49:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id F3A71C21E50; Sun, 23 Sep 2018 22:48:37 +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=none 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 0AD9EC21F50; Sun, 23 Sep 2018 22:47:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CB970C21F48; Sun, 23 Sep 2018 22:47:42 +0000 (UTC) Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) by lists.denx.de (Postfix) with ESMTPS id 89609C21F3B for ; Sun, 23 Sep 2018 22:47:38 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id m13-v6so37075908ioq.9 for ; Sun, 23 Sep 2018 15:47:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8TydoUHD9dK03v71p2QsBRw666jYkvHD/k4srkivM98=; b=S8OgXjnoX//RE9HJrVxCzSynZFT2Xn2nrnANBn4b8oytCrbK930svyiEfBvZDm+4M6 1PlUK7CXHiwH7K/40Vk2IKUHbUZxmm88NknuTJhz5VuvRfVgLGLqtIP7xuGE9isc6MsF qIW6rKWl8agUToM+2H+ijgVa6Z3pt2Gty1M0jrt04/eyMJlzY8Bqp04S9AbjZxeLXPmq kCCm5vRDlT86Y/3a12cQ0NS3YMYr9bJDSdWPtmOlrltz335xO801X6k+EFhIWr9QOdop PiLQVnp9Z0lWXl+mAw7MgdGIGaUCNcm+NTmsKUDMJETwEpmhdqjvkWJkV6ka1z0kDUtJ i3mg== X-Gm-Message-State: ABuFfoh0JsL7Pung7ylKzZKgP7nr4rs0OsmplUX17WsMPaPsNSsLLnNN SB3y0q6QgZvQ3RigowkZOQSKg6w= X-Google-Smtp-Source: ACcGV60AhOnngjvnbqdwwoZtMwUBeNzO72UGFW/RC7Cm7Emjl2us3zQ9uYm5jkFJDquu8epkqLB12Tw= X-Received: by 2002:a6b:c5c5:: with SMTP id v188-v6mr6151941iof.91.1537742857285; Sun, 23 Sep 2018 15:47:37 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:15 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-4-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 03/15] test/py: Fix unicode handling for log filtering 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 unicode filtering seems to get confused at times with this error: UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 32: ordinal not in range(128) It seems to be due to self._nonprint being interpreted as UTF-8. Fix it by using ordinals instead of characters, changing the string to set. Signed-off-by: Simon Glass Reviewed-by: Stephen Warren --- test/py/multiplexed_log.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py index f23d5dec68c..637a3bd257b 100644 --- a/test/py/multiplexed_log.py +++ b/test/py/multiplexed_log.py @@ -314,8 +314,9 @@ $(document).ready(function () { # The set of characters that should be represented as hexadecimal codes in # the log file. - _nonprint = ('%' + ''.join(chr(c) for c in range(0, 32) if c not in (9, 10)) + - ''.join(chr(c) for c in range(127, 256))) + _nonprint = {ord('%')} + _nonprint.update({c for c in range(0, 32) if c not in (9, 10)}) + _nonprint.update({c for c in range(127, 256)}) def _escape(self, data): """Render data format suitable for inclusion in an HTML document. @@ -331,7 +332,7 @@ $(document).ready(function () { """ data = data.replace(chr(13), '') - data = ''.join((c in self._nonprint) and ('%%%02x' % ord(c)) or + data = ''.join((ord(c) in self._nonprint) and ('%%%02x' % ord(c)) or c for c in data) data = cgi.escape(data) return data From patchwork Sun Sep 23 22:47:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973778 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN4z5PQCz9sBq for ; Mon, 24 Sep 2018 08:57:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7D337C21F80; Sun, 23 Sep 2018 22:50:22 +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=none 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 7855BC21F49; Sun, 23 Sep 2018 22:48:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 41E36C21F24; Sun, 23 Sep 2018 22:47:44 +0000 (UTC) Received: from mail-oi0-f74.google.com (mail-oi0-f74.google.com [209.85.218.74]) by lists.denx.de (Postfix) with ESMTPS id E99C6C21F1D for ; Sun, 23 Sep 2018 22:47:39 +0000 (UTC) Received: by mail-oi0-f74.google.com with SMTP id m197-v6so17841580oig.18 for ; Sun, 23 Sep 2018 15:47:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Q+SVHVM7yFyCpELt2XGQKuISg9B8hFu42f3zXfwkY9M=; b=a/f38X5f5bk8YqmKttLgxvXHFH1lI/hB1oCWbUgbUhh9GkKyQ3cxRFjjY0SVXf2W49 eie6qd8cr9AIWJS49l73oTsrEBjoA46aY7NbFTy/Q3KUrXheG8q/hPjFY6IHRnVaGiqE ELfBAEn+Zksnyxhdd6nyOBHj3EvKVw5l2dsv7GKOtqCDFMxFcCFBeWwXs6YgCNoVX7Hh TOX5uS8zYH2dSvGoDTuzb6+uFHUcUz1fu5cfN9RBtUsAEf7VHN5UjiYVZXMAWUPhKrjG Cn/n6rbl59qB43OiiLq0UMTGIBUdCpPZJvhU9SQ3K/MMd/cTNjuvmQGzFujLdzA3KwH4 zC2w== X-Gm-Message-State: APzg51BH3Nt+3hdFlnePMLzhcrgqj9Su9EvGCwz3+qDcOly26XeBYkM3 P9mAaqHAr2ruRLmFmsJaRMh3j5w= X-Google-Smtp-Source: ANB0Vdb99GPuBb1p1pLrH2i3eXKjnjzm+KYzg9AZGROQ/RjXRjDrWK7dNVDJUCaXu36f+LfYpcpBWB4= X-Received: by 2002:aca:e807:: with SMTP id f7-v6mr8319591oih.62.1537742858941; Sun, 23 Sep 2018 15:47:38 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:16 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-5-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 04/15] buildman: Make the toolchain test more forgiving 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 filenames of the toolchains on kernel.org changes every now and then. Fix it for the current change, and make the test use a regex so that it has a better chance of passing with future changes too. Signed-off-by: Simon Glass --- tools/buildman/test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index c36bcdf6fb7..7259f7b6507 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -422,8 +422,10 @@ class TestBuild(unittest.TestCase): def testToolchainDownload(self): """Test that we can download toolchains""" if use_network: - self.assertEqual('https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/x86_64-gcc-4.9.0-nolibc_arm-unknown-linux-gnueabi.tar.xz', - self.toolchains.LocateArchUrl('arm')) + url = self.toolchains.LocateArchUrl('arm') + self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/' + 'crosstool/files/bin/x86_64/.*/' + 'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz') if __name__ == "__main__": From patchwork Sun Sep 23 22:47:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973770 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN0W6DSMz9s9N for ; Mon, 24 Sep 2018 08:53:15 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 78580C21F77; Sun, 23 Sep 2018 22:49:51 +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=none 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 A18D7C21F68; Sun, 23 Sep 2018 22:48:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 48BA6C21F74; Sun, 23 Sep 2018 22:47:46 +0000 (UTC) Received: from mail-oi0-f73.google.com (mail-oi0-f73.google.com [209.85.218.73]) by lists.denx.de (Postfix) with ESMTPS id AFA3FC21F01 for ; Sun, 23 Sep 2018 22:47:41 +0000 (UTC) Received: by mail-oi0-f73.google.com with SMTP id p11-v6so17926457oih.17 for ; Sun, 23 Sep 2018 15:47:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Uo5lLdfaJc4qI/kF16vw52M4B0cPSSfckdsubCa2q64=; b=g1iuTSF6mXe471V3sRbpbz2H9MMwIFrIE+V83xXCf4Q+0qfNJdabo1C8kN1mkNJaP2 9/7BIBSJYRMu83ULY5oc1+pR5WRa7uu2mPsEqB/Ym2BOfeD7pmhwaKcNaX6NmMggR26G 9XaMkWbe49D/irlqtnbBdp/7MtA920CY3juqvp3cfQJixCBIurXJdOvs7iNHE9/FAtiT cWKo0iO66c9p7mCl7ajIkvEq13pdPfH0usp91GhlyCYOk9vBQsV2MwE9ML/K2XDQwnmj f1fwf+QoRKiarwf1RCt+gRBZn9Fgn89/OVCWzIzaGEe/rkNQUGkH8DH3hM0nvdoKZueN oJaA== X-Gm-Message-State: APzg51A1wTFFnB/KNtbGr8+Z+UzyLd39Vtn3eFzJvCzWDYeXMGJfeTel eH3wVkBieqlcb8P64fy4DioBmy0= X-Google-Smtp-Source: ANB0Vdbfmr6pXLgOfSrv7gCrxWqKKMiX2bu6KoeY5z9HXcIHcLwACNINXBke/Fl/TRVcNS0LORX9d18= X-Received: by 2002:aca:8ce:: with SMTP id 197-v6mr8490254oii.58.1537742860750; Sun, 23 Sep 2018 15:47:40 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:17 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-6-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 05/15] binman: Reorder tests to put helper functions first 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 some helper functions are mixed in with the tests. Tidy this up by moving them to the top. For the few helpers that don't need to be full class members, make them nested functions. Signed-off-by: Simon Glass --- tools/binman/ftest.py | 249 +++++++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 125 deletions(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index a8456c26157..aafdaff9700 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -369,6 +369,111 @@ class TestFunctional(unittest.TestCase): AddNode(dtb.GetRoot(), '') return tree + def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False): + """Handle running a test for insertion of microcode + + Args: + dts_fname: Name of test .dts file + nodtb_data: Data that we expect in the first section + ucode_second: True if the microsecond entry is second instead of + third + + Returns: + Tuple: + Contents of first region (U-Boot or SPL) + Offset and size components of microcode pointer, as inserted + in the above (two 4-byte words) + """ + data = self._DoReadFile(dts_fname, True) + + # Now check the device tree has no microcode + if ucode_second: + ucode_content = data[len(nodtb_data):] + ucode_pos = len(nodtb_data) + dtb_with_ucode = ucode_content[16:] + fdt_len = self.GetFdtLen(dtb_with_ucode) + else: + dtb_with_ucode = data[len(nodtb_data):] + fdt_len = self.GetFdtLen(dtb_with_ucode) + ucode_content = dtb_with_ucode[fdt_len:] + ucode_pos = len(nodtb_data) + fdt_len + fname = tools.GetOutputFilename('test.dtb') + with open(fname, 'wb') as fd: + fd.write(dtb_with_ucode) + dtb = fdt.FdtScan(fname) + ucode = dtb.GetNode('/microcode') + self.assertTrue(ucode) + for node in ucode.subnodes: + self.assertFalse(node.props.get('data')) + + # Check that the microcode appears immediately after the Fdt + # This matches the concatenation of the data properties in + # the /microcode/update@xxx nodes in 34_x86_ucode.dts. + ucode_data = struct.pack('>4L', 0x12345678, 0x12345679, 0xabcd0000, + 0x78235609) + self.assertEqual(ucode_data, ucode_content[:len(ucode_data)]) + + # Check that the microcode pointer was inserted. It should match the + # expected offset and size + pos_and_size = struct.pack('<2L', 0xfffffe00 + ucode_pos, + len(ucode_data)) + u_boot = data[:len(nodtb_data)] + return u_boot, pos_and_size + + def _RunPackUbootSingleMicrocode(self): + """Test that x86 microcode can be handled correctly + + We expect to see the following in the image, in order: + u-boot-nodtb.bin with a microcode pointer inserted at the correct + place + u-boot.dtb with the microcode + an empty microcode region + """ + # We need the libfdt library to run this test since only that allows + # finding the offset of a property. This is required by + # Entry_u_boot_dtb_with_ucode.ObtainContents(). + data = self._DoReadFile('35_x86_single_ucode.dts', True) + + second = data[len(U_BOOT_NODTB_DATA):] + + fdt_len = self.GetFdtLen(second) + third = second[fdt_len:] + second = second[:fdt_len] + + ucode_data = struct.pack('>2L', 0x12345678, 0x12345679) + self.assertIn(ucode_data, second) + ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA) + + # Check that the microcode pointer was inserted. It should match the + # expected offset and size + 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) + + def _PackUbootSplMicrocode(self, dts, ucode_second=False): + """Helper function for microcode tests + + We expect to see the following in the image, in order: + u-boot-spl-nodtb.bin with a microcode pointer inserted at the + correct place + u-boot.dtb with the microcode removed + the microcode + + Args: + dts: Device tree file to use for test + ucode_second: True if the microsecond entry is second instead of + third + """ + # ELF file with a '_dt_ucode_base_size' symbol + with open(self.TestFile('u_boot_ucode_ptr')) as fd: + TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + 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) + def testRun(self): """Test a basic run with valid args""" result = self._RunBinman('-h') @@ -756,57 +861,6 @@ class TestFunctional(unittest.TestCase): data = self._DoReadFile('33_x86-start16.dts') self.assertEqual(X86_START16_DATA, data[:len(X86_START16_DATA)]) - def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False): - """Handle running a test for insertion of microcode - - Args: - dts_fname: Name of test .dts file - nodtb_data: Data that we expect in the first section - ucode_second: True if the microsecond entry is second instead of - third - - Returns: - Tuple: - Contents of first region (U-Boot or SPL) - Offset and size components of microcode pointer, as inserted - in the above (two 4-byte words) - """ - data = self._DoReadFile(dts_fname, True) - - # Now check the device tree has no microcode - if ucode_second: - ucode_content = data[len(nodtb_data):] - ucode_pos = len(nodtb_data) - dtb_with_ucode = ucode_content[16:] - fdt_len = self.GetFdtLen(dtb_with_ucode) - else: - dtb_with_ucode = data[len(nodtb_data):] - fdt_len = self.GetFdtLen(dtb_with_ucode) - ucode_content = dtb_with_ucode[fdt_len:] - ucode_pos = len(nodtb_data) + fdt_len - fname = tools.GetOutputFilename('test.dtb') - with open(fname, 'wb') as fd: - fd.write(dtb_with_ucode) - dtb = fdt.FdtScan(fname) - ucode = dtb.GetNode('/microcode') - self.assertTrue(ucode) - for node in ucode.subnodes: - self.assertFalse(node.props.get('data')) - - # Check that the microcode appears immediately after the Fdt - # This matches the concatenation of the data properties in - # the /microcode/update@xxx nodes in 34_x86_ucode.dts. - ucode_data = struct.pack('>4L', 0x12345678, 0x12345679, 0xabcd0000, - 0x78235609) - self.assertEqual(ucode_data, ucode_content[:len(ucode_data)]) - - # Check that the microcode pointer was inserted. It should match the - # expected offset and size - pos_and_size = struct.pack('<2L', 0xfffffe00 + ucode_pos, - len(ucode_data)) - u_boot = data[:len(nodtb_data)] - return u_boot, pos_and_size - def testPackUbootMicrocode(self): """Test that x86 microcode can be handled correctly @@ -821,38 +875,6 @@ class TestFunctional(unittest.TestCase): self.assertEqual('nodtb with microcode' + pos_and_size + ' somewhere in here', first) - def _RunPackUbootSingleMicrocode(self): - """Test that x86 microcode can be handled correctly - - We expect to see the following in the image, in order: - u-boot-nodtb.bin with a microcode pointer inserted at the correct - place - u-boot.dtb with the microcode - an empty microcode region - """ - # We need the libfdt library to run this test since only that allows - # finding the offset of a property. This is required by - # Entry_u_boot_dtb_with_ucode.ObtainContents(). - data = self._DoReadFile('35_x86_single_ucode.dts', True) - - second = data[len(U_BOOT_NODTB_DATA):] - - fdt_len = self.GetFdtLen(second) - third = second[fdt_len:] - second = second[:fdt_len] - - ucode_data = struct.pack('>2L', 0x12345678, 0x12345679) - self.assertIn(ucode_data, second) - ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA) - - # Check that the microcode pointer was inserted. It should match the - # expected offset and size - 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) - def testPackUbootSingleMicrocode(self): """Test that x86 microcode can be handled correctly with fdt_normal. """ @@ -968,28 +990,6 @@ class TestFunctional(unittest.TestCase): data = self._DoReadFile('48_x86-start16-spl.dts') self.assertEqual(X86_START16_SPL_DATA, data[:len(X86_START16_SPL_DATA)]) - def _PackUbootSplMicrocode(self, dts, ucode_second=False): - """Helper function for microcode tests - - We expect to see the following in the image, in order: - u-boot-spl-nodtb.bin with a microcode pointer inserted at the - correct place - u-boot.dtb with the microcode removed - the microcode - - Args: - dts: Device tree file to use for test - ucode_second: True if the microsecond entry is second instead of - third - """ - # ELF file with a '_dt_ucode_base_size' symbol - with open(self.TestFile('u_boot_ucode_ptr')) as fd: - TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) - 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) - def testPackUbootSplMicrocode(self): """Test that x86 microcode can be handled correctly in SPL""" self._PackUbootSplMicrocode('49_x86_ucode_spl.dts') @@ -1272,19 +1272,18 @@ class TestFunctional(unittest.TestCase): self.assertIn("'fill' entry must have a size property", str(e.exception)) - def _HandleGbbCommand(self, pipe_list): - """Fake calls to the futility utility""" - if pipe_list[0][0] == 'futility': - fname = pipe_list[0][-1] - # Append our GBB data to the file, which will happen every time the - # futility command is called. - with open(fname, 'a') as fd: - fd.write(GBB_DATA) - return command.CommandResult() - def testGbb(self): """Test for the Chromium OS Google Binary Block""" - command.test_result = self._HandleGbbCommand + def _HandleGbbCommand(pipe_list): + """Fake calls to the futility utility""" + if pipe_list[0][0] == 'futility': + fname = pipe_list[0][-1] + # Append our GBB data to the file, which will happen every time + # the futility command is called. + with open(fname, 'a') as fd: + fd.write(GBB_DATA) + return command.CommandResult() + command.test_result = _HandleGbbCommand entry_args = { 'keydir': 'devkeys', 'bmpblk': 'bmpblk.bin', @@ -1309,17 +1308,17 @@ class TestFunctional(unittest.TestCase): self.assertIn("Node '/binman/gbb': GBB must have a fixed size", str(e.exception)) - def _HandleVblockCommand(self, pipe_list): - """Fake calls to the futility utility""" - if pipe_list[0][0] == 'futility': - fname = pipe_list[0][3] - with open(fname, 'w') as fd: - fd.write(VBLOCK_DATA) - return command.CommandResult() - def testVblock(self): """Test for the Chromium OS Verified Boot Block""" - command.test_result = self._HandleVblockCommand + def _HandleVblockCommand(pipe_list): + """Fake calls to the futility utility""" + if pipe_list[0][0] == 'futility': + fname = pipe_list[0][3] + with open(fname, 'w') as fd: + fd.write(VBLOCK_DATA) + return command.CommandResult() + + command.test_result = _HandleVblockCommand entry_args = { 'keydir': 'devkeys', } From patchwork Sun Sep 23 22:47:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973772 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN180TQrz9s9N for ; Mon, 24 Sep 2018 08:53:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BBE9FC21F41; Sun, 23 Sep 2018 22:49: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=none 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 C4EBCC21E89; Sun, 23 Sep 2018 22:47:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A38AAC21E89; Sun, 23 Sep 2018 22:47:48 +0000 (UTC) Received: from mail-ot1-f73.google.com (mail-ot1-f73.google.com [209.85.210.73]) by lists.denx.de (Postfix) with ESMTPS id 6007AC21F2A for ; Sun, 23 Sep 2018 22:47:43 +0000 (UTC) Received: by mail-ot1-f73.google.com with SMTP id s69-v6so18660654ota.13 for ; Sun, 23 Sep 2018 15:47:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=vrCKggKisUvResLLITLRcjW5Kh50x9p+GO5MSIIsjPE=; b=j3pYIVxZu7vdTsSGznEPELRcRmm6zVtxSXxz0mME3FuL2JRyatc53ycG38gNuUaXp+ o8XBH9tEz9AgGXHUQC9YVwRxdp2y2lFE9bNA9pVN6Z3H+XPQMbiNtkvEB73WeDi4ioP2 DKQ+i6qgTbLcZtEGid6CNlm1YqppCYll6/Nk20N1eq+50pObso2C4Rxxv8yU0pqT3z1z coCxGvKChHy0eI4uZ4+cTJI0/5ZWBTXM6A4s4cLoUYNTsw0roaZu4Kbf2CaPh4XNvaTx Z/gtEtG3JhG82qZv30HxQW5YgWkfTuRp+RZYwZshRi8zF4X/yv/31Cx0Q0q7O7ptxm+/ Gpyw== X-Gm-Message-State: APzg51DgXm4MVqzuq/S6TNSuN/ts8ptHnuWxTmjZeiyKRI6VEVF32JSI eiCIMhG2ePbwvBi14P9M06Pu954= X-Google-Smtp-Source: ACcGV61hm3CILpOD7IrEdTiOsn3V7UcEG2FOJn5jKTKyeGCVb1zar3b3znwzIjHxG3a2sF0BD8xX3UY= X-Received: by 2002:a9d:2ee5:: with SMTP id w92-v6mr1013422ota.96.1537742862336; Sun, 23 Sep 2018 15:47:42 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:18 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-7-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Baruch Siach , Stephen Warren , Heinrich Schuchardt Subject: [U-Boot] [PATCH 06/15] Makefile: Add a 'check' target for make 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 we use 'make tests' to run the tests. For many projects 'make check' is more common, so support that as well. Also add some help to 'make help'. Signed-off-by: Simon Glass --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e38966edbaa..af537241f0c 100644 --- a/Makefile +++ b/Makefile @@ -1674,6 +1674,10 @@ help: @echo 'Configuration targets:' @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help @echo '' + @echo 'Test targets:' + @echo '' + @echo ' check - Run all automated tests that use sandbox' + @echo '' @echo 'Other generic targets:' @echo ' all - Build all necessary images depending on configuration' @echo ' tests - Build U-Boot for sandbox and run tests' @@ -1712,7 +1716,7 @@ help: @echo 'Execute "make" or "make all" to build all targets marked with [*] ' @echo 'For further info see the ./README file' -tests: +tests check: $(srctree)/test/run # Documentation targets From patchwork Sun Sep 23 22:47:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973777 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN4j33jzz9s7T for ; Mon, 24 Sep 2018 08:56:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1209BC21F9F; Sun, 23 Sep 2018 22:48:57 +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=none 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 E914EC21EB1; Sun, 23 Sep 2018 22:47:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BCF26C21F5E; Sun, 23 Sep 2018 22:47:49 +0000 (UTC) Received: from mail-io1-f74.google.com (mail-io1-f74.google.com [209.85.166.74]) by lists.denx.de (Postfix) with ESMTPS id 16D16C21F1D for ; Sun, 23 Sep 2018 22:47:45 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id x5-v6so36661955ioa.6 for ; Sun, 23 Sep 2018 15:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=OLcNuCg1f6Z7aJ14GxmCYOIBabYigDe4tmFJBwfgFDE=; b=jcf2uwtYlRP8gipviGSuUFN8Hmf5W77gBIKKLDZAsTcKcUK8kR4TI4pFrPgXpfahG1 6PT/jFpWuGS0LsTVosqxGS7ETwGC2Wx+2HAfhp8c+PuBUK6+JxAcChGaEefZYV590OzK QwBwoHHeoBvd1anuDkMhV1dk23fgMdvo2kE+QRk6Nw3BMEtJVb6Pw84bAgKSzFEmCiq8 Wc5IPMdcmQ2IA+7G/d7gOh/fEpJSrgtiwCBZsV46GYbgA3tnhJL6wlR6wSsj40JKtGZE Cs9HeMg7v0H7+ui+siqSNavk7dcRJWuLnK7lxQMZg/eUfBjbmbHHtcncxhAu38uQQbYK mfKg== X-Gm-Message-State: ABuFfoh8Tpy9DLOZ3ckH69+72teG84edifzX/NHD7tk62ChA+N3ZrHT7 kXbuKl+srwa/94MydU8X7pfp5CA= X-Google-Smtp-Source: ACcGV63pWaJYKvGFN5b8qRs7iCIIpHHTbnlh5wkLvFSqEQsqPj/nAxZHqTgc/zB6wd3RpOCZm4EqO5g= X-Received: by 2002:a24:b30f:: with SMTP id e15-v6mr5328733itf.48.1537742863995; Sun, 23 Sep 2018 15:47:43 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:19 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-8-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 07/15] test: Simplify the PATH setup 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 'export' to avoid repeating the path setup for each command. Signed-off-by: Simon Glass --- test/run | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/run b/test/run index d77a1c371b4..6b73813f9bc 100755 --- a/test/run +++ b/test/run @@ -16,23 +16,23 @@ run_test ./test/py/test.py --bd sandbox_spl --build -k test_ofplatdata.py # Run tests for the flat DT version of sandbox ./test/py/test.py --bd sandbox_flattree --build +# Set up a path to dtc (device-tree compiler) and libfdt.py, a library it +# provides and which is built by the sandbox_spl config. DTC_DIR=build-sandbox_spl/scripts/dtc +export PYTHONPATH=${DTC_DIR}/pylibfdt +export DTC=${DTC_DIR}/dtc -PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \ - ./tools/binman/binman -t +run_test ./tools/binman/binman -t run_test ./tools/patman/patman --test run_test ./tools/buildman/buildman -t -PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test ./tools/dtoc/dtoc -t +run_test ./tools/dtoc/dtoc -t # This needs you to set up Python test coverage tools. # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): # $ sudo apt-get install python-pytest python-coverage -PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \ - ./tools/binman/binman -T -PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \ - ./tools/dtoc/dtoc -T -PYTHONPATH=${DTC_DIR}/pylibfdt DTC=${DTC_DIR}/dtc run_test \ - ./tools/dtoc/test_fdt -T +run_test ./tools/binman/binman -T +run_test ./tools/dtoc/dtoc -T +run_test ./tools/dtoc/test_fdt -T if [ $result == 0 ]; then echo "Tests passed!" From patchwork Sun Sep 23 22:47:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973768 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JMz71CZXz9s5c for ; Mon, 24 Sep 2018 08:52:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C2CB3C21F67; Sun, 23 Sep 2018 22:49:33 +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=none 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 E1105C21F69; Sun, 23 Sep 2018 22:47:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 597BBC21F60; Sun, 23 Sep 2018 22:47:50 +0000 (UTC) Received: from mail-io1-f73.google.com (mail-io1-f73.google.com [209.85.166.73]) by lists.denx.de (Postfix) with ESMTPS id 93F2CC21F60 for ; Sun, 23 Sep 2018 22:47:46 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id k9-v6so36740412iob.16 for ; Sun, 23 Sep 2018 15:47:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=gdDpg/1g7L/U5uJ1PrWKY6OyOuDI/T0rnDOwRSiWW/4=; b=oWW5R+e2XxiAeFDgcrXp5HkGlKPzfTa1mrkZ5SabbiD31KVX8y38SO8KlWL0G2MIQB 7syorhBtjCLEN0c+6xmxkq3EacMQbc+GE1lksy7CCPNI4g/S3oOMea8Kza9HJYhrBnxW 8pHx8uZnJpyRWv7s9TeFVykk64FF315+pPpgG60/zEjAq9W7FSeI09fVSpxCcN0jHDfu 6PcSeJqBPA+Y920ec8wGCdR1F1sVBAA6D/QZd7fOaYr+DQOB0ssefGme4WlGDG72itdp R7FXd1OBz63PfUB9T86bzQOS/iaCZvxdI/YAe6VU+AVFsA36thQMD7ijjY3gx/r1KB8Z pHPw== X-Gm-Message-State: APzg51CaCyJCgMEsHb3Qdkwl6pRFyQk5JtgD7DjuaxI5dylUy+VITKbH zu/CC+dXBQ92/YTw4tP6UzK7VGA= X-Google-Smtp-Source: ANB0VdbgG55Ou1TxLIHvGhpf+xd5zo8e2ML1dWecU8Mk217+LqahEhTrbMqatC9g96WlVjSjWqFuwKo= X-Received: by 2002:a24:5249:: with SMTP id d70-v6mr6335751itb.0.1537742865650; Sun, 23 Sep 2018 15:47:45 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:20 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-9-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 08/15] test: Print the name of each test before running it 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 tests are run without any indication of what is running. For the tests which start with a build this is pretty obvious, but for tools it is not. Add a name for each test we run, and print it before starting the test. Signed-off-by: Simon Glass --- test/run | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/run b/test/run index 6b73813f9bc..b997d4bc2a4 100755 --- a/test/run +++ b/test/run @@ -1,6 +1,13 @@ #!/bin/bash +# Script to run all U-Boot tests that use sandbox. + +# Runs a test and checks the exit code to decide if it passed +# $1: Test name +# $2 onwards: command line to run run_test() { + echo -n "$1: " + shift $@ [ $? -ne 0 ] && result=$((result+1)) } @@ -8,13 +15,14 @@ run_test() { result=0 # Run all tests that the standard sandbox build can support -run_test ./test/py/test.py --bd sandbox --build +run_test "sandbox" ./test/py/test.py --bd sandbox --build # Run tests which require sandbox_spl -run_test ./test/py/test.py --bd sandbox_spl --build -k test_ofplatdata.py +run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \ + -k test_ofplatdata.py # Run tests for the flat DT version of sandbox -./test/py/test.py --bd sandbox_flattree --build +run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it # provides and which is built by the sandbox_spl config. @@ -22,17 +30,17 @@ DTC_DIR=build-sandbox_spl/scripts/dtc export PYTHONPATH=${DTC_DIR}/pylibfdt export DTC=${DTC_DIR}/dtc -run_test ./tools/binman/binman -t -run_test ./tools/patman/patman --test -run_test ./tools/buildman/buildman -t -run_test ./tools/dtoc/dtoc -t +run_test "binman" ./tools/binman/binman -t +run_test "patman" ./tools/patman/patman --test +run_test "buildman" ./tools/buildman/buildman -t +run_test "dtoc" ./tools/dtoc/dtoc -t # This needs you to set up Python test coverage tools. # To enable Python test coverage on Debian-type distributions (e.g. Ubuntu): # $ sudo apt-get install python-pytest python-coverage -run_test ./tools/binman/binman -T -run_test ./tools/dtoc/dtoc -T -run_test ./tools/dtoc/test_fdt -T +run_test "binman code coverage" ./tools/binman/binman -T +run_test "dtoc code coverage" ./tools/dtoc/dtoc -T +run_test "fdt code coverage" ./tools/dtoc/test_fdt -T if [ $result == 0 ]; then echo "Tests passed!" From patchwork Sun Sep 23 22:47:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973774 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN2z63w0z9sBZ for ; Mon, 24 Sep 2018 08:55:23 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8A82CC21EE7; Sun, 23 Sep 2018 22:51: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=RCVD_IN_MSPIKE_H2 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 442E4C21F71; Sun, 23 Sep 2018 22:48:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C9063C21F81; Sun, 23 Sep 2018 22:47:56 +0000 (UTC) Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by lists.denx.de (Postfix) with ESMTPS id 8C900C21F0F for ; Sun, 23 Sep 2018 22:47:48 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id o18-v6so8135262ybp.13 for ; Sun, 23 Sep 2018 15:47:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=GpfStFa+VrDpAMLw8WBN8MLA9u7Z+bGhiXKsR2k7Erc=; b=H+PiwD8IoCDp7U2Ou6ebALf3JOJ6aKWl8Jfo667EtGLyPkaq1jFVMNBcjBap1zv2pF ZzFwqi5NRrbb5BK2Ja+HxlyRL7gD9r93f66rKiSEFWK8SL5jqyPIUdA5/F4Co/Btcee4 yXqexWF5HIqKWqjXEeFe8+/6M7iPDliueE8rTlKh21KentO5URgDtaDrLFDfMN1Xtsl2 91xpAMG5QIvS0W6pesHFObmriKqQZYMgcetEj3tTdWmzLTBMpvyzeaHUkkgOVF506S4T QsUp99Mwn2/Jc3NJ6Rhg2zwDUM5MvSYre1D/4sSg3EoN3PJsDAW+UBmUTKeDCcWUoC1r w26w== X-Gm-Message-State: ABuFfojQipheyNmI5wOhIYH/OhcLnvVNER73rnpCUcG6ymdUu4ZFKfVz cIAjGW18zP0243taYKyJvoFvPQg= X-Google-Smtp-Source: ACcGV60OHadZtQlIhwaor5/fDXdofqKLOA6HZFumzDkgMhVd9TqMwFNnssYjsol/uHhmGaAgI5a2j4I= X-Received: by 2002:a25:cd04:: with SMTP id d4-v6mr227372ybf.50.1537742867446; Sun, 23 Sep 2018 15:47:47 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:21 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-10-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 09/15] test: Tidy up comments and variable name 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 'result' variable counts the number of failures in running the tests. Rename it to 'failures' to make this more obvious. Also tidy up a few comments. Signed-off-by: Simon Glass --- test/run | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/run b/test/run index b997d4bc2a4..73e6869fa2b 100755 --- a/test/run +++ b/test/run @@ -9,10 +9,10 @@ run_test() { echo -n "$1: " shift $@ - [ $? -ne 0 ] && result=$((result+1)) + [ $? -ne 0 ] && failures=$((failures+1)) } -result=0 +failures=0 # Run all tests that the standard sandbox build can support run_test "sandbox" ./test/py/test.py --bd sandbox --build @@ -21,7 +21,10 @@ run_test "sandbox" ./test/py/test.py --bd sandbox --build run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \ -k test_ofplatdata.py -# Run tests for the flat DT version of sandbox +# Run tests for the flat-device-tree version of sandbox. This is a special +# build which does not enable CONFIG_OF_LIVE for the live device tree, so we can +# check that functionality is the same. The standard sandbox build (above) uses +# CONFIG_OF_LIVE. run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build # Set up a path to dtc (device-tree compiler) and libfdt.py, a library it @@ -33,6 +36,7 @@ export DTC=${DTC_DIR}/dtc run_test "binman" ./tools/binman/binman -t run_test "patman" ./tools/patman/patman --test run_test "buildman" ./tools/buildman/buildman -t +run_test "fdt" ./tools/dtoc/test_fdt -t run_test "dtoc" ./tools/dtoc/dtoc -t # This needs you to set up Python test coverage tools. @@ -42,7 +46,7 @@ run_test "binman code coverage" ./tools/binman/binman -T run_test "dtoc code coverage" ./tools/dtoc/dtoc -T run_test "fdt code coverage" ./tools/dtoc/test_fdt -T -if [ $result == 0 ]; then +if [ $failures == 0 ]; then echo "Tests passed!" else echo "Tests FAILED" From patchwork Sun Sep 23 22:47:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973775 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN3g4t0Xz9sBZ for ; Mon, 24 Sep 2018 08:55:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 50C48C21FA1; Sun, 23 Sep 2018 22:50:40 +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=none 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 873A0C21F24; Sun, 23 Sep 2018 22:48:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 17E8CC21F4D; Sun, 23 Sep 2018 22:47:55 +0000 (UTC) Received: from mail-oi0-f74.google.com (mail-oi0-f74.google.com [209.85.218.74]) by lists.denx.de (Postfix) with ESMTPS id 18C0FC21F31 for ; Sun, 23 Sep 2018 22:47:50 +0000 (UTC) Received: by mail-oi0-f74.google.com with SMTP id p11-v6so17926691oih.17 for ; Sun, 23 Sep 2018 15:47:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=u4Q61cmwxS5NG+HoikpFaqIFlT0t/CBxyKGEhwJ785A=; b=Ji8See+NcL3H8WFLh9BwDqYjLlNvPwXtsOlzlB24cSJGhS2QM1eYH4nma4ypOovNmu N5pZ8kaFia+//SbwnQ5KzTSFBkHS2msdA9qw8YGyEwpAiuFrWrMc+hGi+sTCbZXCV6Ti Z5VUxMtUdMrtubVHhGtM4Yo3SEmfCylFIhjYIHKxJ+mlM07XO+Hz80eXQBesnPgtQedt e6C+JRAB94zgn60UHk2PGvdNfztrpphz1+En/KmiYSdKit/TxDyn4SbcDTJSh1thNtv2 DsdWVPjrDsR4WZzTuIRm4WBlpfkkjK9ywadi+IVSM9c34zvTV4IoyYa0hnR36GlWmm/K szLg== X-Gm-Message-State: ABuFfohXnXcUlV3oqSrSPnnNJDcfe1i72YAddZpcScaVlFvwq6C8FP2O VlBxyF3qZpeVaH1n2BePGbuyvdY= X-Google-Smtp-Source: ACcGV61GfTpAc5qBiXwpsXGStUKeTularpkcC5YzE1cghGzp57FP4/e7o2oy3hvLwqaEG+ztrp9IrLw= X-Received: by 2002:a9d:30a1:: with SMTP id s33-v6mr8093439otc.107.1537742869101; Sun, 23 Sep 2018 15:47:49 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:22 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-11-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 10/15] binman: Add a default path to libfdt.py 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 module is often available in the sandbox_spl build created by 'make check'. Use this as a default path so that just typing 'binman -t' (without setting PYTHONPATH) will generally run the tests. Signed-off-by: Simon Glass --- tools/binman/binman.py | 2 ++ tools/dtoc/dtoc.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/tools/binman/binman.py b/tools/binman/binman.py index 1536e956517..f5af5359f3c 100755 --- a/tools/binman/binman.py +++ b/tools/binman/binman.py @@ -22,6 +22,8 @@ for dirname in ['../patman', '../dtoc', '..']: # Bring in the libfdt module sys.path.insert(0, 'scripts/dtc/pylibfdt') +sys.path.insert(0, os.path.join(our_path, + '../../build-sandbox_spl/scripts/dtc/pylibfdt')) import cmdline import command diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py index 827094e72ab..33b2589c561 100755 --- a/tools/dtoc/dtoc.py +++ b/tools/dtoc/dtoc.py @@ -34,6 +34,11 @@ import unittest our_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(our_path, '../patman')) +# Bring in the libfdt module +sys.path.insert(0, 'scripts/dtc/pylibfdt') +sys.path.insert(0, os.path.join(our_path, + '../../build-sandbox_spl/scripts/dtc/pylibfdt')) + import dtb_platdata import test_util From patchwork Sun Sep 23 22:47:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973769 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN046rvPz9s9N for ; Mon, 24 Sep 2018 08:52:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 94456C21F4A; Sun, 23 Sep 2018 22:52:05 +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 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 76ADEC21F48; Sun, 23 Sep 2018 22:48:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 58B64C21F64; Sun, 23 Sep 2018 22:47:56 +0000 (UTC) Received: from mail-vk1-f201.google.com (mail-vk1-f201.google.com [209.85.221.201]) by lists.denx.de (Postfix) with ESMTPS id 4258EC21F01 for ; Sun, 23 Sep 2018 22:47:52 +0000 (UTC) Received: by mail-vk1-f201.google.com with SMTP id h81-v6so3658514vke.13 for ; Sun, 23 Sep 2018 15:47:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=EJ7/AbJE6o5LyAmArJmWBV8Pc+/azLshgmnN7w4bxTE=; b=DcNWtbR3RuC/NBdx1fYBq6uWpQCiA7xGq8WzGQgW8sY47baUwkFhNmwhFgDHI81Pmc CeZfmYdG77kMppF3cENpNGL0QaQv/ScmoghfhExPweMm7nJPsOvzWZpHE4Ee60v7/x1g XBDgtu84CBTa3YpKQ3t4gj3LDZkSSXwbax//9oRXBFpauPHS7P2nM8mT9ysUyQGrJk39 CAyxUOHXmG2Ua26QlMgfppx+1GY6NgPpDDA76//oC3BpBItYqSVi9Sa8gYRZZ7/2atz8 2P+Uw1ClMOT/RKC8gYPFp1wX0eN1N6cVy0EvrCn7n4EZVGGX/L4Oo6/BeW+Q7DGdS1HQ 9+/A== X-Gm-Message-State: APzg51C6++7S/axqqZf5guMipfYV64cSr0hwKMQCsGQyS1GBCZcPsyUl KDrpKagBM5zDHKEzGZl0Z2gpIEU= X-Google-Smtp-Source: ANB0VdZvcGqil/kQMbmzEmvbeUAAApalDMLEZ9ijB76RBqW4Fz3GnCeZ9ASz5Zg4Ncy85gET5CKsMpk= X-Received: by 2002:a67:4bc1:: with SMTP id f62-v6mr631144vsg.4.1537742871005; Sun, 23 Sep 2018 15:47:51 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:23 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-12-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 11/15] binman: Fix up removal of temporary directories 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 'make check' leaves some temporary directories around. Part of this is because we call tools.PrepareOutputDir() twice in some cases, without calling tools.FinaliseOutputDir() in between. Fix this. Signed-off-by: Simon Glass --- tools/binman/elf_test.py | 5 +++++ tools/binman/entry_test.py | 8 ++++++-- tools/binman/fdt_test.py | 4 ++++ tools/binman/ftest.py | 8 +++----- tools/dtoc/test_fdt.py | 10 +++++++--- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py index c16f71401d1..b68530c19ba 100644 --- a/tools/binman/elf_test.py +++ b/tools/binman/elf_test.py @@ -10,6 +10,7 @@ import unittest import elf import test_util +import tools binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) @@ -46,6 +47,10 @@ class FakeSection: class TestElf(unittest.TestCase): + @classmethod + def setUpClass(self): + tools.SetInputDirs(['.']) + def testAllSymbols(self): """Test that we can obtain a symbol from the ELF file""" fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr') diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py index 6fa735ed596..94c4aba88a1 100644 --- a/tools/binman/entry_test.py +++ b/tools/binman/entry_test.py @@ -14,9 +14,14 @@ import fdt_util import tools class TestEntry(unittest.TestCase): + def setUp(self): + tools.PrepareOutputDir(None) + + def tearDown(self): + tools.FinaliseOutputDir() + def GetNode(self): binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) - tools.PrepareOutputDir(None) fname = fdt_util.EnsureCompiled( os.path.join(binman_dir,('test/05_simple.dts'))) dtb = fdt.FdtScan(fname) @@ -35,7 +40,6 @@ class TestEntry(unittest.TestCase): global entry reload(entry) entry.Entry.Create(None, self.GetNode(), 'u-boot-spl') - tools._RemoveOutputDir() del entry def testEntryContents(self): diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index 8ea098f38ae..b9167012d25 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -21,6 +21,10 @@ class TestFdt(unittest.TestCase): self._indir = tempfile.mkdtemp(prefix='binmant.') tools.PrepareOutputDir(self._indir, True) + @classmethod + def tearDownClass(self): + tools._FinaliseForTest() + def TestFile(self, fname): return os.path.join(self._binman_dir, 'test', fname) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index aafdaff9700..92e780e95ef 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -102,7 +102,6 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA) TestFunctional._MakeInputDir('devkeys') TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA) - self._output_setup = False # ELF file with a '_dt_ucode_base_size' symbol with open(self.TestFile('u_boot_ucode_ptr')) as fd: @@ -203,14 +202,13 @@ class TestFunctional(unittest.TestCase): Returns: Contents of device-tree binary """ - if not self._output_setup: - tools.PrepareOutputDir(self._indir, True) - self._output_setup = True + tools.PrepareOutputDir(None) dtb = fdt_util.EnsureCompiled(self.TestFile(fname)) with open(dtb) as fd: data = fd.read() TestFunctional._MakeInputFile(outfile, data) - return data + tools.FinaliseOutputDir() + return data def _DoReadFileDtb(self, fname, use_real_dtb=False, map=False, update_dtb=False, entry_args=None): diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index e88d19f80ef..92c81df1178 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -60,7 +60,7 @@ class TestFdt(unittest.TestCase): @classmethod def tearDownClass(cls): - tools._FinaliseForTest() + tools.FinaliseOutputDir() def setUp(self): self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts') @@ -128,7 +128,7 @@ class TestNode(unittest.TestCase): @classmethod def tearDownClass(cls): - tools._FinaliseForTest() + tools.FinaliseOutputDir() def setUp(self): self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts') @@ -209,7 +209,7 @@ class TestProp(unittest.TestCase): @classmethod def tearDownClass(cls): - tools._FinaliseForTest() + tools.FinaliseOutputDir() def setUp(self): self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts') @@ -362,6 +362,10 @@ class TestFdtUtil(unittest.TestCase): def setUpClass(cls): tools.PrepareOutputDir(None) + @classmethod + def tearDownClass(cls): + tools.FinaliseOutputDir() + def setUp(self): self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts') self.node = self.dtb.GetNode('/spl-test') From patchwork Sun Sep 23 22:47:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973773 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN1F1BnQz9s9N for ; Mon, 24 Sep 2018 08:53:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C5010C21F4A; Sun, 23 Sep 2018 22:51:47 +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 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 7D76DC21F84; Sun, 23 Sep 2018 22:48:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DF1EFC21F81; Sun, 23 Sep 2018 22:47:58 +0000 (UTC) Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by lists.denx.de (Postfix) with ESMTPS id A95D0C21F68 for ; Sun, 23 Sep 2018 22:47:53 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id l4-v6so3577082vkg.7 for ; Sun, 23 Sep 2018 15:47:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=a75MIsrihoGTQv58P00dmpUn+PWXW8n7a1GJWe2b1J8=; b=fFrAP8r90XZI+2mXCoaAPzR/X4fWgk65YJscK5P5T8E87h4aQYje6kF1dKyEQC1w7x Mhv7FUih8MDmwQKuwLDLRSD2o89FtnGeuX2JTj0Ua4PyhjPEMWottfaXtZOg+vrwWz3m 2DfaRLQ3424fGmHjgKdxVCLA628XapVj/FDuOX95EjTgHljlR38CTFbYgEQNdYPjl5c2 phyfljHPbc87SIvwtzxJet+HQdzvrG0l5uHjwvlMySWZOizFrtj11KHbnyLkorD9gI2U 8JwPkqtOxtHK5w8ut5PMMLCFPpFY1765Zr6uQ+v7KHNmwEXSHvdT/Nzhh406u5aguq0p LMuQ== X-Gm-Message-State: ABuFfoiIeRhucloJV6/P5lA/PnrwKvYlftLLUcWpULVjCqh/BjOj97tv o5nQG2ramEMhkKY9w4FB1CJzFMc= X-Google-Smtp-Source: ACcGV60hNfWW37mL33ro5ZwdipRGPSLybwrADdMZ6BXiTY2BRbMo8oCcb7YAiD++h5No/UTdHPKw5u4= X-Received: by 2002:a1f:9b4d:: with SMTP id d74-v6mr2674088vke.65.1537742872794; Sun, 23 Sep 2018 15:47:52 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:24 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-13-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 12/15] binman: Separate out testSplBssPad() 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 runs binman twice, which means that the temporary files from the first run do not get cleaned up. Split this into two tests to fix this problem. Signed-off-by: Simon Glass --- tools/binman/ftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 92e780e95ef..85032b4e46a 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -976,10 +976,12 @@ class TestFunctional(unittest.TestCase): data = self._DoReadFile('47_spl_bss_pad.dts') self.assertEqual(U_BOOT_SPL_DATA + (chr(0) * 10) + U_BOOT_DATA, data) + def testSplBssPadMissing(self): + """Test that a missing symbol is detected""" with open(self.TestFile('u_boot_ucode_ptr')) as fd: TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) with self.assertRaises(ValueError) as e: - data = self._DoReadFile('47_spl_bss_pad.dts') + self._DoReadFile('47_spl_bss_pad.dts') self.assertIn('Expected __bss_size symbol in spl/u-boot-spl', str(e.exception)) From patchwork Sun Sep 23 22:47:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973779 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN5h40Stz9sBq for ; Mon, 24 Sep 2018 08:57:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 46756C21F97; Sun, 23 Sep 2018 22:52:23 +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_H3, RCVD_IN_MSPIKE_WL 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 34120C21F93; Sun, 23 Sep 2018 22:48:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 362F1C21F4E; Sun, 23 Sep 2018 22:48:00 +0000 (UTC) Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by lists.denx.de (Postfix) with ESMTPS id B2B17C21F31 for ; Sun, 23 Sep 2018 22:47:55 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id d12-v6so3321743qtk.13 for ; Sun, 23 Sep 2018 15:47:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=sgWDgSIF5U9djyQbea1lFmm4HGcREbHzH0VeXYROVpU=; b=nGFNKWoZ6jWNZo3T2mGqvAOqDWnOboTwwnngBWxHUQ7/SLBB5ujC+/gyL2JblINSJh WFjgH+Ap5DzEjP6M4BMWAcgrUluEX1SPP1NF1iQlXZ1pML9+lYTbG6j/Yqun2rPPXap0 3pE+4V2Kccj2HJeI54pA/QbfiGlr1S63183cZ6cRuKqZSV+Yzd9l4t3pFGBGtCO++ccf eQ3aKnDB+fX07YPP3GhkKCWaeJvAfWe2lr/yg9e4eAkSDSqQoNvhZdqJMpiwtAr7dSOF UzOdN/rjTJLnkLW0euvJLPl53kd1r663lj3FYclcZwj4HM+Zc8BZ2GyhieE8JPsed2wA ImEw== X-Gm-Message-State: APzg51DQU0Ka3Z1AJYm34vIjpdFiKKENOfKuLsKdaQfEu9tfQG0yyWb8 gHtkYsddD88L1NBh/+6FpcLtClM= X-Google-Smtp-Source: ANB0VdbeG8ml46jHrZTF0kUk0w0xipiWTkkqptBCvPJqYRdwxj/m/r45Da9JzLnMZoh2xMF+jI5tQgI= X-Received: by 2002:ac8:36a3:: with SMTP id a32-v6mr2759923qtc.45.1537742874589; Sun, 23 Sep 2018 15:47:54 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:25 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-14-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 13/15] buildman: dtoc: Suppress unwanted output from test 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" There are a few test cases which print output. Suppress this so that tests can run silently in the normal case. Signed-off-by: Simon Glass --- tools/buildman/test.py | 4 +++- tools/dtoc/test_dtoc.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 7259f7b6507..e0c9d6da6a0 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -20,6 +20,7 @@ import control import command import commit import terminal +import test_util import toolchain use_network = True @@ -422,7 +423,8 @@ class TestBuild(unittest.TestCase): def testToolchainDownload(self): """Test that we can download toolchains""" if use_network: - url = self.toolchains.LocateArchUrl('arm') + with test_util.capture_sys_output() as (stdout, stderr): + url = self.toolchains.LocateArchUrl('arm') self.assertRegexpMatches(url, 'https://www.kernel.org/pub/tools/' 'crosstool/files/bin/x86_64/.*/' 'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz') diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 72bcb37244e..11bead12607 100644 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -385,7 +385,8 @@ U_BOOT_DEVICE(phandle_source2) = { def test_phandle_bad(self): """Test a node containing an invalid phandle fails""" - dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts') + dtb_file = get_dtb_file('dtoc_test_phandle_bad.dts', + capture_stderr=True) output = tools.GetOutputFilename('output') with self.assertRaises(ValueError) as e: dtb_platdata.run_steps(['struct'], dtb_file, False, output) @@ -394,7 +395,8 @@ U_BOOT_DEVICE(phandle_source2) = { def test_phandle_bad2(self): """Test a phandle target missing its #*-cells property""" - dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts') + dtb_file = get_dtb_file('dtoc_test_phandle_bad2.dts', + capture_stderr=True) output = tools.GetOutputFilename('output') with self.assertRaises(ValueError) as e: dtb_platdata.run_steps(['struct'], dtb_file, False, output) From patchwork Sun Sep 23 22:47:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973776 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN4J6DBlz9s7T for ; Mon, 24 Sep 2018 08:56:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 81B1BC21FA6; Sun, 23 Sep 2018 22:50:57 +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=none 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 6218CC21F4D; Sun, 23 Sep 2018 22:48:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 68F01C21F67; Sun, 23 Sep 2018 22:48:03 +0000 (UTC) Received: from mail-it1-f201.google.com (mail-it1-f201.google.com [209.85.166.201]) by lists.denx.de (Postfix) with ESMTPS id 4B1FAC21F05 for ; Sun, 23 Sep 2018 22:47:57 +0000 (UTC) Received: by mail-it1-f201.google.com with SMTP id w132-v6so2692890ita.6 for ; Sun, 23 Sep 2018 15:47:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=oQosbmZXpl5zawXQCmAXRtZlorVMuqQothPOZaNseME=; b=mpQ1pI6CMnhfv4GENXziSw3xfaXc9lsFuZugSXoveJM09DtR1ICXLCMuzJ+LdOb3/j 54ZaMjcHA7091RhBDVtqQ37HPgBv/fRWNrpsxc487JiVgJtneoNVBOOjJ623gyJdj4Yh TX8+nryfWTdE3l77CvGXx6YQ61WeAejS04HwPg56vvG1qaLHrgNoFprWQmIswWqL+7Vk BsYfCrUcTJNes4CtKT4x9SPPNGKobAiAiCLaVWfLy+Ymydf2y5jvkx8pR0Mr81rPqIL3 jxbNHulf0grtpw9t5r1nClgIIrwcRWrNEczRLeWewkZQ4akFDTULTPHrBWpldenb5mFL kjmw== X-Gm-Message-State: ABuFfogNJQ9jH5fQ7NfL9iYDyMIMrWeNMKOwUt8NfGH+vompUMmkoHwl +jFUwWZ5btxVZcYbgRr9M7R42oM= X-Google-Smtp-Source: ACcGV62ANO14ESaFJigf5KxztTSK/99L3R/CdU3S/A1mvHe2n/bojBsFaQc9yJaElxfbiKJ8BtdE/Z4= X-Received: by 2002:a24:7bcb:: with SMTP id q194-v6mr5014824itc.12.1537742876315; Sun, 23 Sep 2018 15:47:56 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:26 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-15-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 14/15] tools: Set an initial value for indir 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 variable is not documented or set up in the module. Fix this. Signed-off-by: Simon Glass --- tools/patman/tools.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/patman/tools.py b/tools/patman/tools.py index e80481438b5..e3da14d1eff 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -22,6 +22,9 @@ chroot_path = None # Search paths to use for Filename(), used to find files search_paths = [] +# List of paths to use when looking for an input file +indir = [] + def PrepareOutputDir(dirname, preserve=False): """Select an output directory, ensuring it exists. From patchwork Sun Sep 23 22:47:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 973771 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 Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42JN140QWlz9s9N for ; Mon, 24 Sep 2018 08:53:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CAB93C21F41; Sun, 23 Sep 2018 22:51: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 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 31447C21F82; Sun, 23 Sep 2018 22:48:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 381E2C21F7E; Sun, 23 Sep 2018 22:48:03 +0000 (UTC) Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by lists.denx.de (Postfix) with ESMTPS id 05AFEC21F64 for ; Sun, 23 Sep 2018 22:47:59 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id n135-v6so3578392vke.17 for ; Sun, 23 Sep 2018 15:47:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=SU9ItMeHyDcfbXcs5250sbusrAC3/FIuOG1WR8KyOfQ=; b=mmQvnyET/I5wO3/43l8VHfLK0XBNIwnn93kyo2BwlWQmhpPqHAtxFfCDUJ6dwJSERP GFxyMnPTnU980qaxog4VlZoC4g8O7qlR6fCgHLm3GljD46M7T9hvNajAavwyPduGzrGx 1pfymtY+TcFxPyCbrSQGaH2tPYvbQHLHZSTCWgAwXTeuzgLMDdCSM4kdC1jh5Eo4eP8k BXJEW15fsOA/Y50vU93QDCqe4eyoXwx5/D0i8gpuDn6ZUtraEGu6mEnkGNSNrFW4dURx OeZJTM0ch2hgK4gHRhlgPtaZYzAYYytLXK9DjxzBwlJbvR2UpA9m/FiX19HZ2fOWESl6 B7SQ== X-Gm-Message-State: APzg51ALlpMCsvxqEhGAYnbAAVx295IYDtnjNk+grFLc+Fr2oAXxcLfb rZ2wyP+DomIqUvhA5LRDDT6rzcc= X-Google-Smtp-Source: ANB0VdY8EFQyCqwuvhpIomMcVPtgLGsg/zhS7ujCofxiMrzbx/bgubjpI5o3poYETIAQmlXShwN0Sjo= X-Received: by 2002:ab0:6654:: with SMTP id b20-v6mr2379017uaq.8.1537742878163; Sun, 23 Sep 2018 15:47:58 -0700 (PDT) Date: Sun, 23 Sep 2018 16:47:27 -0600 In-Reply-To: <20180923224727.204542-1-sjg@chromium.org> Message-Id: <20180923224727.204542-16-sjg@chromium.org> Mime-Version: 1.0 References: <20180923224727.204542-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 15/15] patman: Don't clear progress in tout unless it was used 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 calling Uninit() always called ClearProgress() which outputs a \r character as well as spaces to remove any progress information on the line. This can mess up the normal output of binman and other tools. Fix this by outputing this only when progress information has actually been previous written. Signed-off-by: Simon Glass --- tools/patman/tout.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/patman/tout.py b/tools/patman/tout.py index 4cd49e1c685..4957c7ae1df 100644 --- a/tools/patman/tout.py +++ b/tools/patman/tout.py @@ -15,6 +15,8 @@ NOTICE = 2 INFO = 3 DEBUG = 4 +in_progress = False + """ This class handles output of progress and other useful information to the user. It provides for simple verbosity level control and can @@ -48,9 +50,11 @@ def UserIsPresent(): def ClearProgress(): """Clear any active progress message on the terminal.""" - if verbose > 0 and stdout_is_tty: + global in_progress + if verbose > 0 and stdout_is_tty and in_progress: _stdout.write('\r%s\r' % (" " * len (_progress))) _stdout.flush() + in_progress = False def Progress(msg, warning=False, trailer='...'): """Display progress information. @@ -58,6 +62,7 @@ def Progress(msg, warning=False, trailer='...'): Args: msg: Message to display. warning: True if this is a warning.""" + global in_progress ClearProgress() if verbose > 0: _progress = msg + trailer @@ -65,6 +70,7 @@ def Progress(msg, warning=False, trailer='...'): col = _color.YELLOW if warning else _color.GREEN _stdout.write('\r' + _color.Color(col, _progress)) _stdout.flush() + in_progress = True else: _stdout.write(_progress + '\n')