From patchwork Sat Aug 24 13:22:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1152611 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="cIeMEgJU"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Fzbd6dwqz9s7T for ; Sat, 24 Aug 2019 23:27:57 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5EC99C21E16; Sat, 24 Aug 2019 13:27:20 +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 E58CAC21E16; Sat, 24 Aug 2019 13:27:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2D053C21C50; Sat, 24 Aug 2019 13:27:13 +0000 (UTC) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by lists.denx.de (Postfix) with ESMTPS id 93936C21DB5 for ; Sat, 24 Aug 2019 13:27:12 +0000 (UTC) Received: by mail-io1-f49.google.com with SMTP id l7so26715700ioj.6 for ; Sat, 24 Aug 2019 06:27:12 -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=Z9GOJ+0i+vhFrVIUNRa0nwptNemjN5pBljbWRpwpUK8=; b=cIeMEgJUCfJvIF4P8LjAllkOmy+Xdd/tq3N82R+6KhjW1Whr4de1470xvuRaZwh/7a lLdpSEMm5sz8glZu3QTKPbL84JxjcU3EcwIkB6cF4T8m8yDVtdSOKOSRUyGa22fGJKk+ c2/d1KXq3W969F3Ru68VzE++kA314JqhZyCzw= 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=Z9GOJ+0i+vhFrVIUNRa0nwptNemjN5pBljbWRpwpUK8=; b=oM34QFktCB0Qy92yG1D5QQid5AYraHl+VRZCMtsWZGaxbjSiIyIirikODDgSHkoGvu mextEHsBhTCtyJbV/x3kfKKPsH4Hc/1tVBZplRLns8G74lztcqrsmoy/F9tfDLGTb9lF 5fwjXFyK3p99PkxoI2VKSqmLq8oSOpgenpvaKvHSn2G7a0nG1GfxCzYkLYRVCjPj0XGG CzoAk3tkJg2nyTKFVR0uWMs1LFTCDYfNjowau+l69VzCzWPgt72kXOQXbv84J1hTuNA5 vnk9HgPZ4ithlOwUfyMtkcRnCQPuSMlKEFVNys3/0dTZCjcumJM5obp+xwwx/RRbII0K m9ow== X-Gm-Message-State: APjAAAWfLRfdpkUAmUWFNi3rn+OP/vNtRG7soTT0/95tq9gayYtntQ8W xE1a6d9+uL5euchCUi7t46XTX3Q47hk= X-Google-Smtp-Source: APXvYqw54y9yX74ZthvDlwBNMFjubpQT4K7FCrUtoTlSeRQQkr8asoxR/r3A1mXfvCYCGTGhtTc1RQ== X-Received: by 2002:a05:6638:a12:: with SMTP id 18mr4727989jan.123.1566653231415; Sat, 24 Aug 2019 06:27:11 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id l2sm8881790ioq.83.2019.08.24.06.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2019 06:27:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 24 Aug 2019 07:22:43 -0600 Message-Id: <20190824132315.53130-4-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog In-Reply-To: <20190824132315.53130-1-sjg@chromium.org> References: <20190824132315.53130-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 03/34] binman: Use cls instead of self for class methods 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" It is more common to use the name 'cls' for the class object of a class method, to distinguish it from normal methods, which use 'self' Update the binman tests accordingly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/binman/ftest.py | 54 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 0f3b70b3bb..acf361fa84 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -94,16 +94,16 @@ class TestFunctional(unittest.TestCase): the test/ diurectory. """ @classmethod - def setUpClass(self): + def setUpClass(cls): global entry import entry # Handle the case where argv[0] is 'python' - self._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) - self._binman_pathname = os.path.join(self._binman_dir, 'binman') + cls._binman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) + cls._binman_pathname = os.path.join(cls._binman_dir, 'binman') # Create a temporary directory for input files - self._indir = tempfile.mkdtemp(prefix='binmant.') + cls._indir = tempfile.mkdtemp(prefix='binmant.') # Create some test files TestFunctional._MakeInputFile('u-boot.bin', U_BOOT_DATA) @@ -113,7 +113,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('blobfile', BLOB_DATA) TestFunctional._MakeInputFile('me.bin', ME_DATA) TestFunctional._MakeInputFile('vga.bin', VGA_DATA) - self._ResetDtbs() + cls._ResetDtbs() TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA) TestFunctional._MakeInputFile('u-boot-br.bin', PPC_MPC85XX_BR_DATA) TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin', @@ -135,35 +135,35 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA) # ELF file with a '_dt_ucode_base_size' symbol - with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd: + with open(cls.TestFile('u_boot_ucode_ptr'), 'rb') as fd: TestFunctional._MakeInputFile('u-boot', fd.read()) # Intel flash descriptor file - with open(self.TestFile('descriptor.bin'), 'rb') as fd: + with open(cls.TestFile('descriptor.bin'), 'rb') as fd: TestFunctional._MakeInputFile('descriptor.bin', fd.read()) - shutil.copytree(self.TestFile('files'), - os.path.join(self._indir, 'files')) + shutil.copytree(cls.TestFile('files'), + os.path.join(cls._indir, 'files')) TestFunctional._MakeInputFile('compress', COMPRESS_DATA) # Travis-CI may have an old lz4 - self.have_lz4 = True + cls.have_lz4 = True try: tools.Run('lz4', '--no-frame-crc', '-c', - os.path.join(self._indir, 'u-boot.bin')) + os.path.join(cls._indir, 'u-boot.bin')) except: - self.have_lz4 = False + cls.have_lz4 = False @classmethod - def tearDownClass(self): + def tearDownClass(cls): """Remove the temporary input directory and its contents""" - if self.preserve_indir: - print('Preserving input dir: %s' % self._indir) + if cls.preserve_indir: + print('Preserving input dir: %s' % cls._indir) else: - if self._indir: - shutil.rmtree(self._indir) - self._indir = None + if cls._indir: + shutil.rmtree(cls._indir) + cls._indir = None @classmethod def setup_test_args(cls, preserve_indir=False, preserve_outdirs=False, @@ -226,7 +226,7 @@ class TestFunctional(unittest.TestCase): return tmpdir, updated_fname @classmethod - def _ResetDtbs(self): + def _ResetDtbs(cls): TestFunctional._MakeInputFile('u-boot.dtb', U_BOOT_DTB_DATA) TestFunctional._MakeInputFile('spl/u-boot-spl.dtb', U_BOOT_SPL_DTB_DATA) TestFunctional._MakeInputFile('tpl/u-boot-tpl.dtb', U_BOOT_TPL_DTB_DATA) @@ -432,7 +432,7 @@ class TestFunctional(unittest.TestCase): return self._DoReadFileDtb(fname, use_real_dtb)[0] @classmethod - def _MakeInputFile(self, fname, contents): + def _MakeInputFile(cls, fname, contents): """Create a new test input file, creating directories as needed Args: @@ -441,7 +441,7 @@ class TestFunctional(unittest.TestCase): Returns: Full pathname of file created """ - pathname = os.path.join(self._indir, fname) + pathname = os.path.join(cls._indir, fname) dirname = os.path.dirname(pathname) if dirname and not os.path.exists(dirname): os.makedirs(dirname) @@ -450,7 +450,7 @@ class TestFunctional(unittest.TestCase): return pathname @classmethod - def _MakeInputDir(self, dirname): + def _MakeInputDir(cls, dirname): """Create a new test input directory, creating directories as needed Args: @@ -459,24 +459,24 @@ class TestFunctional(unittest.TestCase): Returns: Full pathname of directory created """ - pathname = os.path.join(self._indir, dirname) + pathname = os.path.join(cls._indir, dirname) if not os.path.exists(pathname): os.makedirs(pathname) return pathname @classmethod - def _SetupSplElf(self, src_fname='bss_data'): + def _SetupSplElf(cls, 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), 'rb') as fd: + with open(cls.TestFile(src_fname), 'rb') as fd: TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read()) @classmethod - def TestFile(self, fname): - return os.path.join(self._binman_dir, 'test', fname) + def TestFile(cls, fname): + return os.path.join(cls._binman_dir, 'test', fname) def AssertInList(self, grep_list, target): """Assert that at least one of a list of things is in a target