From f3c0ea3664fea45233413ebabe29575b778f55aa Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 27 Jul 2016 16:47:23 -0500 Subject: [PATCH 1/2] [tools] Fixed precedence issue in cumulative attribute set-arithmetic Basically this: a | b - c != (a | b) - c --- tools/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/config.py b/tools/config.py index c0af0848968..dbc5c0afef4 100644 --- a/tools/config.py +++ b/tools/config.py @@ -169,7 +169,8 @@ def strict_cumulative_overrides(self, overrides): def update_target(self, target): setattr(target, self.name, list( - set(getattr(target, self.name, [])) | self.additions - self.removals)) + (set(getattr(target, self.name, [])) | self.additions) - self.removals)) + # 'Config' implements the mbed configuration mechanism From 63f9b03e3561605637e28ad8c57f8b2beef75293 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 27 Jul 2016 18:01:33 -0500 Subject: [PATCH 2/2] [tools] Added test for removing features --- tools/test/config_test/test27/lib1/mbed_lib.json | 8 ++++++++ tools/test/config_test/test27/mbed_app.json | 11 +++++++++++ tools/test/config_test/test27/test_data.py | 8 ++++++++ 3 files changed, 27 insertions(+) create mode 100644 tools/test/config_test/test27/lib1/mbed_lib.json create mode 100644 tools/test/config_test/test27/mbed_app.json create mode 100644 tools/test/config_test/test27/test_data.py diff --git a/tools/test/config_test/test27/lib1/mbed_lib.json b/tools/test/config_test/test27/lib1/mbed_lib.json new file mode 100644 index 00000000000..415bbe941fb --- /dev/null +++ b/tools/test/config_test/test27/lib1/mbed_lib.json @@ -0,0 +1,8 @@ +{ + "name": "lib1", + "target_overrides": { + "*": { + "target.features_remove": ["IPV4"] + } + } +} diff --git a/tools/test/config_test/test27/mbed_app.json b/tools/test/config_test/test27/mbed_app.json new file mode 100644 index 00000000000..b9695ed925d --- /dev/null +++ b/tools/test/config_test/test27/mbed_app.json @@ -0,0 +1,11 @@ +{ + "custom_targets": { + "test_target": { + "core": "Cortex-M0", + "extra_labels": [], + "features": ["IPV4"], + "default_build": "standard" + } + } +} + diff --git a/tools/test/config_test/test27/test_data.py b/tools/test/config_test/test27/test_data.py new file mode 100644 index 00000000000..53853318a43 --- /dev/null +++ b/tools/test/config_test/test27/test_data.py @@ -0,0 +1,8 @@ +# Testing when adding two features + +expected_results = { + "test_target": { + "desc": "test removing features", + "expected_features": [] + } +}