From patchwork Fri Apr 8 15:44:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 608059 X-Patchwork-Delegate: l.majewski@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qhP1T3zPSz9t5l for ; Sat, 9 Apr 2016 01:45:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 09BAAA764C; Fri, 8 Apr 2016 17:45:31 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j9D9jCV6d7xC; Fri, 8 Apr 2016 17:45:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4EC8AA75B9; Fri, 8 Apr 2016 17:45:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8CCFDA75B9 for ; Fri, 8 Apr 2016 17:45:26 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a9nKeGHnyg89 for ; Fri, 8 Apr 2016 17:45:26 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTPS id 14454A7531 for ; Fri, 8 Apr 2016 17:45:22 +0200 (CEST) Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O5B02IEENRIHT70@mailout1.samsung.com> for u-boot@lists.denx.de; Sat, 09 Apr 2016 00:45:18 +0900 (KST) X-AuditID: cbfee61a-f79a86d000001a1a-08-5707d20d501d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 27.A3.06682.D02D7075; Sat, 9 Apr 2016 00:45:17 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O5B00GQFNQU5X90@mmp1.samsung.com>; Sat, 09 Apr 2016 00:45:17 +0900 (KST) From: Lukasz Majewski To: u-boot@lists.denx.de, Stephen Warren , Stephen Warren Date: Fri, 08 Apr 2016 17:44:49 +0200 Message-id: <1460130291-24223-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jAV3eS+zhBq3PbSw2zljPavHwqr/F jjv3mS3ePOK2ePNwM6PFm7ZGRosdl2+wWByY+57F4tuWbYwWN6a3sFq8OtjGYvF2bye7A4/H 7IaLLB7zZp1g8dg56y67x9k7Oxg91k17y+zR2/yOzaNvyypGj+0nJzF5bJwbGsAZxWWTkpqT WZZapG+XwJUx5c5MpoIOgYo1p4oaGA/zdDFyckgImEicXHedCcIWk7hwbz1bFyMXh5DAUkaJ xvl/mUESQgJ/GCUWPcgAsdkE9CQ+330K1iAikC5x89wmJpAGZoHjTBJ7p85gB0kIC+RKtL28 CVbEIqAq8fjSK7A4r4CbxPzHL9ggtilKdD+bwDaBkXsBI8MqRonUguSC4qT0XMO81HK94sTc 4tK8dL3k/NxNjOAAfCa1g/HgLvdDjAIcjEo8vBfes4ULsSaWFVfmHmKU4GBWEuENPc8eLsSb klhZlVqUH19UmpNafIhRmoNFSZz38f91YUIC6YklqdmpqQWpRTBZJg5OqQbG3TURZTwntdQm TVt9c7/05Ger5gm7a9i+OByXlH7tyw/OoHk7vn6Kfbpu11a7e4HRW57WTttYHr9MXevEdn75 W+XL/nr/Pe97xu7gvAab1Xcuc2wuSJW46JZ6+LPYBMmjTyz/3/zNG52uascge/7+OiOFTbMF dY1YIw50W3jccS+68+3gxH43FSWW4oxEQy3mouJEAJnB5kg8AgAA Cc: Marek Vasut , b.zolnierkie@samsung.com, Samuel Egli , Przemyslaw Marczak Subject: [U-Boot] [PATCH 1/3] tests: py: dfu: Add global variables to store dfu alt numbers for test and dummy files X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch replaces hardcoded (i.e. 0 and 1) values passed to dfu_{read|write} with global variables. Signed-off-by: Lukasz Majewski --- test/py/tests/test_dfu.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py index 093e8d0..df3b561 100644 --- a/test/py/tests/test_dfu.py +++ b/test/py/tests/test_dfu.py @@ -80,6 +80,10 @@ test_sizes_default = ( first_usb_dev_port = None +# Default alt settings for test and dummy files +alt_setting_test_file = 0 +alt_setting_dummy_file = 1 + @pytest.mark.buildconfigspec('cmd_dfu') def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): """Test the "dfu" command; the host system must be able to enumerate a USB @@ -229,15 +233,15 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): u_boot_console.log.action('Writing test data to DFU primary ' + 'altsetting') - dfu_write(0, test_f.abs_fn) + dfu_write(alt_setting_test_file, test_f.abs_fn) u_boot_console.log.action('Writing dummy data to DFU secondary ' + 'altsetting to clear DFU buffers') - dfu_write(1, dummy_f.abs_fn) + dfu_write(alt_setting_dummy_file, dummy_f.abs_fn) u_boot_console.log.action('Reading DFU primary altsetting for ' + 'comparison') - dfu_read(0, readback_fn) + dfu_read(alt_setting_test_file, readback_fn) u_boot_console.log.action('Comparing written and read data') written_hash = test_f.content_hash @@ -266,7 +270,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): u_boot_console.log.action( 'Overwriting DFU primary altsetting with dummy data') - dfu_write(0, dummy_f.abs_fn) + dfu_write(alt_setting_test_file, dummy_f.abs_fn) for size in sizes: with u_boot_console.log.section('Data size %d' % size):