From patchwork Thu Apr 21 15:40:54 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: 613165 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 3qrNKD2VrFz9t5T for ; Fri, 22 Apr 2016 01:41:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 876EDA7782; Thu, 21 Apr 2016 17:41:47 +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 p-m3x78I6cSa; Thu, 21 Apr 2016 17:41:47 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 12113A7716; Thu, 21 Apr 2016 17:41:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D0425A7705 for ; Thu, 21 Apr 2016 17:41:43 +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 Gu2sfsAwUh60 for ; Thu, 21 Apr 2016 17:41:43 +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 mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by theia.denx.de (Postfix) with ESMTPS id 8F61EA777D for ; Thu, 21 Apr 2016 17:41:35 +0200 (CEST) Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O5Z02T5ZQ98JHC0@mailout3.samsung.com> for u-boot@lists.denx.de; Fri, 22 Apr 2016 00:41:32 +0900 (KST) X-AuditID: cbfee61a-f79a86d000001a1a-e4-5718f4ac4eed Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 02.3A.06682.CA4F8175; Fri, 22 Apr 2016 00:41:32 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O5Z00G3RQ89VF60@mmp2.samsung.com>; Fri, 22 Apr 2016 00:41:32 +0900 (KST) From: Lukasz Majewski To: u-boot@lists.denx.de, Stephen Warren , Stephen Warren Date: Thu, 21 Apr 2016 17:40:54 +0200 Message-id: <1461253254-30587-3-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1461253254-30587-1-git-send-email-l.majewski@samsung.com> References: <1460130291-24223-1-git-send-email-l.majewski@samsung.com> <1461253254-30587-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t9jQd01XyTCDV7cV7bYOGM9q8XDq/4W O+7cZ7Z484jb4s3DzYwWb9oaGS12XL7BYnFg7nsWi29btjFa3Jjewmrx6mAbi8XbvZ3sDjwe sxsusnjMm3WCxWPnrLvsHmfv7GD0WDftLbNHb/M7No++LasYPbafnMTksXFuaABnFJdNSmpO Zllqkb5dAlfGhSuf2Qq+SlZsnDidsYGxWaSLkZNDQsBE4vPWl8wQtpjEhXvr2boYuTiEBGYx Shx8sYwVwvnDKDHv8Ds2kCo2AT2Jz3efMoHYIgLpEjfPbWICKWIWOM4ksXfqDHaQhLBAhsSm vXfBxrIIqEo0tzSBNfAKuEncm9EJtU5RovvZBKChHBycAu4S9+8pQixrZpRY/P4m+wRG3gWM DKsYJVILkguKk9JzDfNSy/WKE3OLS/PS9ZLzczcxgoP2mdQOxoO73A8xCnAwKvHwbpCRCBdi TSwrrsw9xCjBwawkwnv0E1CINyWxsiq1KD++qDQntfgQozQHi5I47+P/68KEBNITS1KzU1ML UotgskwcnFINjAoPWz4283m/n3ZEg9ct6fAlY8Yidfc3x2ZP4cwXeNsQO6fkxh+PyMPTzaUV WVoOnCu77X6g7mhu/wWRqXFXWs9E+/eeW9di8lTW5I77Hb079f9qpwj8En/PHNZQMVd16aG4 Z+yX9u4/f19n7eYlt9zeX2a4klMfYpOi1bPlr2PWW3s94djuz0osxRmJhlrMRcWJAJncd+FW AgAA Cc: Marek Vasut , b.zolnierkie@samsung.com, Samuel Egli , Przemyslaw Marczak Subject: [U-Boot] [PATCH v3 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings 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" After concatenation of "dfu_alt_info" variable from "dfu_alt_boot" and "dfu_alt_system" it may happen that test and dummy files alt settings are different than default 0 and 1. This patch provides the ability to set different values for them. Signed-off-by: Lukasz Majewski --- Changes for v3: - replace variables declarations with ones read from configuration file - remove not necessary str() conversion at DFU host command generation Changes for v2: - generate "alt_info" automatically - use file names as alt settings instead of numerical values - extend in-code documentation --- test/py/tests/test_dfu.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py index 0442af8..8649d87 100644 --- a/test/py/tests/test_dfu.py +++ b/test/py/tests/test_dfu.py @@ -30,6 +30,13 @@ env__usb_dev_ports = ( }, ) +# Optional entries (required only when "alt_id_test_file" and +# "alt_id_dummy_file" are specified). +test_file_name = "/dfu_test.bin" +dummy_file_name = "/dfu_dummy.bin" +# Above files are used to generate proper "alt_info" entry +"alt_info": "/%s ext4 0 2;/%s ext4 0 2" % (test_file_name, dummy_file_name), + env__dfu_configs = ( # eMMC, partition 1 { @@ -52,6 +59,16 @@ env__dfu_configs = ( # $dfu_alt_info, each time the dfu command is run, by concatenating # $dfu_alt_boot and $dfu_alt_system. "alt_info_env_name": "dfu_alt_system", + # This value is optional. + # For boards which require the "test file" alt setting number other than + # default (0) it is possible to specify exact file name to be used as + # this parameter. + "alt_id_test_file": test_file_name, + # This value is optional. + # For boards which require the "dummy file" alt setting number other + # than default (1) it is possible to specify exact file name to be used + # as this parameter. + "alt_id_dummy_file": dummy_file_name, }, ) @@ -107,10 +124,6 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): Nothing. """ - # Default alt settings for test and dummy files - alt_setting_test_file = 0 - alt_setting_dummy_file = 1 - def start_dfu(): """Start U-Boot's dfu shell command. @@ -188,7 +201,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): Nothing. """ - cmd = ['dfu-util', '-a', str(alt_setting), up_dn_load_arg, fn] + cmd = ['dfu-util', '-a', alt_setting, up_dn_load_arg, fn] if 'host_usb_port_path' in env__usb_dev_port: cmd += ['-p', env__usb_dev_port['host_usb_port_path']] u_boot_utils.run_and_log(u_boot_console, cmd) @@ -276,6 +289,9 @@ def test_dfu(u_boot_console, env__usb_dev_port, env__dfu_config): dummy_f = u_boot_utils.PersistentRandomFile(u_boot_console, 'dfu_dummy.bin', 1024) + alt_setting_test_file = env__dfu_config.get('alt_id_test_file', '0') + alt_setting_dummy_file = env__dfu_config.get('alt_id_dummy_file', '1') + ignore_cleanup_errors = True try: start_dfu()