public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings
Date: Mon, 11 Apr 2016 10:42:32 +0200	[thread overview]
Message-ID: <20160411104232.775b8d03@amdc2363> (raw)
In-Reply-To: <5707DD96.80103@wwwdotorg.org>

Hi Stephen,

> On 04/08/2016 09:44 AM, Lukasz Majewski wrote:
> > 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 ability to set different values for them.
> > It was the simplest possible solution - akin to the one from
> > original bash dfu tests.
> 
> > diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
> 
> > +        # - after concatenation dfu alt settings for test and
> > dummy files are
> > +        #   moved from 0 and 1 to other values
> 
> Similar formatting comments to the previous patch. I'd also re-word
> this to be much more generic, and simply state the it allows
> different alt settings to be used, rather than tieing the description
> to one possible reason why you might want to do that.

Ok, I will rewrite the description.

> 
> > +        "alt_num_test_file": "5",
> > +        "alt_num_dummy_file": "6",
> 
> This feels fragile. What if $dfu_alt_boot changes length? Does it
> make more sense to:
> 
> (a) Set alt_info_env_name to dfu_alt_boot instead, so that the
> settings specified by the test are always at a known position in the
> list, so we can always use alt setting 0 and 1.

Unfortunately, dfu_alt_boot (which depends on boot medium) is
immutable and set during boot time from CONFIG_DFU_ALT_BOOT_SD and
CONFIG_DFU_ALT_BOOT_EMMC

Only "dfu_alt_system" can be set by user.

> 
> or:
> 
> (b) Use names rather than numbers for the alt setting? 

I thought about this option. 

1. One possible solution would be to define:

"test_file_name": "file.bin"
"dummy_file_name": "dummy.bin"

at env__dfu_configs.

Afterwards, I could automatically set the "alt_info" property int the
same map:

"alt_info" : "%s ext4 0 2; %s ext4 0 2" % (test_file_name,
dummy_file_name)

As a result, I could use -a {test_file_name|dummy_file_name} to access
proper alt setting.



2. Another option would be to set the "dfu_alt_system" env variable and
then run "dfu-util -l" on host (or 'dfu 0 mmc 0 list') on target and
grep output for test_file_name and dummy_file_name and extract alt
setting numbers. 
This would require modification in the framework core code and hence I
decided to manually specify the alt settings number (as I did in the
bash version of those scripts).

However, as I look now for it, I think that option from point 1) seems
flexible enough. Stephen what do you think about it?

> Those should
> be position-independent. Presumably this would require a slightly
> large code change, since we'd need to move from %d to %s conversions
> when constructing the dfu command string, but that should be very
> easy.
> 
> If you take this approach, I'd suggest making the configuration file 
> name (alt_num_*_file above) match the Python variable name 
> (alt_setting_*_file) for consistency.
> 
> (c) Provide a way for the user to turn off the auto-concatenation
> feature.

This feature is already deployed and I would like to avoid changing it.

> 

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2016-04-11  8:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08 15:44 [U-Boot] [PATCH 1/3] tests: py: dfu: Add global variables to store dfu alt numbers for test and dummy files Lukasz Majewski
2016-04-08 15:44 ` [U-Boot] [PATCH 2/3] tests: py: dfu: Add functionality to set different u-boot's dfu env variable Lukasz Majewski
2016-04-08 16:28   ` Stephen Warren
2016-04-08 20:10     ` Lukasz Majewski
2016-04-08 16:29   ` Stephen Warren
2016-04-08 20:11     ` Lukasz Majewski
2016-04-08 15:44 ` [U-Boot] [PATCH 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings Lukasz Majewski
2016-04-08 16:34   ` Stephen Warren
2016-04-11  8:42     ` Lukasz Majewski [this message]
2016-04-11 17:05       ` Stephen Warren
2016-04-12  8:33         ` Lukasz Majewski
2016-04-19 15:51 ` [U-Boot] [PATCH v2 1/3] tests: py: dfu: Add global variables to store dfu alt numbers for test and dummy files Lukasz Majewski
2016-04-19 15:51   ` [U-Boot] [PATCH v2 2/3] tests: py: dfu: Add functionality to set different u-boot's dfu env variable Lukasz Majewski
2016-04-19 15:51   ` [U-Boot] [PATCH v2 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings Lukasz Majewski
2016-04-19 16:25     ` Stephen Warren
2016-04-20  9:40       ` Lukasz Majewski
2016-04-20 15:55         ` Stephen Warren
2016-04-19 16:22   ` [U-Boot] [PATCH v2 1/3] tests: py: dfu: Add global variables to store dfu alt numbers for test and dummy files Stephen Warren
2016-04-19 16:30     ` Lukasz Majewski
2016-04-21 15:40 ` [U-Boot] [PATCH v3 1/3] tests: py: dfu: Add " Lukasz Majewski
2016-04-21 15:40   ` [U-Boot] [PATCH v3 2/3] tests: py: dfu: Add functionality to set different u-boot's dfu env variable Lukasz Majewski
2016-04-21 15:40   ` [U-Boot] [PATCH v3 3/3] tests: py: dfu: Provide functionality to set test and dummy files alt settings Lukasz Majewski
2016-04-21 16:10   ` [U-Boot] [PATCH v3 1/3] tests: py: dfu: Add variables to store dfu alt numbers for test and dummy files Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160411104232.775b8d03@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox