From patchwork Tue Oct 2 03:12:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977601 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 42PPPv3QFWz9s55 for ; Tue, 2 Oct 2018 13:14:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 333D7C21FF3; Tue, 2 Oct 2018 03:13:35 +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 CBBBDC22009; Tue, 2 Oct 2018 03:13:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CEA7CC21FDC; Tue, 2 Oct 2018 03:13:20 +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 6E166C21FDA for ; Tue, 2 Oct 2018 03:13:16 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id j1-v6so60382vka.0 for ; Mon, 01 Oct 2018 20:13:16 -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=EYnjziaeQSAh0mdhUbhz3bDNDx7fj1EbhlMk4+OMmIzLW/1ctBgdft3gVwN4jZ4wyW qblZsXdYwgjwNoj5SO7XubvEeDcg0m7QDy5M7Wm/D6JxHTiu1e2O9LOIYzErmA6kL4O7 B2P+bltpyj4WElEBjU/iXFFPAj3OtqDxgJtqkRUAhbZ1uoBeR+EUu5jPSaSP3OJxR6u6 hw7odilbYIa1Tw5HW7Vj3nKr4kDj23Cq7kZxcbKykgwZJNiI+36r1Ng/xZJrWhqg2vuJ CpzzS6qNiiesDfNFQXaY1RH3WNSlCWpT2xMrlL7+Fk2rlsQ/lWejGwRJGbdgVZm+nHUu GzUg== X-Gm-Message-State: ABuFfoi3e8yxaXCsEvgR5GKuqmvMwSVSaqPX8d2cK1jh93Fn1mMtuYns DYGb8hS7vlXtl5wbg4CgIMB7jt8= X-Google-Smtp-Source: ACcGV62NQ2/4+7q/XUvxRVVbKvI3H2ih6NTU1gKAoHqzux6f0jmaBszqbct2wkAp1+NfeoC85j0jZsI= X-Received: by 2002:a67:7407:: with SMTP id p7-v6mr13246942vsc.26.1538449995219; Mon, 01 Oct 2018 20:13:15 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:31 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-2-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 Tue Oct 2 03:12:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977602 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 42PPQF4hfvz9s55 for ; Tue, 2 Oct 2018 13:14:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2591FC21FE0; Tue, 2 Oct 2018 03:13:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=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 F0BF7C21FE2; Tue, 2 Oct 2018 03:13:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EA0CAC21E38; Tue, 2 Oct 2018 03:13:29 +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 704FCC21FFC for ; Tue, 2 Oct 2018 03:13:24 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id l24-v6so830240iok.21 for ; Mon, 01 Oct 2018 20:13:24 -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=WgCEFNNjrHxYsmBnvKRILzHRHZHUk17k1hMVRphHzJ8i0l8r74Ps7Hyke32QrGiNK7 KNQvo5vWSHGaD5VgGRqmR3w/BoYwTcE4l1r0ILFIm+FgZHa955LizuE/xYMmn0OaJ5HU eQCd4Dbba9NPFpmnaa8GNr7rAlJ6gbhMDSTthdiINmj1siMhPcqo2+v5OBOtgAGRFhAr X1FF8HYhb+W1t9EwENXH77Paw3MDqUjodP5pVq1dW80cjFKshyTxm6+mJqQSGw1at+Fi jJqRMizSj2m8yRcMiL5P0ucwD/RHHCfHbExjRDn6O8RM49QUOQ/igMDJaohLcBgzWdRd LWcQ== X-Gm-Message-State: ABuFfohYvxKDkHdImUkUoGm3vF4ZwO+dj3qaqOcD31Yf580B6pdU7cUR KZXV+thvzq31eLRUDFz3SRYClKc= X-Google-Smtp-Source: ACcGV61yK6Di9SFpJZfXTwjmvhrV6cZ1HVe2oYyc8YSibHW/7kJQsKoghNtVAy0INRMKHIiWFWUVyDo= X-Received: by 2002:a62:8a41:: with SMTP id y62-v6mr6012419pfd.70.1538450003446; Mon, 01 Oct 2018 20:13:23 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:32 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-3-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977605 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 42PPSl0qnsz9s55 for ; Tue, 2 Oct 2018 13:16:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BEF4CC21FBB; Tue, 2 Oct 2018 03:14:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=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 806BBC21FD0; Tue, 2 Oct 2018 03:14:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6FD1BC21FB6; Tue, 2 Oct 2018 03:13:32 +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 4CC2DC21FFC for ; Tue, 2 Oct 2018 03:13:32 +0000 (UTC) Received: by mail-io1-f74.google.com with SMTP id s5-v6so892645iop.3 for ; Mon, 01 Oct 2018 20:13:32 -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=cLnPuQUyNqEGCCzAKk1zI0sDT98OA9TfQeVUUEOdfK4VonDT7sSKu67dfKX8hvEHdL A6Zlnr8tq3BW8U5RXeoGz/91PySoXKz7nUsLwBZ174bcgLYpVwxW/65t1Nqz2uOJna35 Ixo+H+q9l5oN5MIDwAAM1yUQ0CKLh1ytcuoJ0+DiI5XjSlC7TULtewCAPbiP3WD0NrRH WQ2eBXBj7lBlTGX5QRdyhyrA3DIcxDzALjg7wenu56d2IsSFuMa/c6OwFlJWbds4JB6M bP7UJQMRyO+WPH2b5IS71+zxoGUvwoGLu7fY+K42d0bFvaRsk5SoxqozVCm7s31SbuO/ 7ZiA== X-Gm-Message-State: ABuFfoj3ZKl0JNMGasFFoSjUoVguRwbzPVD8J/tSOvjaWVpGJNPEKcji kJZNRBk/GwWJtByn9Hzjg+DWfnk= X-Google-Smtp-Source: ACcGV62RSbx2Aqzb1VKSYJrS25h1klpNChuzOZ8FE5hQbxsf0U4wNzsCOekRWO/YT/qzd9Iu8dUKM1A= X-Received: by 2002:a62:f51b:: with SMTP id n27-v6mr6427097pfh.67.1538450011300; Mon, 01 Oct 2018 20:13:31 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:33 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-4-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977604 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 42PPRF4SCWz9s55 for ; Tue, 2 Oct 2018 13:15:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D8FADC21FBE; Tue, 2 Oct 2018 03:14: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=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 8A283C21FFC; Tue, 2 Oct 2018 03:14:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2273FC21FB8; Tue, 2 Oct 2018 03:13:43 +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 128ABC21FF6 for ; Tue, 2 Oct 2018 03:13:40 +0000 (UTC) Received: by mail-io1-f73.google.com with SMTP id p22-v6so854648ioh.7 for ; Mon, 01 Oct 2018 20:13: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=pG7Q2eSYLZHXrt1lRvdwQOZczHCLeVgOuVj4YR+m0NkmrLSoP1VUFBj2AH3FUoFLWg Z7B1Sn8IytULKeOqi6jMTaltBjJP2o8rHq2AxjgT714ECcluds092EylOQhJfigGjNqK to2FycZf9i0D5N24vEPdFpyLs20Ve4r4CD5i5aQBGT/7/jVsLrcgbCgsHidLYNeUHbcM BqPJvmim9yBVonypvU1EZEW8k6IcZDVLSmu/1np4E2xfK1cOXYToqu/w3N+sZVIGetPx U2sRiSp+YrsZBo7noubm2xtFxrm8TsjFYmzvZGtTnHt7x42aj3DIwJJmcBmJmf1e+1La q6Og== X-Gm-Message-State: ABuFfoiGyZ2NvCoa+fEeB+ThJC2Rq/OeXT5Y2FeQWmI9waehALjdoTP0 4paco3c+AMJcsxqmQhzujeL4+dI= X-Google-Smtp-Source: ACcGV62FxYPQI6cFOCf8Psczhy7Ip9Ns/jGDTieG42tviAMmQBvCWjdKBLHEKHUgBFPu1hMUIT0KUW8= X-Received: by 2002:a24:7996:: with SMTP id z144-v6mr564327itc.10.1538450019114; Mon, 01 Oct 2018 20:13:39 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:34 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-5-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 Tested-by: Michal Simek --- 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 Tue Oct 2 03:12:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977603 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 42PPR15dDfz9s7T for ; Tue, 2 Oct 2018 13:15:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 79547C21FB8; Tue, 2 Oct 2018 03:14:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 D3E48C21FCD; Tue, 2 Oct 2018 03:14:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8F73BC21FE2; Tue, 2 Oct 2018 03:13:51 +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 0A3CFC22002 for ; Tue, 2 Oct 2018 03:13:48 +0000 (UTC) Received: by mail-qk1-f202.google.com with SMTP id z17-v6so549913qka.9 for ; Mon, 01 Oct 2018 20:13: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=crM37RxLN2jFyG8FFA+B+VhnUsCl4EjJgFSs8RBE5oA=; b=Ao+mWarsDlBLhZlW58LSkCngtwXis3ePqCletUuTR+rp/MJlok9rBUGGgkZq6sS4fc 4MWTOqdYhTfInDmObWQ4Qwrmp+VafsW+/HbRgsZxj5LW7yaSUAjI0b4nh3VITHIKwAr6 Qbt7CXe+5u5AMpv0KfE7K8qxiXtXksXSxI9yx3bpTqu8k2mIyxE1+ywe6z8VEPedboSC wQsculuiC0OerKuXnmwQc8Ai8fZG7Xy0my512KqhOuheQZP/b3u0MHPzN397vRTobjRp ar1U0p2IBNlXjMp068L03fFOwGvYq3kZYLvmJho98g30Ltd67zjM3PjS3g39wZr7lqGy II8Q== X-Gm-Message-State: ABuFfoj7CepjSTsIksKsiUTnDpOM9LGW+U1WLcRBSkcGRzuO9yD7vI+u 5BZLjORJWvvX2qWQltt6bOnJ4TE= X-Google-Smtp-Source: ACcGV60l3iEMJPSXhXnv5vyD91fc3rqbTXR9B3K/WhxZ7Ft6f22K0dDgWL3H7FCiElck9eNKRMUslHM= X-Received: by 2002:a37:3a86:: with SMTP id h128-v6mr10759751qka.4.1538450026954; Mon, 01 Oct 2018 20:13:46 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:35 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-6-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977607 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 42PPYS0Bjdz9s55 for ; Tue, 2 Oct 2018 13:20:43 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B915BC21FE0; Tue, 2 Oct 2018 03:16:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=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 D56B6C21FB5; Tue, 2 Oct 2018 03:16:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BBF83C21FBB; Tue, 2 Oct 2018 03:13:59 +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 9BB65C21FCA for ; Tue, 2 Oct 2018 03:13:55 +0000 (UTC) Received: by mail-it1-f201.google.com with SMTP id w137-v6so1507032itc.8 for ; Mon, 01 Oct 2018 20:13: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=iCg0d8rUc1aArhfWjImIK4p3bJrXMmKbyRo2VrX+1o4=; b=FNsLJpTFNp3CvFOLntd8bE3uMiiT+9st7yoPTfLDK7HxadKVy7sCzEK77u1ZAnCuAy JJmbwgT5eDIRECkuW5+n4/5Ad7N8RRiO9FV5iJm9r1YHnUQ32Fi3dcvZ86+KM7uwvgCe Etfa2McIvsYYd+wW2DgvfTvyuBFKdacVX1ZIOYS0J5aLLtaNZIjHi/c+FRal44dHshVN bxm37ubofgaAHlsd+yhsSM/DTfV34mDPPXeIdd5OqFewQmuAyyjMPzW+50/mnblBiOIK rwdLAIMSFg71f0QhystuN5abdYbPaJiYnSzuGl57MqMXu+IWnwcE1VSPWeT3Xnip8F/D KrTQ== X-Gm-Message-State: ABuFfoheXWk8bNLqd3HntEbOH35SfpEzgf0pwvNDTbW2Gbx9+uy1SwFO brrikMGvQbNQq5D5SKTM35XZWsc= X-Google-Smtp-Source: ACcGV61mrmJ4CZXmdzFvUoa5IzhigTbec1cvxKZ9qc62AykswPQI5qwj8eEQV6V4TMlsED1azta4CLI= X-Received: by 2002:a24:7543:: with SMTP id y64-v6mr568568itc.20.1538450034530; Mon, 01 Oct 2018 20:13:54 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:36 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-7-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 6869ac8f547..f578cce3663 100644 --- a/Makefile +++ b/Makefile @@ -1695,6 +1695,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' @@ -1733,7 +1737,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 Tue Oct 2 03:12: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: 977615 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 42PPbv2dyWz9s7T for ; Tue, 2 Oct 2018 13:22:51 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DF532C21FF4; Tue, 2 Oct 2018 03:17:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 2BBB6C21E16; Tue, 2 Oct 2018 03:17:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 916E1C21FDD; Tue, 2 Oct 2018 03:14:06 +0000 (UTC) Received: from mail-ua1-f73.google.com (mail-ua1-f73.google.com [209.85.222.73]) by lists.denx.de (Postfix) with ESMTPS id D3804C21FFC for ; Tue, 2 Oct 2018 03:14:02 +0000 (UTC) Received: by mail-ua1-f73.google.com with SMTP id f17-v6so230132uao.5 for ; Mon, 01 Oct 2018 20:14:02 -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=ttjGQG8JkZpZWFlnIbDC8PO5KEKETnfwfRPFIaGonHn5ueOoxXJne1JXgSYuhxeC+r HqoKPhsRjADWDzjJyxq6syfCLySK1QfmkaZwwKu8YD820l+IQj0W4O/YN776mxy++F+F X3rv/p28FEoeftqWAVNwosQyAZVzXbrvFhqcfFsBdwfa4564zE2oVG4h7TnW19yx/lFG qBCaCLqmJkQ3FI5XHXGbvBa4HRVBhVq1fT4A0lJlZIPy7TtoJ0ekcj+MLDvSTD9jtbbe dUUzhmLCkumk0E6KoFOSZQRYLMbnxXFls+fJ46exe3c1lv3DKmwI6cD7ttCms2cVpU24 IIhg== X-Gm-Message-State: ABuFfoj/OVA16ULZ5q+pnEEVaBaZ+C7uTSy2NSy0jzWR+ywDMlY9CAs0 gYsgm7+W0gUvDhZzX9t3rD7wMks= X-Google-Smtp-Source: ACcGV605VXtk1m/rj0nOAkAb0311r3i+4zbcWUelfqP87aPb1VBJK8j669V2mcfXM6dKuWsxzvp5KTw= X-Received: by 2002:a1f:e642:: with SMTP id d63-v6mr12668813vkh.1.1538450041948; Mon, 01 Oct 2018 20:14:01 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:37 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-8-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977606 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 42PPXK1Qmzz9s55 for ; Tue, 2 Oct 2018 13:19:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B4EEBC21FE7; Tue, 2 Oct 2018 03:17: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=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 1221AC21FDA; Tue, 2 Oct 2018 03:17:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9DC5CC21FF3; Tue, 2 Oct 2018 03:14:14 +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 D8087C21FB8 for ; Tue, 2 Oct 2018 03:14:10 +0000 (UTC) Received: by mail-it1-f202.google.com with SMTP id d194-v6so1509164itb.8 for ; Mon, 01 Oct 2018 20:14:10 -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=k9Ca2cN3o/JA9bBYjJ9Y1Bajxq0cz121sXPgbm+5FyBc+TZYB76NpL/EjmxOlR02EE ztjJ64F1t0NvBgo0WkB2za5o/LEXWS+jqvaWbKPHwSMxRIKz+nLHUiQR8JrQOK2LvYXV DAt+W/pNkZwOmE8mezU3ZMqzN1DyO9QBUGf58PG2Dd12LgySGVw6iOvGZWc6QWiZyqhT C30d1qsr9/lBcG43qJreOsggzIkeft808i9Y3DGGBV/BQYNNQbR1TeAxjqoEL5+zm1z5 flgOqCyL7xyaapm90TU3XxKbDNESyhURuELl78ejFrYBHp/fYyplhS/dA45Rcs6W8jPK Hhlw== X-Gm-Message-State: ABuFfojNvN8TKwFL13YbWXLgRQzrtVOkDPbQGXoQY8ytpImED57OK882 2ECtOMKo4++we/HwTxHyh6xdEB4= X-Google-Smtp-Source: ACcGV62QWOpW8gImAZBjw5iCamBFHG/vLtwCbT3YK36hybixyqU9Pu8EOK6/nC4C3d5P3dW93IzCXfI= X-Received: by 2002:a24:7c48:: with SMTP id a69-v6mr546272itd.15.1538450049901; Mon, 01 Oct 2018 20:14:09 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:38 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-9-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977608 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 42PPZ317Mbz9s55 for ; Tue, 2 Oct 2018 13:21:15 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CAEC1C22022; Tue, 2 Oct 2018 03:16:35 +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 B2339C21FDC; Tue, 2 Oct 2018 03:16:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D45FAC21FCD; Tue, 2 Oct 2018 03:14:22 +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 88280C21FCB for ; Tue, 2 Oct 2018 03:14:18 +0000 (UTC) Received: by mail-ua1-f74.google.com with SMTP id h26so232730uao.3 for ; Mon, 01 Oct 2018 20:14:18 -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=LpRMZ+GC1VjwD2fHddXttI/i1soOgxc6ufqKcsAL+4PCrZ6fPjXvPotxDwEW1xy2jb YKtgARNdmFIyz/5WTHzeYqbE0/t4pVitn0METypg88aE19C1S7aT74p7A2SQndtA+siv SD68JbYolCOl2mXC+R5Hw6j8IF+BRkUK/ldC+ICYHmlPFoPpThda6xF/jN46UDZS+2er 8JObjoZiVp9pfE9HEyRzqMdIvE7QgGL2j/VCSmqxjUPq4KYMpV8+WRDx45vpAx13dfOY jW2xQNX+ymQVPrsiTd6CixBX6fg51zz0FE5me9B6HovJqbLW/zHjvIhlGX1os3xt4S6E JlEg== X-Gm-Message-State: ABuFfoiboKxOzmBJ9nrAEg2BPvj5cnEd65IWHrXKzvj62hW76gDxuyqf zSimCyHPjALWVMNyV6cvdwVcXRE= X-Google-Smtp-Source: ACcGV601QcIsZwv10XHV0U6d89vXz5frEVOt4Sei9murPYJIS3IzugaPF8s++/fnYYS8Ck/AIeTuaFs= X-Received: by 2002:ab0:6552:: with SMTP id x18-v6mr13704183uap.22.1538450057647; Mon, 01 Oct 2018 20:14:17 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:39 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-10-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977613 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 42PPbk1j6Hz9sB4 for ; Tue, 2 Oct 2018 13:22:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 99BA2C21FDA; Tue, 2 Oct 2018 03:18:56 +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 656EBC21FEC; Tue, 2 Oct 2018 03:18:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ED575C22009; Tue, 2 Oct 2018 03:14:29 +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 0DDA7C21FDD for ; Tue, 2 Oct 2018 03:14:26 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id n188-v6so446325qke.6 for ; Mon, 01 Oct 2018 20:14:26 -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=CffZjhLTvsJTlaZ66/N40Y5wWV9NZI1891rV8mkzNFChtjQbtvYiMF+3RoqD4/LNrD GIs+cVLO5Uvs1vOJlHRayOYtJlOXTmh/GAcf7q7+5mvGzXC0WMj8+FoRgB9al6BZh85a YYGNy275F/FjvMGsG3Ho3Dsg1rY94Lrrtwwsvfo048Ah6MwADLy1cEPWU9x22pWxB++b Jl7zGz6NV7qRU5vS4+baQcMG3+kmDTouIk6eyJq+Mw1zo4yw5JeOZaovOGw5ycJbt3cm NSkazHeamn0VVKHMacu/RA3RZVqjO5stKWpvZFT6vwDuIGe1zebBZfAILk064h2sO/kw nO8A== X-Gm-Message-State: ABuFfogrRhsftX0tYb2SJ3zV/TLaCQMyJOwTk5J+/iWpsBcyuf1VmAcH lrdYBci87tL5uyu/p3GZ0rHDAXM= X-Google-Smtp-Source: ACcGV62j4AXtFzspmlJQAitkr25kxbRfE1bdM3+vOsIiyIeVe9yMBo80ofzyigLQyWHTbINJ3ZpjtoM= X-Received: by 2002:a0c:aee6:: with SMTP id n38-v6mr10255457qvd.17.1538450065063; Mon, 01 Oct 2018 20:14:25 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:40 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-11-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977609 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 42PPZd3PvRz9s55 for ; Tue, 2 Oct 2018 13:21:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 272E1C22002; Tue, 2 Oct 2018 03:15:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 73ABCC21FB8; Tue, 2 Oct 2018 03:15:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 60FB1C21FBE; Tue, 2 Oct 2018 03:14:37 +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 91A2FC21FEB for ; Tue, 2 Oct 2018 03:14:33 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id g26-v6so520392qkm.20 for ; Mon, 01 Oct 2018 20:14:33 -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=zckqchPovqYGbnWcyCamwfUJ/VMA+xxc99+GpIlSPeM=; b=l2ThMd03PcEx144XZrW3dfvjlwnnMb/DAERHLgW/fWIAJ3CMLpAwqG3ZPKPT1YUfKX N6InNHKMW7HJWlpvfWSb2pM7XEPGa4E1XtFlsuQ0AIphLzuGTOpakzUSRqdjXEB0EqiQ wSFontnhpQqmltkyT0TS+kAQb/HvnCbkekryNLsS+pEJMlEbOfXenlub+rGJWng2WXwS K0mwqqafMhcGgJtS/YEg0fIUIHh9SCgag0Crxu9azLp5+S2yz2tSil2hUmRsZ2xGbTes gepSKfZYdovjmpg4elJs7BGS3nOQzEiVPb+wEdWR4660q5ApB3sFJdvTKO0yfx7b5WEy USGw== X-Gm-Message-State: ABuFfog28pBoqHjDIWCDwA/Kfl5hXswtuwBrO2yh5Z+xoH3PGlKgTKFL hfs1Md6K7gv9KIgN9/dpbf0T9mY= X-Google-Smtp-Source: ACcGV61aGjSvBlf7aKswYlGteZ701wImFzIiUjIx357UleJSvhWiTSoTBYrLJHiQIC4lqETmhWlwBKE= X-Received: by 2002:aed:36a7:: with SMTP id f36-v6mr80709qtb.60.1538450072763; Mon, 01 Oct 2018 20:14:32 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:41 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-12-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 57725c928e7..9ef259a699b 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -115,7 +115,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: @@ -230,14 +229,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 Tue Oct 2 03:12: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: 977611 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 42PPbG1PpSz9s55 for ; Tue, 2 Oct 2018 13:22:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DF1D9C21FF6; Tue, 2 Oct 2018 03:15:44 +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 7F142C21FBB; Tue, 2 Oct 2018 03:15:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E3E01C21FA6; Tue, 2 Oct 2018 03:14:45 +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 4EC53C21FE0 for ; Tue, 2 Oct 2018 03:14:41 +0000 (UTC) Received: by mail-it1-f201.google.com with SMTP id e197-v6so1480813ita.9 for ; Mon, 01 Oct 2018 20:14: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=TcD9wXqmR2ppnltPM9YzyvnZon22juae4lcrJo0ksbQ=; b=QemfxTJr62jeurch46BEW4jT4clE/qTFTKSK/wh27kSv9jTvXiHLy76bsLtd+wxrA7 RvDz7FOUbr0RjivK/IV+rcxAV46dUskEWgHTID1DMdyEUI1aVa2EAF3voRlP6tA8B+0N 4CzzjAl73B5KaqoggJ4JCMQlew5X7L3cISBgR1MBsG+fJBBpDtxWwVw4SVDKILCuoBrB 5oIWW62uyfUf7nNRd3XhQAfVPAgNBp1tjgWKtAiY95LbBJ4Eq066vMbL0R/XjByEoVqX uC5x1I4Ox+CpaCAsJLfPMS6oqblU2ufOZe0DeJMBOURX8gfd4nMS3feYuX6UtmYOtd3q R5lg== X-Gm-Message-State: ABuFfoiMm9Y/Qkj+eSiYPuTQjrlmCZ4HLHMI5s9YvSKljbo+ofFXVY8I +ZpvnFFp+HYTnkKn5qv6MHwondo= X-Google-Smtp-Source: ACcGV62/h2Vef5y7UZB1aNdrk5ijLTK5Q/1i5mJBV/BIDFGs+pPPOmDj6jXIr7ujKkSupRGDf0dpahY= X-Received: by 2002:a24:1c10:: with SMTP id c16-v6mr556552itc.7.1538450080373; Mon, 01 Oct 2018 20:14:40 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:42 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-13-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 9ef259a699b..ed787745606 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1022,10 +1022,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 Tue Oct 2 03:12: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: 977616 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 42PPbx035sz9s3x for ; Tue, 2 Oct 2018 13:22:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BB053C22011; Tue, 2 Oct 2018 03:16:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_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 9B080C21FE0; Tue, 2 Oct 2018 03:16:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F56EC21FDC; Tue, 2 Oct 2018 03:14:52 +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 BE31BC21FBB for ; Tue, 2 Oct 2018 03:14:48 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id m142-v6so56794vkd.15 for ; Mon, 01 Oct 2018 20:14: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=GjFH74gP3hN+8+HifNnrjuMNIudZClliAnsc3JE0yGY=; b=gybuZ3bMe18L5iGFDzDvV9Q25PmTXBd6M8gdIkgUnaAvEORXpxEtF8u72MdNLszEXF 06jYRVTLClErw8TO8cOUCLQb/ZmBnQv58XnFffDNpTGFLNEuLKxmscELycjIIheTRrwb nrKjbYxzEMYRhxbg2LIHME76mv6NgH/uxEQ0xkbE+s3XDtz/KU1sQaRwJGNQBXhx/vsQ 9pMl+JFMTP88qKlAlUvSjXCRIh10KPMB+6aG+KPrpHngembpyktfrLzF1/KPUMUuCE+A 0cq+7whly8nt1vearHshctFL6qgnFbBw0xeAWti4nUvccEIr5pRX9x3vWZNcBDV5JivE VoiQ== X-Gm-Message-State: ABuFfojg/At+jp/v1y5NkWhfV5Xe0e1N0lYOwdBG2DYpCvnEVnIbN+IS s5fNnOaLyFnD1BLMhviwJ6F6XrA= X-Google-Smtp-Source: ACcGV63rS95ZuH6cjxHnWzdujJt53R1lIbvEx0VtccA6JMZuZFYZIOdTtCaar577jtTE9lpj5gIjv+k= X-Received: by 2002:a67:3a90:: with SMTP id g16-v6mr13594883vsi.32.1538450087918; Mon, 01 Oct 2018 20:14:47 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:43 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-14-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977614 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 42PPbt2HTJz9s3x for ; Tue, 2 Oct 2018 13:22:49 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B0D02C21FEE; Tue, 2 Oct 2018 03:16:02 +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 B41BDC21FF4; Tue, 2 Oct 2018 03:15:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 03C22C21FF4; Tue, 2 Oct 2018 03:14:58 +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 81AB3C21FDC for ; Tue, 2 Oct 2018 03:14:56 +0000 (UTC) Received: by mail-ua1-f74.google.com with SMTP id t28-v6so221906uae.12 for ; Mon, 01 Oct 2018 20:14:56 -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=X7eeKYyBP6XO8AVMAlH1v2n6+EePNfz+AEDCbddoV0H2kvmDrpRYgf0cg0tgz66HQG 0Vh5byovnBvYonah4mg0I+yqKT3kHxihzqNg+gcXQnkLa3CEpfisY2LguixzNbP2ab5i FzhoWmSejuaAbLfAm9mPLCa3o1xX6T7qEBbBjW7qNsMTNUs62MLLjGO2iYzjR3y76Dnx DZ2KQPl1GbtivS7UqFk31p7R6sQmJh+3yB/6NmJ3LAnWpILZy1MvxRYyMTw+l2iN98OE 6m7lmQLsggHhC+BlAJccdcpq7+UK6gAolQQOHqyH4dRxx1J1RVQvQIC1ILeoNb3og/OD XSHw== X-Gm-Message-State: ABuFfoghBqR1Sgxbnp10EFbLUB3ZWdAIEUnOi4IJ/NGOP9/NdutgCJyO WZ/G63CzY6eYWOKNy9Vy5wWvxFo= X-Google-Smtp-Source: ACcGV62Vuj1mXF/WvtuK7vgZc5M0UZeM+ffmXPJftif/wDrsvSBcgeyUxKLpQhx7HZdktiLlQATcdys= X-Received: by 2002:a67:80d3:: with SMTP id b202-v6mr13492162vsd.8.1538450095676; Mon, 01 Oct 2018 20:14:55 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:44 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-15-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977617 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 42PPc53Yqgz9s3x for ; Tue, 2 Oct 2018 13:23:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2BE26C2200F; Tue, 2 Oct 2018 03:19:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2 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 86C35C2200E; Tue, 2 Oct 2018 03:19:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 92528C22010; Tue, 2 Oct 2018 03:15:07 +0000 (UTC) Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by lists.denx.de (Postfix) with ESMTPS id 8B919C21FF4 for ; Tue, 2 Oct 2018 03:15:06 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id i192-v6so308882ybg.14 for ; Mon, 01 Oct 2018 20:15:06 -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=U3+1B1weLmCV6nMTHjJfyp9ek3JdfEnJ6AcX1SVr11cj4K2msj8siZfH1PL1HHAJLi 5z0WgyPJAypCQZVKsMgWNNvCQqXx8HoALDckScmaeVgbXG/XXX9bvCKcgYoQk5ahXOKY h5yZ4yGM5KrpX6V9h6Oj+oihyUgtggyBXuv9Dn9yWE5NvjK3IlgW7b2VsWwkzwVNkJti F/xnwq8nSF3kPKuKOMNd7qL51ma0cgHhRy+VvpjMY7KHlKd6nrVFF24MrOh4po5cf1KZ O1g1QlOla2h4Vh+jTAtuhKjAjwzCCdW6+JCtG4CZUx9xl5QK1tGng45UD0S8y+o9O6eQ zToQ== X-Gm-Message-State: ABuFfohzVpscon/Nyb4FwcqbsPZlUBmOc0Q96+Hjlq/bIX9rYrbRDRcX RQhkADpnf4W3RUC5OfMLYdWWg4U= X-Google-Smtp-Source: ACcGV626tRDcDxt0+hxfEngvm3cYrAhBfC6wduL7eCSRjzfqanubf7O6xry2hCyGQGrVeMo5SRkhcvo= X-Received: by 2002:a81:9d8c:: with SMTP id u134-v6mr8003643ywg.19.1538450105463; Mon, 01 Oct 2018 20:15:05 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:45 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-16-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977618 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 42PPcJ0n32z9s7T for ; Tue, 2 Oct 2018 13:23:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 59B12C21FEE; Tue, 2 Oct 2018 03:20:34 +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 D349EC21FF8; Tue, 2 Oct 2018 03:20:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3E26AC21FBB; Tue, 2 Oct 2018 03:15:19 +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 031D3C21FDE for ; Tue, 2 Oct 2018 03:15:15 +0000 (UTC) Received: by mail-oi1-f201.google.com with SMTP id v188-v6so425950oie.3 for ; Mon, 01 Oct 2018 20:15:14 -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=oFZ9U9FvqFi9/e3wuxL3zAON95PmOxYj/RrtN5eTABLyFZeIio2WPYtZvInd5Tt62v 7Ut2BP8kdgBjgz+CLbsOxpWJHqpKbRI/NiVOSHTjrcmDNDZFQFgjAOCT8xgkr88Avtqm u+I6RfBzrP/djfodaJssgN8Dn7uGHVRPnLRWqRQWBGjiyu3ikRXs0d2E16BFZMRuXi2m N8PRXQWOYkdl0BNFLZL/+MOwgVJWhpNRjARTQMiP8SGwZwIHM5Cwz2Yz1SQX1EJuRVbi aDvzD9sOt69h3w9FQe5IzN+Qwf+SLwtYdfdTt5az+uZ92lxTI0TUElXnu7mU6dPWwMks neWQ== X-Gm-Message-State: ABuFfoiwTgXKmfmYweBeAc+rVBVVRFHJDeGYjNJWMqkNi/nH+zlq6nAK 5XAiiCXzUEr/XT8rOfPVkutED08= X-Google-Smtp-Source: ACcGV63mr6c6grszEEQoztxjyGlAo4fqVIFLteBP3GWSVstP78xyfy2+2g2WSUW9mdmSCY+7KJgrjVA= X-Received: by 2002:a9d:41ec:: with SMTP id v41-v6mr11170504oti.62.1538450113610; Mon, 01 Oct 2018 20:15:13 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:46 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-17-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 Tue Oct 2 03:12: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: 977620 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 42PPfN3rNyz9s3x for ; Tue, 2 Oct 2018 13:25:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3DBD2C22009; Tue, 2 Oct 2018 03:22:02 +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 18E53C21FF4; Tue, 2 Oct 2018 03:21:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CB2B9C21FDA; Tue, 2 Oct 2018 03:15:27 +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 C6B20C21FBB for ; Tue, 2 Oct 2018 03:15:22 +0000 (UTC) Received: by mail-qt1-f201.google.com with SMTP id u28-v6so562730qtu.3 for ; Mon, 01 Oct 2018 20:15:22 -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=ZPBWzSUosa7UneQWNLjXjy6cTZ9t3U7Mthr6IHvGLf4=; b=rb+Qss2J0aP7wz0uD55Tnj6IuTcsT+7+Yu8H3gqHC59hsOctZflNUe4o4Aexz9930w lCLqml3hUrB7uFLbR6aOELGUSbzpi2eDzsrUd3Mx0FSHJRVQXtFpZWVYq7qGN3M3gOR3 LEn1UD6xn3bfzqHGdimjZkGeBHijT+OzrJbnZgKJwpwLBb9JmON/u1aqfocSXI6+c6WR W1A2/zApZQF++pIEuezivkQG16xK/xu2frfwMECfEdDONw9mf/UcWD/PHDMQZxNW0ldZ g/0DVjGUXAJ1GLZaVWRU/EkmT3cA8cwsBEBuA1kVtnOduJdIwc8EwPOnPhRg1x/z9V8Z B5JQ== X-Gm-Message-State: ABuFfojaCf6Zq71lCaxQrT6iIjdwb54mMjGGwk7DHRIwEKH6vBehrfcQ xi8ubuLJiPVzOyGJOEInE0h1zGY= X-Google-Smtp-Source: ACcGV636ylbOox9Vf3fIXtHoYVEUXf1PT/2tCfIcTe0p+Gu28mZ+nb+JmTchk/FQ4jYuoA7V3TMvmwQ= X-Received: by 2002:ac8:2925:: with SMTP id y34-v6mr10743455qty.56.1538450121935; Mon, 01 Oct 2018 20:15:21 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:47 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-18-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-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/17] 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 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 2b759c9d686..f78749afb56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,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 ed787745606..9f21027bd40 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -367,6 +367,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) @@ -715,8 +725,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) @@ -739,6 +748,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) @@ -781,6 +791,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) @@ -1017,15 +1028,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', @@ -1050,9 +1059,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 + @@ -1094,8 +1101,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('