From patchwork Mon Jul 8 19:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1129290 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="DXOowVJX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45jFzW1Q6qz9sNH for ; Tue, 9 Jul 2019 05:35:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DB225C21E0D; Mon, 8 Jul 2019 19:26:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 16BEDC21DF8; Mon, 8 Jul 2019 19:21:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 24CF4C21E3B; Mon, 8 Jul 2019 19:21:26 +0000 (UTC) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by lists.denx.de (Postfix) with ESMTPS id 8138EC21E31 for ; Mon, 8 Jul 2019 19:21:22 +0000 (UTC) Received: by mail-io1-f50.google.com with SMTP id o9so22257099iom.3 for ; Mon, 08 Jul 2019 12:21:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TospjvykXdj3eLPTCiu4/aV7JYgWQkWiWpk7x5asgl8=; b=DXOowVJXFoWE7P/gx5YvUHDI+znmP88O9cauz5ZjC79bz8sYc4wiZIgl3+GVhV6Q1u Ju/wCx9rkzDVshkhOO6TM24ZpxQvrnov5atu5PHb3OleIqC8On+aSh3BH9ierV3eiqtO LaBBQC8oT20FLLlXaxXQyc75HPySFTjFEN43Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TospjvykXdj3eLPTCiu4/aV7JYgWQkWiWpk7x5asgl8=; b=cYkCIA2obnlJ3j06s0gSClqxCZwashr1dTyuxOdcZ3AYANG+X+06xd8OJYMA2+zPGa 5tvjwins1BlFf1lJIxqOj0nvdxLN7p9SOYchU1N4UF6pL2MTwOFT+sgfcm0bfi5e1cIn JEpg9NNG0qMmxyIUNr90NhKO1Aaxtnqa7k0YkcgV+HLhxEiMl+L7UjcI4QzfNHuD2MRB eVpfBRUAU453wbb/XxhovBALWXAzHBnnsZNLPo5buaX7PLYXQiMfk7lb8AIFMCMy8bsJ 8abucZY4T2I/j3DA66QqlpwqiMlArYJ4kel1wWsBUQeUD77PqHpr4TicnQ15wJJnYL+q AU8g== X-Gm-Message-State: APjAAAU+9edQKXaJFzjPnQK8e/7U54E5dWp1Rr2q0PQOnvYyt710ugtB d863B3cSbsM9qaa77idVONchOTWZoPM= X-Google-Smtp-Source: APXvYqxDkDydUv9rpRsuaS0sgHqkk/35cps4hgdTRFb81jxVhHugufujM3SRbICfEILmSCDcB8wvxw== X-Received: by 2002:a02:6d24:: with SMTP id m36mr23424139jac.87.1562613681311; Mon, 08 Jul 2019 12:21:21 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id j1sm15545094iop.14.2019.07.08.12.21.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 12:21:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 8 Jul 2019 13:18:50 -0600 Message-Id: <20190708191856.138863-32-sjg@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190708191856.138863-1-sjg@chromium.org> References: <20190708191856.138863-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v2 31/37] binman: Pass the toolpath to 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" Tools like ifwitool may not be available in the PATH, but are available in the build. These tools may be needed by tests, so allow tests to use the --toolpath flag. Also use this flag with travis. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None .travis.yml | 2 +- test/run | 9 ++++++--- tools/binman/binman.py | 12 +++++++++--- tools/binman/ftest.py | 8 +++++++- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6662ca126ab..c883198abbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -146,7 +146,7 @@ script: if [[ -n "${TEST_PY_TOOLS}" ]]; then PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}" - ./tools/binman/binman -t && + ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools -t && ./tools/patman/patman --test && ./tools/buildman/buildman -t && PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt" diff --git a/test/run b/test/run index 55a6649a9c5..b97647eba6f 100755 --- a/test/run +++ b/test/run @@ -33,12 +33,14 @@ 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. +# provides and which is built by the sandbox_spl config. Also set up the path +# to tools build by the build. DTC_DIR=build-sandbox_spl/scripts/dtc export PYTHONPATH=${DTC_DIR}/pylibfdt export DTC=${DTC_DIR}/dtc +TOOLS_DIR=build-sandbox_spl/tools -run_test "binman" ./tools/binman/binman -t +run_test "binman" ./tools/binman/binman -t --toolpath ${TOOLS_DIR} run_test "patman" ./tools/patman/patman --test [ "$1" == "quick" ] && skip=--skip-net-tests @@ -49,7 +51,8 @@ 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 "binman code coverage" ./tools/binman/binman -T +export PATH=$PATH:${TOOLS_DIR} +run_test "binman code coverage" ./tools/binman/binman -T --toolpath ${TOOLS_DIR} run_test "dtoc code coverage" ./tools/dtoc/dtoc -T run_test "fdt code coverage" ./tools/dtoc/test_fdt -T diff --git a/tools/binman/binman.py b/tools/binman/binman.py index 9878eb86d4f..52c03f68c6d 100755 --- a/tools/binman/binman.py +++ b/tools/binman/binman.py @@ -46,7 +46,7 @@ except: import control import test_util -def RunTests(debug, verbosity, processes, test_preserve_dirs, args): +def RunTests(debug, verbosity, processes, test_preserve_dirs, args, toolpath): """Run the functional tests and any embedded doctests Args: @@ -60,6 +60,7 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args): processes: Number of processes to use to run tests (None=same as #CPUs) args: List of positional args provided to binman. This can hold a test name to execute (as in 'binman -t testSections', for example) + toolpath: List of paths to use for tools """ import elf_test import entry_test @@ -79,6 +80,9 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args): sys.argv.append('-D') if verbosity: sys.argv.append('-v%d' % verbosity) + if toolpath: + for path in toolpath: + sys.argv += ['--toolpath', path] # Run the entry tests first ,since these need to be the first to import the # 'entry' module. @@ -91,7 +95,8 @@ def RunTests(debug, verbosity, processes, test_preserve_dirs, args): if hasattr(module, 'setup_test_args'): setup_test_args = getattr(module, 'setup_test_args') setup_test_args(preserve_indir=test_preserve_dirs, - preserve_outdirs=test_preserve_dirs and test_name is not None) + preserve_outdirs=test_preserve_dirs and test_name is not None, + toolpath=toolpath) if test_name: try: suite.addTests(loader.loadTestsFromName(test_name, module)) @@ -167,7 +172,8 @@ def RunBinman(options, args): if options.test: ret_code = RunTests(options.debug, options.verbosity, options.processes, - options.test_preserve_dirs, args[1:]) + options.test_preserve_dirs, args[1:], + options.toolpath) elif options.test_coverage: RunTestCoverage() diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 256d4a1c5d8..3455b8ccebd 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -144,7 +144,8 @@ class TestFunctional(unittest.TestCase): self._indir = None @classmethod - def setup_test_args(cls, preserve_indir=False, preserve_outdirs=False): + def setup_test_args(cls, preserve_indir=False, preserve_outdirs=False, + toolpath=None): """Accept arguments controlling test execution Args: @@ -153,9 +154,11 @@ class TestFunctional(unittest.TestCase): preserve_outdir: Preserve the output directories used by tests. Each test has its own, so this is normally only useful when running a single test. + toolpath: ist of paths to use for tools """ cls.preserve_indir = preserve_indir cls.preserve_outdirs = preserve_outdirs + cls.toolpath = toolpath def setUp(self): # Enable this to turn on debugging output @@ -256,6 +259,9 @@ class TestFunctional(unittest.TestCase): if images: for image in images: args += ['-i', image] + if self.toolpath: + for path in self.toolpath: + args += ['--toolpath', path] return self._DoBinman(*args) def _SetupDtb(self, fname, outfile='u-boot.dtb'):