From patchwork Sat Sep 29 19:23:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976680 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 42Mz731sP5z9s4V for ; Sun, 30 Sep 2018 05:26:23 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EBA23C21F45; Sat, 29 Sep 2018 19:25:55 +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 EB8EEC21F21; Sat, 29 Sep 2018 19:25:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A0647C21F0B; Sat, 29 Sep 2018 19:25:38 +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 9EDFCC21EEF for ; Sat, 29 Sep 2018 19:25:34 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id w19-v6so9332086ioa.10 for ; Sat, 29 Sep 2018 12:25:34 -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=zo3LzR7Q/DXBrqWrsMRSvCODWWFvb7hmsGbMZWHDKYQ=; b=r7rmgEACEt8YgKE+GT55wQ4Ftp3REa9fknA2kr8wMgeoY0WRgniLLRQFubpSK6R8n7 ZDH16iwl+WqoyJ2K7fv9LaVHf2Ipu1y+SW39C4bW7lQ1atdiYsRgIWD63ddf2XbQYPaG 6Zly4KUFfko8W/wF928QZzyLzhmFQFUwsrgRnhruIaVXWwH+M5gyfC9/wHB2FL8HinSA ZIyniKUl7H4Ze6YL2Ji4/8yBjUsq/ovme3sYboHzdSG17wmRx7ETSm8GR1/3P0E/TCET nvrzBK0CpJepGvJgt8N+RwsjT66pvkxp2SF8wiFAmeEgeJZDLIFPhDAlAHT+U2AoUjiL tJlQ== X-Gm-Message-State: ABuFfohaXT6MWY1j1G4PBPqENBMxyUP8d02G3B3vm9IQ7RJRu+fOqtGL IsvKw6wj+as8tocVokdMaj1DI2I= X-Google-Smtp-Source: ACcGV601RGXyTWarvZsUgffuMQORKo4B6rJ+uula/obF0ajQbu2bjeBE/l5xXXuxOi5shj73NUI002Q= X-Received: by 2002:a24:ac64:: with SMTP id m36-v6mr5876281iti.5.1538249133625; Sat, 29 Sep 2018 12:25:33 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:36 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-2-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 01/18] test/py: ignore console read exceptions after test failure 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" From: Stephen Warren After a test has failed, test/py drains the U-Boot console log to ensure that any relevant output is captured. At this point, we don't care about detecting any additional errors, since the test is already known to have failed, and U-Boot will be restarted. To ensure that the test cleanup code is not interrupted, and can correctly terminate the log sections for the failed test, ignore any exception that occurs while reading the U-Boot console output during this limited period of time. Signed-off-by: Stephen Warren Signed-off-by: Simon Glass --- Changes in v2: None test/py/u_boot_console_base.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py index a14bad6e8c5..326b2ac51fb 100644 --- a/test/py/u_boot_console_base.py +++ b/test/py/u_boot_console_base.py @@ -304,7 +304,17 @@ class ConsoleBase(object): # Wait for something U-Boot will likely never send. This will # cause the console output to be read and logged. self.p.expect(['This should never match U-Boot output']) - except u_boot_spawn.Timeout: + except: + # We expect a timeout, since U-Boot won't print what we waited + # for. Squash it when it happens. + # + # Squash any other exception too. This function is only used to + # drain (and log) the U-Boot console output after a failed test. + # The U-Boot process will be restarted, or target board reset, once + # this function returns. So, we don't care about detecting any + # additional errors, so they're squashed so that the rest of the + # post-test-failure cleanup code can continue operation, and + # correctly terminate any log sections, etc. pass finally: self.p.timeout = orig_timeout From patchwork Sat Sep 29 19:23:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976689 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 42MzFn49zRz9s3l for ; Sun, 30 Sep 2018 05:32:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4CEDEC21F4E; Sat, 29 Sep 2018 19:27:09 +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 632F3C21F27; Sat, 29 Sep 2018 19:26:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63180C21E79; Sat, 29 Sep 2018 19:25:40 +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 4A2A1C21F17 for ; Sat, 29 Sep 2018 19:25:36 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id z25-v6so9176968iog.17 for ; Sat, 29 Sep 2018 12:25: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=aNK2fxCRlGzRhjglhytEyteqwf9nwtdUcDfFdVMmiuY=; b=XsX5Qfl1XkF2vQ20peqt9FIQ/RwRWsQBvekQIH/VQDVkRWLZ17orceeHwNlFVZgH5K GSxhPpz7pwCVJzMJWewiGLSSUhwlKVK6G8FVF8CVHt/rgmqUzefNbW4zbUogHYupKf3o DvuM7w8DSNTKAmGWbiCXE+dolcwesDX3qdoDgvPohqHh3JqTln0+H23GzH6uN9+5BWa6 B3QpmL8lYJyfOKbh9dFeyniiTyll9XmXTxloxL2NieEpHv4JtXi+waku8qyXlKn3cY6O 1c8zf6+9J6DBONk6JQVIJGUBdYgDzS/fwI/W2UGH46iBMdNdEey2tma7Mw3qujqyFVYN 2/Jw== X-Gm-Message-State: ABuFfoiQSKP2jzG8ks7YBnCX8eYMLYr8sbHtl1zYTv6YpMtIlsQ98RJg RBM6V/iylgZMDZCYRWjB0/s6+AU= X-Google-Smtp-Source: ACcGV61rwtFPXf8lTRY2GDhNa/Dx6oD8Sn+fKWcpzzpeBbzxtfXOthck+mniK0j689NLCEZU7lhSnww= X-Received: by 2002:a24:1a89:: with SMTP id 131-v6mr1296387iti.3.1538249135304; Sat, 29 Sep 2018 12:25:35 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:37 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-3-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 02/18] 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 --- Changes in v2: None arch/sandbox/cpu/os.c | 11 +++++++++++ include/os.h | 12 ++++++++++++ test/dm/bus.c | 12 ++++++++++++ 3 files changed, 35 insertions(+) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 9fbcb9ef92f..d4d6d78dc74 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -636,3 +636,14 @@ void os_abort(void) { abort(); } + +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 5c797212c25..7116f875780 100644 --- a/include/os.h +++ b/include/os.h @@ -334,4 +334,16 @@ void os_localtime(struct rtc_time *rt); * os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger) */ void os_abort(void); + +/** + * 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 Sat Sep 29 19:23:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976696 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 42MzKl30zLz9s3Z for ; Sun, 30 Sep 2018 05:35:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DD4FBC21F35; Sat, 29 Sep 2018 19:26: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=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 80F7EC21F2F; Sat, 29 Sep 2018 19:25:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DC824C21F17; Sat, 29 Sep 2018 19:25:42 +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 E9B47C21F05 for ; Sat, 29 Sep 2018 19:25:37 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id e140-v6so2338123vkd.11 for ; Sat, 29 Sep 2018 12:25:37 -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=9bC7A/Y60TDJppRh+W+8Vo9rG7pdebJiY2ygkSk3wg4=; b=j2SBNbmepepMK6aSIyuh/r1l9JfPZWdgUYI18HSOGuAz7iThh7kiF67H5t4xMT1yLU baOr+04IdVl/m6kDjBZXQdZ3ydKPXuvq7hjFz/TMtiw5KLj8dya5Zi/wrmIFCZcks8ao nx1r/ItYV/YX0Y2BU+KBtQPZVDZ59X84CoUQpKhGSC+53H37pZHJaQo7jc0witkTpK6+ 4RIN/NJ8TIzKbV/c9URMj8IR1SgJ84A2XLsvOEAHBfl680td88RUAYCarnDz121fHXk1 3An65NEyWLqR47+pepD9mXUcMqw8i4m+oJIxprLHdjEatRMuT6WzuziFIX/yMVFG9wcm wM+g== X-Gm-Message-State: ABuFfohRxT6Kzn+KxlQjuPtJulo6bKg6MY5Qog6iJjyVO4hB2GcW6Yup INeonWEACoz7UH+L02xTUFOF5E8= X-Google-Smtp-Source: ACcGV61NrDCuBOP2lBB5eAkgWmYIRXlyyvVcsPZO73BoRq5hXlxsHdGT2E2dXkvqSPNDjDbro4YDzzw= X-Received: by 2002:a1f:29d7:: with SMTP id p206-v6mr4051391vkp.22.1538249137047; Sat, 29 Sep 2018 12:25:37 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:38 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-4-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 03/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976681 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 42Mz7g0fvrz9s4V for ; Sun, 30 Sep 2018 05:26:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C5B70C21F24; Sat, 29 Sep 2018 19:26:15 +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 9F4CBC21EF2; Sat, 29 Sep 2018 19:25:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A3867C21F1F; Sat, 29 Sep 2018 19:25:44 +0000 (UTC) Received: from mail-ua1-f74.google.com (mail-ua1-f74.google.com [209.85.222.74]) by lists.denx.de (Postfix) with ESMTPS id 18021C21EE7 for ; Sat, 29 Sep 2018 19:25:40 +0000 (UTC) Received: by mail-ua1-f74.google.com with SMTP id a9-v6so1874106uan.23 for ; Sat, 29 Sep 2018 12:25:40 -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=auB5pOOmlnYXqATdfMgYSN1J0v6JMbb3q/pvMNmOTKU=; b=gHq14/ZFNJ674iPGoHD6cpq/uccFqxQe1l8rFgGLi8dSlO+ndKhV6aUo0UZcAzM/TB Lco3K/YbFYdCng7Kr7bt8+TKR1siLMg+YCtwjwjRvUTf241G6QCAE7okRNb+66utpIn+ 0cjDir8rzr6mJ9CBKmK0VhritYVJGbBNs45e3jh8c2oLEpsAVizzQcy+1VSK7lu55a+0 wlcG4S+tDXiXf2IE+acVUQpqgKc9KhOAxGGO8FiawnqDQAjwtBgx7z7VRalXHl2XFp1J qnPt39c0DKrvJratrOs5Id+fL2VokteT4pUfPgVg4UBZvSULWyf/jxu6ErGqWmMcE5XK JYlw== X-Gm-Message-State: ABuFfohZgcEhHLAxM51FA+91enU4p1s1gaxqwacT1wTWgU+v9Rem/TQl LKuK4i0xdGq633NiemVT/w526zA= X-Google-Smtp-Source: ACcGV60IeAghDqhzd7/8XCaxZkH2UIPklXvRx+O7Zuuq3Jf1/27ObP6mzl+qWDN5MQv+hAXFiezbmug= X-Received: by 2002:ab0:602f:: with SMTP id n15mr172743ual.7.1538249138967; Sat, 29 Sep 2018 12:25:38 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:39 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-5-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 04/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976682 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 42Mz89736Bz9s4V for ; Sun, 30 Sep 2018 05:27:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8738AC21E9F; Sat, 29 Sep 2018 19:26: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 84078C21F37; Sat, 29 Sep 2018 19:25:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 41EDDC21EF2; Sat, 29 Sep 2018 19:25:46 +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 A3506C21F13 for ; Sat, 29 Sep 2018 19:25:41 +0000 (UTC) Received: by mail-it1-f201.google.com with SMTP id k143-v6so6299424ite.5 for ; Sat, 29 Sep 2018 12:25: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=crM37RxLN2jFyG8FFA+B+VhnUsCl4EjJgFSs8RBE5oA=; b=Gis8TkWXc0cCQ+kc73w2REe3yyZ35dkG2e/zy5O+bZtGOJtN38bFogQh+/ekDJnPe+ SQhuljQVfflelOyZN+vuTAwf9f9kLQ1KQGsgMkVTPWlSBhGrhSbXJpr4X0EdoL7+WzD5 XErh3p9lHgZbOcfLVN9YiWuay0z7zeOEbl7t/MTa2cNjrYtFFL5MEqnZ2GZsPHpsudGp E4rj4ZiDi2+cQdE6c4bDnNIBRueL4rej2VViOF1WIASSY9s08iVHqWV7Q3/G4QhG+RC1 mQOObka/6b3EO0pLBX5GLpToE44xO3pi1RXjow18kouF3I8+ftw2xXjFdGiQ1OuGPkg1 zj+g== X-Gm-Message-State: ABuFfog8IwUAe6v6wobT07yRp6fJYs6slCg6FVjDzWbPvL7Ekvm9aDIo B6oUTJLevRJt0bN2xF9hIP6alyI= X-Google-Smtp-Source: ACcGV60pTL+Xn8QsLRAEAyL1X2kHTi9dSZ8SABFBqCIM7rphC91ve1QToT39VEDCMYlAWG+7wMvmvxI= X-Received: by 2002:a24:1a89:: with SMTP id 131-v6mr1296487iti.3.1538249140698; Sat, 29 Sep 2018 12:25:40 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:40 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-6-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 05/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976686 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 42MzDx4r4Lz9s3l for ; Sun, 30 Sep 2018 05:31:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 49DC4C21F21; Sat, 29 Sep 2018 19:30:28 +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 69A84C21F81; Sat, 29 Sep 2018 19:26:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 064EDC21F69; Sat, 29 Sep 2018 19:25:48 +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 51A5AC21EE3 for ; Sat, 29 Sep 2018 19:25:43 +0000 (UTC) Received: by mail-vk1-f201.google.com with SMTP id v129-v6so2345172vke.16 for ; Sat, 29 Sep 2018 12:25: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=bnQVOG4oyKbScsiJ4p5qiRL54XUqXOOu851dXiSxStw=; b=nFqruaShXfKMnANG89oX6fOQ+T3k/3+LgNt2NfAoKEl0BQqGXbu01PgJCqXiaeVs/J 6gbvOJjAATBT50jgFQlvRVsiDOBX91C94uuEhK+Pa94N11SnjnWXglwbHEoLdh6HURp6 gWEwEYoPm7U5gdDqUBXabkPd65luTsZR3RZUL4M75aGggcQCXj34y+bebOn9aEHy8k4e P35gEFy5RxYNkQy6nEks7Mwv9egN1wkWAXPmpEwZZQnsgaztHtY7BgiMx1GeBprFsyZJ 5a18TxWgj8VQeegRhIYsNWXcS9ukUA1pryZHXDd9befhwCjdTr8j23MFILq5bIrKmWbv A48w== X-Gm-Message-State: ABuFfoitGi12vfjT8lJ5aQH0kDDSH01zgCZLhBXGxAafwyOASdHlm9Ve S4xVpSrCaOYzmhR1qzpiTsgr4hY= X-Google-Smtp-Source: ACcGV63O59bQRe9mtRZJO5LibQMoX8U1iqNUd3eEmRCbED+3zsSlIxnLSB6XqARCMzvw3nn/yiVimIA= X-Received: by 2002:a67:2cd6:: with SMTP id s205-v6mr4209422vss.16.1538249142453; Sat, 29 Sep 2018 12:25:42 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:41 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-7-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 06/18] 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 --- Changes in v2: None 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 abf02b62e81..b90928e738a 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -421,6 +421,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') @@ -808,57 +913,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 @@ -873,38 +927,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. """ @@ -1020,28 +1042,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') @@ -1324,19 +1324,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', @@ -1361,17 +1360,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, 'wb') 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, 'wb') as fd: + fd.write(VBLOCK_DATA) + return command.CommandResult() + + command.test_result = _HandleVblockCommand entry_args = { 'keydir': 'devkeys', } From patchwork Sat Sep 29 19:23:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976688 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 42MzFh4vsfz9s3l for ; Sun, 30 Sep 2018 05:32:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6C4E0C21F3D; Sat, 29 Sep 2018 19:28: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 08C52C21EE3; Sat, 29 Sep 2018 19:26:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 29BA4C21E42; Sat, 29 Sep 2018 19:25:50 +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 05A79C21E79 for ; Sat, 29 Sep 2018 19:25:45 +0000 (UTC) Received: by mail-it1-f201.google.com with SMTP id 204-v6so6418406itf.1 for ; Sat, 29 Sep 2018 12:25:44 -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=GiPaHpAftb3YZrMZ6lQpxGORIqsXURvFYFdaBBGPOaQ=; b=uWyELE2LbSylmKHCmZS2HvECq8NDrtYZe168FU/9bI7Ragh9cXaOf1zfLwRXmIxE+A xnhSj7upFQNubClzlpI2eFcg5wggeKNDkMDZDQRABkEycdQ7+FiUNrYN0Ypa3rx/HBrC rE2t7rQlSon9P9xLlfToix9GH0y8TrxD0Hy6JbukHmjKW5VpIXMXovpdoCsVcxaNXoNn JJuMtugvta28Qtm+B1F5yXD1kI8kVPfW+nA3Ann9jzwZ4k2p5Dvro5LvGkKLDgq0cSnR kz3Pjnlc5EK/yoqQnPfUK6n8MNPgjJEHfYXf/KEZcxAyLGgK0EHuQCX/MZRuGqcaAQ1u NGzw== X-Gm-Message-State: ABuFfohIvbFMZKsJzTE2lx9wDWj8r4jZVaCWI7V5u09lewM2yltizTxE C4NZbz4w+Bl1h06Svi8Vb1i7pC0= X-Google-Smtp-Source: ACcGV61zUlfUA13HaWyDVV3Qf/A44gZ580WDmpzWyNBeY6gN2zRAH+oIgUlyLHKgrcq3N4RpycKDPXU= X-Received: by 2002:a24:5687:: with SMTP id o129-v6mr5560669itb.21.1538249144068; Sat, 29 Sep 2018 12:25:44 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:42 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-8-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 07/18] 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 --- Changes in v2: None Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3561fb0ca3b..8b471a22ed2 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 Sat Sep 29 19:23:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976687 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 42MzF34wZDz9s3l for ; Sun, 30 Sep 2018 05:31:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 341F0C21F37; Sat, 29 Sep 2018 19:28:53 +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 EB577C21F20; Sat, 29 Sep 2018 19:26:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 334A3C21F4F; Sat, 29 Sep 2018 19:25:52 +0000 (UTC) Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) by lists.denx.de (Postfix) with ESMTPS id B56AAC21F2F for ; Sat, 29 Sep 2018 19:25:47 +0000 (UTC) Received: by mail-qk1-f202.google.com with SMTP id l75-v6so5252737qke.23 for ; Sat, 29 Sep 2018 12:25:47 -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=NjPhpxaXSgbS4tTQG3fL1aTsW2ny8y5gbDZf4AkD0Ek=; b=OZ53y22TqnBSMl97xPfiKMMyvDpTLq+Bk7cGp99OgBPW/j2iZkXa9oWwATLrPVlf1P nRgZcjXh2L9tQeoGNYEO0IDJSFH4cHRzhCYCX/qhJID5m3cW/VwRAG6guoyD1hJVvVT1 JJjTp8Aw017sWB8PbW8zzARiymHd22Vg1rZNuXkMNC1sy2xS8FoDNW02Fi+69PKH0v9T /JnMJAwIvIN7ZgxRyijyVYqoyEv54kPnj534F6ds3L8DRTkXPa97BrrydBVNeZngGaIo HhAT3Uav7RHhEH+TA6k6uNz0ERR/XyYhkL94vIOSArVlSSAiZymBpiLoHNKWQLrp3snC R8Iw== X-Gm-Message-State: ABuFfoh69lY/B1R78LUSjNEI7IKSXOHsF+k5b1WC2Y3L0AwZzrJADjy3 U+TdTcFUHtRwT3L8d2LOXmcioRo= X-Google-Smtp-Source: ACcGV61lVro3oQUCRE82YPgxGwGuXUs9vOHQELeDxyVZIoLgLsmDPpFASeadJ0qHGQoHEhZHSMVP5Qw= X-Received: by 2002:a37:378d:: with SMTP id e135-v6mr3378311qka.17.1538249145662; Sat, 29 Sep 2018 12:25:45 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:43 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-9-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 08/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976698 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 42MzLN2Kjrz9s3Z for ; Sun, 30 Sep 2018 05:36:12 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C13A6C21F0F; Sat, 29 Sep 2018 19:29:46 +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 64FC6C21F37; Sat, 29 Sep 2018 19:26:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E092C21F63; Sat, 29 Sep 2018 19:25:53 +0000 (UTC) Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by lists.denx.de (Postfix) with ESMTPS id 67C33C21F32 for ; Sat, 29 Sep 2018 19:25:48 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id i11-v6so5495789yba.8 for ; Sat, 29 Sep 2018 12:25: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=AUfU5D+whl0AfCZPDFhO/WsZ67mdtePPd4AHz2ITF9I=; b=F0lTrq/21mET+94uN0210b6xp3Qnxgxa8jeznfmMCJKa36GYdnwoNgA1rNxKm3XETn Hs8IVe4T8oG+zaWhvuCuBf5v8Rjp5lg+Pb/znGvIa/xmTn+Ml+SkwIsecc8SSzneWmGL A4Q8Fst9v1vFQ1bE3vHCCKdeInwYVy8y8z30XIL1+9rYIQW4aiOx6NQ9b5V+MZc1b3BH ajyOAqg19ibI0Zmpjs/zTC7PUPqpzogwW6M+dYfrvPOBFgKojlR/HyLxbeqrBRP290wG qXjOT+9FfXgwJskndkcKwo3hCSO445O1Zc89zEvPYwUIHQMNQiZdhTW6tQNK0IxNG4bV pGgw== X-Gm-Message-State: ABuFfogL3HK/U7sP9JauSWv2u2YS0WlqXDQumIiSjUgZpPGnfVZLm4BO aLkPlKJ7YKoK65Eq1xMyOcItvDs= X-Google-Smtp-Source: ACcGV60w0WEPgI37AHUar7pMrTBUtnVb5/AL6DO1bJ7NuwzMbfyAGYcGDiFPENnPJCO9x896zkbqbo8= X-Received: by 2002:a25:c64f:: with SMTP id k76-v6mr2558930ybf.2.1538249147174; Sat, 29 Sep 2018 12:25:47 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:44 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-10-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 09/18] 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 --- Changes in v2: - Quote @$ correctly so that quoted arguments can be passed to run_test test/run | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/test/run b/test/run index 6b73813f9bc..d9901ae9f72 100755 --- a/test/run +++ b/test/run @@ -1,20 +1,28 @@ #!/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)) } 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 Sat Sep 29 19:23:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976697 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 42MzKq3dzpz9s3Z for ; Sun, 30 Sep 2018 05:35:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 300BEC21F42; Sat, 29 Sep 2018 19:29:11 +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 C138DC21F38; Sat, 29 Sep 2018 19:26:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1F47DC21F4F; Sat, 29 Sep 2018 19:25:53 +0000 (UTC) Received: from mail-it1-f202.google.com (mail-it1-f202.google.com [209.85.166.202]) by lists.denx.de (Postfix) with ESMTPS id 7F6F5C21F3B for ; Sat, 29 Sep 2018 19:25:49 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id e21-v6so5208495itc.3 for ; Sat, 29 Sep 2018 12:25:49 -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=w0Sru8nFTBMV+2y7Pw6Ia+CwklfIt5QN/sV/x8n4tgk=; b=YVV0Bkd1xH2PZX+XGqIAwA8EhQDMNig9GlfpRjoeZbxOq62V+1SFyUvEfdFZEoU/Yk Kp09JrAsCJiq+cWmqAFJ8zBzVDwFH6w3ih8mYuxbEXigumJ7ovsFGugyRUxCGipEGZfq KfJlrUJfFnxFAaU2KhamiysmAD19MT7qoxDqzYXx4wuN9tPIu3pAuSHr2JjeVOu/vAWo 7wNTSMb4QS0DgRhm+AcVijrcyhKLP4tdvrMqP4+JiierJuukIp3mjTTOERdwq/s/3ccL K+2m440GJoCnr76P8jT2wd+x4TJ8AXq7YD9Hl8snXdaJEJjlyO15HpO05OxI+Xdg5Nm/ z+9A== X-Gm-Message-State: ABuFfogpP815son4rpImoTkdSMKOXTOX+GsztC8wotMg7gixJ6OHOXUw Q2UpKvnvMrX9AIupJxI12YTBKnM= X-Google-Smtp-Source: ACcGV63F4WKH4w6kFwXmZzfD1m3iCdxUIzQRzkplzl3PQMlFpy6lnlbJUeZy7cwP1UYi/8WzCfeY8Us= X-Received: by 2002:a24:ed05:: with SMTP id r5-v6mr7146553ith.1.1538249148526; Sat, 29 Sep 2018 12:25:48 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:45 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-11-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 10/18] 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 --- Changes in v2: None test/run | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/run b/test/run index d9901ae9f72..d64581ab140 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 Sat Sep 29 19:23:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976685 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 42MzDd54QBz9s3l for ; Sun, 30 Sep 2018 05:31:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1EDB4C21E9F; Sat, 29 Sep 2018 19:29: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=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 90DFAC21F6A; Sat, 29 Sep 2018 19:26:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 38943C21F20; Sat, 29 Sep 2018 19:25:55 +0000 (UTC) Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) by lists.denx.de (Postfix) with ESMTPS id 06D60C21EE8 for ; Sat, 29 Sep 2018 19:25:51 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id q20-v6so9685963qke.21 for ; Sat, 29 Sep 2018 12:25: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=OO7XmICr0Wg2s3dTSNDe3pjI9OFDsbgKYL0zZF4d1k0=; b=ZJg3kpXv5e29/DAWJPhoM/GfMq2otRDwyATwtlUItlwbmLe2ml4SccdUb+FcJRjvvp S5UincDPoP8t0jL6LNy+nr8dMYcfXzED7QySd9vuAlJLYrfiqQyRbPpsouhshv/YX5Jn scDvjzoYAECzLK4tdKOfMI5WOiucwIF9PwNFlWVnEFZGVDEzyuZIrGtavEXy9Rcl5r1M 8KIqKQeQgybwh0giQ5OHLG7QwAsjulRYwVGXQKgEjswoRpsu4KeR+hd+MRLGRtfBOvvj F7URFnhv7EMsrt9CqgM3rhuliKIbU822751wyuzpMRB+4BZCRFg3pcPF/8cwmI/T7cHs CZdQ== X-Gm-Message-State: ABuFfoiH/sRyxLwEJfg6/uNadsreHVB9aAZydGka/E+08Qoaw77lSoOd VKb63D2CldDB1Ab8sEvJ55WrmyI= X-Google-Smtp-Source: ACcGV633YfM7rJHH6uC7+q7Z+x6aC3nTRTUdTv0/JKDEgdYVKIphk/CTRK9HUWZW1492X7AGqZm6dzs= X-Received: by 2002:a0c:8188:: with SMTP id 8-v6mr3410617qvd.11.1538249150184; Sat, 29 Sep 2018 12:25:50 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:46 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-12-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 11/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976694 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 42MzHl3kC5z9s3Z for ; Sun, 30 Sep 2018 05:33:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1F642C21F4A; Sat, 29 Sep 2018 19:28:00 +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 5B48AC21E79; Sat, 29 Sep 2018 19:26:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CC91BC21F20; Sat, 29 Sep 2018 19:25:56 +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 ADCD4C21F34 for ; Sat, 29 Sep 2018 19:25:52 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id l4-v6so9460315iog.13 for ; Sat, 29 Sep 2018 12:25: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=Agkkz6KuDV53bBvZjFvDxzVp2jd+u1C3ucusPT5d1C0=; b=n2Sc0TeMZxfSjfoJZT5fy9/ZBrhHWskPm/kHGB35oy6cU3tEQOqcGlQVzBWaBlipZn eDiO17WQsneLNSYjEESjI1Zx21Smid1dfvyCGmX5klFtIrjEujTj5M4DAmUHpVE5lIHX O2fBn3sb6nb93msvXZU5wL3Pm8r9nZYLfz5QEQ4Zrk4Pmgds979BjPGe8E6kqdB3X7ha +nhaRKERDZbqeiwbrRTuM0MscsSYh/WpeYFTZLPqOm6qg32KGw0fbXbaoN1Wnm2T+fb+ KtWInvVaV/pfaAtJjhKlHWPPeM0juCKzG8I8mrzZzLbFNqcv1ulGpFb+3XnY78mRGeYZ xqGg== X-Gm-Message-State: ABuFfojRos6XPWRpj06/cNzNvKPoJOyqSvJEIDraiwEOctxkG+cvLkCh 077RmcQj97o023vjwEC2eiQgPgE= X-Google-Smtp-Source: ACcGV61b6RxHe+0BpF+Y7PtDElTgHoNKEDmYyrtpIPJ4xWp2pLpwHLIYkt+vbLy2zwiAbqhL5iw4P5k= X-Received: by 2002:a24:93c5:: with SMTP id y188-v6mr6478447itd.1.1538249151749; Sat, 29 Sep 2018 12:25:51 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:47 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-13-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 12/18] 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 --- Changes in v2: None 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 69d85b4cedb..a8bc938f9e9 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 b90928e738a..a58804c10fe 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -113,7 +113,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: @@ -228,14 +227,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 _GetDtbContentsForSplTpl(self, dtb_data, name): """Create a version of the main DTB for SPL or SPL diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index d2597020500..2e6febe8f38 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') @@ -427,6 +427,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 Sat Sep 29 19:23:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976683 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 42MzCB5RFZz9s3l for ; Sun, 30 Sep 2018 05:29:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5E7BDC21F1B; Sat, 29 Sep 2018 19:27: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=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 3EF60C21F00; Sat, 29 Sep 2018 19:26:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4AAD9C21F16; Sat, 29 Sep 2018 19:25:57 +0000 (UTC) Received: from mail-oi1-f201.google.com (mail-oi1-f201.google.com [209.85.167.201]) by lists.denx.de (Postfix) with ESMTPS id 2EFAFC21E79 for ; Sat, 29 Sep 2018 19:25:54 +0000 (UTC) Received: by mail-oi1-f201.google.com with SMTP id p11-v6so2980804oih.17 for ; Sat, 29 Sep 2018 12:25:54 -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=WuguM8czuooPhVzhH0mjRuicizeOthSfMmbo0AZqaNM=; b=KgEcIiv0gdb6fVNnRM6RNpWkQJ4QfYmmJrStE2JkgUAFU8bhPVdOcvcaL9m+du3SMi 1iA1O12zKsPcjLsHoDBc20q+L+um+Fnphv1AZ6JGvruWPmnY7dkG6pcKcejwpXILJ9Wn eVvXBwuYVBW0uk89+i9IYJmUPzDigKehbmwD1CRwwzHFt+1nna5YKE36hd+FoZVjZRyj r2BqpF8RMsQKDURC+gnVRXmwcLJx+YDR32FcLrX02s3m4uyWnsyMKNWhkkZyV3gZrL0V zkPDcDr9aDWoII0HyOGBcQ0EUABhnNx62TItSl2cvT+boZv8P3PmvIo1I+P5+h6Hd1PF ZXaQ== X-Gm-Message-State: ABuFfogIwRpTYGooRfOaK6OnFDGKvZJf+TPFXtbhucPGK54PAzs4AGCp kVUQV6L+1N30IzxF4e31kSHnoCQ= X-Google-Smtp-Source: ACcGV60480EWv2XORWZoQXFjMLN+u/nuDddsb7ju7LIJo/z9KE35INFMZR5c8kjDU/keZBnJEDE4JYw= X-Received: by 2002:a9d:5699:: with SMTP id o25-v6mr3445184oth.6.1538249153037; Sat, 29 Sep 2018 12:25:53 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:48 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-14-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 13/18] 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 --- Changes in v2: None 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 a58804c10fe..cbde8beb5ab 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1028,10 +1028,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 Sat Sep 29 19:23:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976690 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 42MzFz23Pxz9s3l for ; Sun, 30 Sep 2018 05:32:23 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0CE59C21F13; Sat, 29 Sep 2018 19:27: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=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 41FADC21EC8; Sat, 29 Sep 2018 19:26:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8D19BC21CB6; Sat, 29 Sep 2018 19:25:59 +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 CA517C21DCA for ; Sat, 29 Sep 2018 19:25:55 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id w23-v6so9171544iob.18 for ; Sat, 29 Sep 2018 12:25: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=GjFH74gP3hN+8+HifNnrjuMNIudZClliAnsc3JE0yGY=; b=jtnyrV5MhgRq5VMlnf/CamdVbClExcIR8Cg3IULMV8gPWzUIBcF06IFlJtBwM5fTx/ 2KzcHrKvT+5FAeqwvq8IGp5OHT/O9HbnPIoeg80ZC5mBiTNaPMeV2iKy/LZ+TwJOHfhA PqeiZLT8bBfaBWrHUSCWtmjfMlML5z+84KQbiSxpPx4xshWg3PTFdErdS8rVbPClVTGB IknKNmYoWi88Emmn0nEYktAQr4zeqU5Sv5j7Yd4ouDRD20NUqp8qhvonVEhjPovvL5eC VqEKx4bk20rmS6Jjv3lwgw8Vqfn61U9vwe/iieH2v/dUty0f3MaMQdmMhWlri7FvsXh8 dDHQ== X-Gm-Message-State: ABuFfoiMLfuOQ++10COBxwRBwLM6kIHk83l7cspS7UPZnH+Mj1DhAtPk 1FmM8TWGyNMVb6zlw2fP3CXK2XE= X-Google-Smtp-Source: ACcGV63iLLDGxiO4M59KglV6gGeWXwdKEHA/2KCkwlWtO6gCrN/ENtRLJMUZGtXG1MromyVdVYjQ9GY= X-Received: by 2002:a24:43cb:: with SMTP id s194-v6mr5938694itb.3.1538249154818; Sat, 29 Sep 2018 12:25:54 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:49 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-15-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 14/18] 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 --- Changes in v2: None 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 Sat Sep 29 19:23:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976692 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 42MzGg07qrz9s3l for ; Sun, 30 Sep 2018 05:32:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AFE1BC21F37; Sat, 29 Sep 2018 19:28:21 +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 26970C21F3A; Sat, 29 Sep 2018 19:26:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D27C4C21F48; Sat, 29 Sep 2018 19:26:01 +0000 (UTC) Received: from mail-it1-f202.google.com (mail-it1-f202.google.com [209.85.166.202]) by lists.denx.de (Postfix) with ESMTPS id 49F1DC21F21 for ; Sat, 29 Sep 2018 19:25:57 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id b124-v6so6274580itb.9 for ; Sat, 29 Sep 2018 12:25: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=6Ekt2FPOmiDH93omxK0TyLNa9dR1za3tasjnbN4tl2M=; b=PelOkAbC8I7i2SSE9I8YGhJa3ebpDBQZzL2UGNdBq/JL6cht+SrUisE57ThHHuFPo8 4yn+R3TAY0jZPC40YSxC4IUwpA1dU3wVSf2lmBnt7mCO2q/l4XT/toubM8bolzqDTRpd 8F5IlnVAGTQiUJlF+CnzlYwUhbJkiXYljV0Y4+D5T9MBKopm2BeNmdnyFdo+A5c0kWG+ sm3+GPJf/deioTODgpOucjq08qGNWSwfXo0PqRFV8EUoa5Bvvf2GmOKJ+2c6soz7iIcm Of3FktPElrmUYi0fywdQXUBmi/5QLzJUyvej4wCcPb/qyiSysrsArPwiVNqXxWV0fE7i H2eA== X-Gm-Message-State: ABuFfohuSYtRvzQS4kwHavR8XtkPFqrniAJuvGO2YiF4b3nXC9vx1BZq wpelRpSu3ZXL/g9aJqrg0n8SDBA= X-Google-Smtp-Source: ACcGV605zJxnduVRrMVwYd4AHQITAe6AbJry2WwFUYaT+BZUzvP43bNjq6aLAneb3zzzBSJdKOFdCbw= X-Received: by 2002:a24:2153:: with SMTP id e80-v6mr1142287ita.1.1538249156359; Sat, 29 Sep 2018 12:25:56 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:50 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-16-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 15/18] 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 --- Changes in v2: None tools/patman/tools.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/patman/tools.py b/tools/patman/tools.py index 1c9bf4e8100..bf099798e65 100644 --- a/tools/patman/tools.py +++ b/tools/patman/tools.py @@ -28,6 +28,9 @@ packages = { 'lz4': 'liblz4-tool', } +# 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 Sat Sep 29 19:23:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976691 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 42MzGK1dzVz9s3l for ; Sun, 30 Sep 2018 05:32:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C5E5DC21F42; Sat, 29 Sep 2018 19:30:09 +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 59ED0C21F85; Sat, 29 Sep 2018 19:26:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 86417C21F52; Sat, 29 Sep 2018 19:26:02 +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 E7CF6C21EE0 for ; Sat, 29 Sep 2018 19:25:58 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id j80-v6so2325033vke.22 for ; Sat, 29 Sep 2018 12:25: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=HE4t2OH8qPDAeG52hUXShmM8/GIm5KqC8d5mEdN2FT8=; b=A0zFhntHQsptS2Ua75Emdq9F5vWefBPSaYZhnsVHTlIO8/kbPdCEFT0+6xrpCVMUIA KjxJ5+vszEd9xQgYMPi/3oS0HOZEF4HIiJWbFFuEcN0rllgmSZnguU+w5+2qfEDoktJa wsY2QzWmKDHga5kyMUDsa5jVvBkyy/sx+XZeLmAXYS7txwmLkVsqyiWnnqdxRclP8dnm 6De7v9Nlg4oPKscXVIaZQ3jiJPGVu8O1lV6x1PW7TELyDqUDdEGyr2hkSBSF7hC+HH/r Pdxt6cgHav1tpUFXt2bC1FLpjTuWE800TWVB/dV7eomxX0Fl21queWWzgSU+tjRXVjeQ 6v5g== X-Gm-Message-State: ABuFfoibx35/jJS4tQNgBoAUjSt7xzB/YceLdPltLv41g9J4bh/bvbbZ twHko3kEbsaSEENFbteIhsYGE54= X-Google-Smtp-Source: ACcGV6236JnPs6k1fJSjfbL77vcoJyaI7CfMC5QtCJ0eZZW6Qwz+OjNxmoUJg/HQlFGcp25rknaCLwg= X-Received: by 2002:a9f:2c81:: with SMTP id w1-v6mr2796288uaj.24.1538249158010; Sat, 29 Sep 2018 12:25:58 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:51 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-17-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 16/18] 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 --- Changes in v2: None 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') From patchwork Sat Sep 29 19:23:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976695 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 42MzJN4tBFz9s3Z for ; Sun, 30 Sep 2018 05:34:28 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 32BBFC21CB6; Sat, 29 Sep 2018 19:30: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 850C9C21F04; Sat, 29 Sep 2018 19:27:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1CCECC21F05; Sat, 29 Sep 2018 19:26:04 +0000 (UTC) Received: from mail-it1-f202.google.com (mail-it1-f202.google.com [209.85.166.202]) by lists.denx.de (Postfix) with ESMTPS id 79B6FC21F31 for ; Sat, 29 Sep 2018 19:26:00 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id e21-v6so5208944itc.3 for ; Sat, 29 Sep 2018 12:26:00 -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=vL6vx4baN49HxN0H6tyGAbAiOiGvWY/n9AjctKZrB4M=; b=g3HO8JIgrFaK90bX3pQqt0A6kf5hTJ8nIhtw2yh9PhxT0UC1roJrJhx4XPgWP3LpdL dGTDEDUa/GEClvQZy6BzuYxPHnbB/bHgx7ROAT3ytEeDML+/7pSc9iU7XYgzwfJSNq51 BiXbQhM+6BOF/LWstqbhCmMRWr/X/7KkAaIk37rPSnSfXw/7zTUhIls+Vo9lnKzwXF6+ dld2zUbHWfG1uxHVvHQlskaGdQCBuD+zeRZNS85dhmC1UE8Fg8QI6WkRTWXlIu/qgzlh 3QRwh0StIe6Kbo+q4heWdTne7sVO2nKc6YAGpViXtMJNZEGRegaEprcWNPF1P70z+UWQ Wi5g== X-Gm-Message-State: ABuFfohCc5u5wXROP7IO9hqVLa3TbvdzJmVgzWTvusZwFhJM7Hrr5iYZ FlqqVluk26kfekcgtmwuCGBPwL8= X-Google-Smtp-Source: ACcGV60k2aMdjLX6OP2UJ5UAQ150ou4ramyyVOdHW9CilA91ZO0zh+LWfXU0w7oGpZw5duZxkGwJ2g8= X-Received: by 2002:a24:ed05:: with SMTP id r5-v6mr7146861ith.1.1538249159555; Sat, 29 Sep 2018 12:25:59 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:52 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-18-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 17/18] test: Reduce the number of tests run with sandbox_flattree 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 only need to run driver-model tests with this config, since this is the only thing that is different when CONFIG_OF_LIVE is not defined. Filter out the other tests to same time. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to reduce the number of tests run with sandbox_flattree test/run | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/run b/test/run index d64581ab140..fb8ff5da0cb 100755 --- a/test/run +++ b/test/run @@ -25,7 +25,8 @@ run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \ # 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 +run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build \ + -k test_ut # 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. From patchwork Sat Sep 29 19:23:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 976693 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 42MzGv6Rqcz9s3l for ; Sun, 30 Sep 2018 05:33:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8267EC21F0F; Sat, 29 Sep 2018 19:31: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=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 DCC33C21EE4; Sat, 29 Sep 2018 19:27:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 92411C21F3C; Sat, 29 Sep 2018 19:26:07 +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 AA7B0C21E0F for ; Sat, 29 Sep 2018 19:26:03 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id e88-v6so9423817qtb.1 for ; Sat, 29 Sep 2018 12:26:03 -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=EyHX0lomkNz5O2OOpeXv6/9IHsttJ8mgTATylgMPZlg=; b=HKiroTx8MnHcTRdlv3rKwk2cuqpo4/r5OO8fVnoKpYgSIMi1FuCf0aBl4o6Lue+5ww Z81S1f59Ce14PldEd3c5r/lI+LdLSGgRLo+HivN1SSVzxf4f6f9MhBk/Vwh+Ma1xip2q yp9PUnZCPFiBHkBCj0IeDtSf663pu834xlcyeZx1SnQly9Hsg6yROEcttYUiQE0T014p 4xxKUEF6LFthaNxwJuv4cJL1ODw2QltSZjiWgy/IchitW5m4+qk7vCnF9yHvWNm3Nx6Z 0s5uUn/0bPgTbYO1xygVJZrwtGTm/9qluVw8WYa/e2fEw9LZoUxoaYnjAsPD1A4YL+Tk rhig== X-Gm-Message-State: ABuFfoheq1Em0RyQ7SwhqAAANtHvZ1dYecbLI8KOuJVfSTO3ISiJWpDy g3WSjE8vU/22NV/IUuMvxeZo1Cs= X-Google-Smtp-Source: ACcGV61h+Z7eqgcEpdHYVqR2dmGVD2s6SZGQxh2BZjXmjSwPKPbDU1kOBeKJISodwKoV0AgBj0nVa8Q= X-Received: by 2002:aed:2452:: with SMTP id s18-v6mr3400320qtc.20.1538249162588; Sat, 29 Sep 2018 12:26:02 -0700 (PDT) Date: Sat, 29 Sep 2018 13:23:53 -0600 In-Reply-To: <20180929192353.38640-1-sjg@chromium.org> Message-Id: <20180929192353.38640-19-sjg@chromium.org> Mime-Version: 1.0 References: <20180929192353.38640-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 18/18] binman: Run tests concurrently 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 run one after the other using a single CPU. This is not very efficient. Bring in the concurrencytest module and run the tests concurrently, using one process for each CPU by default. A -P option allows this to be overridden, which is necessary for code-coverage to function correctly. This requires fixing a few tests which are currently not fully independent. At some point we might consider doing this across all pytests in U-Boot. There is a pytest version that supports specifying the number of processes to use, but it did not work for me. Signed-off-by: Simon Glass --- Changes in v2: - Add a patch to run binman tests concurrently .travis.yml | 1 + test/py/README.md | 1 + tools/binman/binman.py | 26 +++- tools/binman/cmdline.py | 2 + tools/binman/entry_test.py | 7 +- tools/binman/ftest.py | 34 +++--- tools/concurrencytest/.gitignore | 1 + tools/concurrencytest/README.md | 74 ++++++++++++ tools/concurrencytest/concurrencytest.py | 144 +++++++++++++++++++++++ tools/dtoc/dtoc.py | 2 + tools/dtoc/test_fdt.py | 2 + tools/patman/test_util.py | 2 +- 12 files changed, 274 insertions(+), 22 deletions(-) create mode 100644 tools/concurrencytest/.gitignore create mode 100644 tools/concurrencytest/README.md create mode 100644 tools/concurrencytest/concurrencytest.py diff --git a/.travis.yml b/.travis.yml index ea3b20e0632..6bed41b5837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ install: - virtualenv /tmp/venv - . /tmp/venv/bin/activate - pip install pytest + - pip install python-subunit - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - mkdir ~/grub2-arm - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di ) diff --git a/test/py/README.md b/test/py/README.md index aed2fd063a8..4d9d2b81d1e 100644 --- a/test/py/README.md +++ b/test/py/README.md @@ -29,6 +29,7 @@ tests. Similar package names should exist in other distributions. | -------------- | ----------------------------- | | python | 2.7.5-5ubuntu3 | | python-pytest | 2.5.1-1 | +| python-subunit | - | | gdisk | 0.8.8-1ubuntu0.1 | | dfu-util | 0.5-1 | | dtc | 1.4.0+dfsg-1 | diff --git a/tools/binman/binman.py b/tools/binman/binman.py index f5af5359f3c..439908e6650 100755 --- a/tools/binman/binman.py +++ b/tools/binman/binman.py @@ -10,6 +10,7 @@ """See README for more information""" import glob +import multiprocessing import os import sys import traceback @@ -17,7 +18,7 @@ import unittest # Bring in the patman and dtoc libraries our_path = os.path.dirname(os.path.realpath(__file__)) -for dirname in ['../patman', '../dtoc', '..']: +for dirname in ['../patman', '../dtoc', '..', '../concurrencytest']: sys.path.insert(0, os.path.join(our_path, dirname)) # Bring in the libfdt module @@ -27,16 +28,22 @@ sys.path.insert(0, os.path.join(our_path, import cmdline import command +use_concurrent = True +try: + from concurrencytest import ConcurrentTestSuite, fork_for_tests +except: + use_concurrent = False import control import test_util -def RunTests(debug, args): +def RunTests(debug, processes, args): """Run the functional tests and any embedded doctests Args: debug: True to enable debugging, which shows a full stack trace on error args: List of positional args provided to binman. This can hold a test name to execute (as in 'binman -t testSections', for example) + processes: Number of processes to use to run tests (None=same as #CPUs) """ import elf_test import entry_test @@ -54,19 +61,28 @@ def RunTests(debug, args): sys.argv = [sys.argv[0]] if debug: sys.argv.append('-D') + if debug: + sys.argv.append('-D') # Run the entry tests first ,since these need to be the first to import the # 'entry' module. test_name = args and args[0] or None + suite = unittest.TestSuite() + loader = unittest.TestLoader() for module in (entry_test.TestEntry, ftest.TestFunctional, fdt_test.TestFdt, elf_test.TestElf, image_test.TestImage): if test_name: try: - suite = unittest.TestLoader().loadTestsFromName(test_name, module) + suite.addTests(loader.loadTestsFromName(test_name, module)) except AttributeError: continue else: - suite = unittest.TestLoader().loadTestsFromTestCase(module) + suite.addTests(loader.loadTestsFromTestCase(module)) + if use_concurrent and processes != 1: + concurrent_suite = ConcurrentTestSuite(suite, + fork_for_tests(processes or multiprocessing.cpu_count())) + concurrent_suite.run(result) + else: suite.run(result) print result @@ -115,7 +131,7 @@ def RunBinman(options, args): sys.tracebacklimit = 0 if options.test: - ret_code = RunTests(options.debug, args[1:]) + ret_code = RunTests(options.debug, options.processes, args[1:]) elif options.test_coverage: RunTestCoverage() diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index f8caa7d2841..3886d52b3a0 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -46,6 +46,8 @@ def ParseArgs(argv): parser.add_option('-p', '--preserve', action='store_true',\ help='Preserve temporary output directory even if option -O is not ' 'given') + parser.add_option('-P', '--processes', type=int, + help='set number of processes to use for running tests') parser.add_option('-t', '--test', action='store_true', default=False, help='run tests') parser.add_option('-T', '--test-coverage', action='store_true', diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py index a8bc938f9e9..17ab2290140 100644 --- a/tools/binman/entry_test.py +++ b/tools/binman/entry_test.py @@ -13,6 +13,8 @@ import fdt import fdt_util import tools +entry = None + class TestEntry(unittest.TestCase): def setUp(self): tools.PrepareOutputDir(None) @@ -38,7 +40,10 @@ class TestEntry(unittest.TestCase): def test2EntryImportLib(self): del sys.modules['importlib'] global entry - reload(entry) + if entry: + reload(entry) + else: + import entry entry.Entry.Create(None, self.GetNode(), 'u-boot-spl') del entry diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index cbde8beb5ab..7598abd7f5b 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -365,6 +365,16 @@ class TestFunctional(unittest.TestCase): os.makedirs(pathname) return pathname + @classmethod + def _SetupSplElf(self, src_fname='bss_data'): + """Set up an ELF file with a '_dt_ucode_base_size' symbol + + Args: + Filename of ELF file to use as SPL + """ + with open(self.TestFile(src_fname)) as fd: + TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + @classmethod def TestFile(self, fname): return os.path.join(self._binman_dir, 'test', fname) @@ -516,9 +526,7 @@ class TestFunctional(unittest.TestCase): 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()) + 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 + @@ -818,8 +826,7 @@ class TestFunctional(unittest.TestCase): def testImagePadByte(self): """Test that the image pad byte can be specified""" - with open(self.TestFile('bss_data')) as fd: - TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + self._SetupSplElf() data = self._DoReadFile('21_image_pad.dts') self.assertEqual(U_BOOT_SPL_DATA + (chr(0xff) * 1) + U_BOOT_DATA, data) @@ -842,6 +849,7 @@ class TestFunctional(unittest.TestCase): def testPackSorted(self): """Test that entries can be sorted""" + self._SetupSplElf() data = self._DoReadFile('24_sorted.dts') self.assertEqual(chr(0) * 1 + U_BOOT_SPL_DATA + chr(0) * 2 + U_BOOT_DATA, data) @@ -876,6 +884,7 @@ class TestFunctional(unittest.TestCase): def testPackX86Rom(self): """Test that a basic x86 ROM can be created""" + self._SetupSplElf() data = self._DoReadFile('29_x86-rom.dts') self.assertEqual(U_BOOT_DATA + chr(0) * 7 + U_BOOT_SPL_DATA + chr(0) * 2, data) @@ -1023,15 +1032,13 @@ class TestFunctional(unittest.TestCase): def testSplBssPad(self): """Test that we can pad SPL's BSS with zeros""" # ELF file with a '__bss_size' symbol - with open(self.TestFile('bss_data')) as fd: - TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + self._SetupSplElf() 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()) + self._SetupSplElf('u_boot_ucode_ptr') with self.assertRaises(ValueError) as e: self._DoReadFile('47_spl_bss_pad.dts') self.assertIn('Expected __bss_size symbol in spl/u-boot-spl', @@ -1078,8 +1085,7 @@ class TestFunctional(unittest.TestCase): addr = elf.GetSymbolAddress(elf_fname, '__image_copy_start') self.assertEqual(syms['_binman_u_boot_spl_prop_offset'].address, addr) - with open(self.TestFile('u_boot_binman_syms')) as fd: - TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) + self._SetupSplElf('u_boot_binman_syms') data = self._DoReadFile('53_symbols.dts') sym_values = struct.pack('