enhance update_build_option to return original value + add support for update_build_options#3923
Conversation
…turns the original value. This allows us to easily restore it. Also, added an update_build_options function that takes a dictionary and calls update_build_option for each key-value pair in the dictionary
…an extra white line after the function ends.
boegel
left a comment
There was a problem hiding this comment.
@casparvl We should enhance the existing test for update_build_option in test/framework/config.py to verify the return value too, and we should add a test for update_build_options as well (can be added to the existing test_update_build_option imho)
Correct grammar Co-authored-by: Kenneth Hoste <[email protected]>
Make function description more generic for maintainability Co-authored-by: Kenneth Hoste <[email protected]>
…dded a update_build_options unit test
You're right. I added a test for the returned value. Also, I included a test for |
|
Hm, I'm looking at the one failing test, but not sure what's wrong there. Seems to be a part of the code that I didn't touch at all, and only in one of the build configurations. A fluke? Can I trigger a rerun of the test suite (in some way more elegant than a recommit?) |
Yes, that's a fluke... That test fails occasionally, and it has proven quite difficult to chase it down. Please open an issue on it. I'll retrigger the tests for this PR. |
To be able to define (per-)EasyConfig specific options in an
EasyStackfile, as discussed here we need to easily be able to set entire dictionaries of new configuration options - and restore them to their original values later.This PR provides that functionality by
extending
update_build_optionso that it returns the original value (so it can later be restored)implementing
update_build_options, which takes a dictionary, callsupdate_build_optionon each key-value pair in the dictionary, and collects & returns the original values for each in another dictionary. This allows one to call anotherupdate_build_optionson the returned dictionary to reset the original values.Example usage:
Of course, the
opts_per_ecwould normally not be hardcoded, but will (eventually) be returned by theparse_easystackfunction if it encounters EasyConfig-specific options in the EasyStack file.