
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.
"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.
or:
(b) Use names rather than numbers for the alt setting? 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.