Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f900cb4c authored by Cole Faust's avatar Cole Faust Committed by Gerrit Code Review
Browse files

Merge "Correctly copy the board configuration input variables"

parents 3db143c4 3be5b72a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -228,13 +228,15 @@ def _dictionary_difference(a, b):
    return result

def _board_configuration(board_config_init, input_variables_init):
    globals_base = {}
    h_base = __h_new()
    globals = {}
    h = __h_new()

    input_variables_init(globals_base, h_base)
    input_variables_init(globals, h)
    cfg_base = dict(**h[0])
    globals_base = dict(**globals)
    board_config_init(globals, h)
    return (globals, _dictionary_difference(h[0], cfg_base), globals_base)
    return (globals, _dictionary_difference(h[0], h_base[0]), globals_base)


def _substitute_inherited(configs, pcm_name, cfg):

tests/board.rbc

0 → 100644
+19 −0
Original line number Diff line number Diff line
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//build/make/core:product_config.rbc", "rblf")

def init(g, handle):
  cfg = rblf.cfg(handle)
  g["A_LIST_VARIABLE"] += ["bar"]
+19 −0
Original line number Diff line number Diff line
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//build/make/core:product_config.rbc", "rblf")

def init(g, handle):
  cfg = rblf.cfg(handle)
  g["A_LIST_VARIABLE"] = ["foo"]
+0 −0

File moved.

+9 −3
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
# limitations under the License.


# Run test configuration and verify its result.
# The main configuration file is device.rbc.
# Run test product configuration and verify its result.
# The main configuration file is product.rbc.
# It inherits part1.rbc and also includes include1.rbc
# TODO(asmundak): more tests are needed to verify that:
#  * multi-level inheritance works as expected
@@ -22,7 +22,9 @@

load("//build/make/core:product_config.rbc", "rblf")
load(":version_defaults.rbc", "version_defaults")
load(":device.rbc", "init")
load(":product.rbc", "init")
load(":board.rbc", board_init = "init")
load(":board_input_vars.rbc", board_input_vars_init = "init")

def assert_eq(expected, actual):
    if expected != actual:
@@ -110,3 +112,7 @@ assert_eq(
    },
    { k:v for k,v in sorted(goals.items()) }
)

(board_globals, board_config, board_globals_base) = rblf.board_configuration(board_init, board_input_vars_init)
assert_eq({"A_LIST_VARIABLE": ["foo", "bar"]}, board_globals)
assert_eq({"A_LIST_VARIABLE": ["foo"]}, board_globals_base)