Runtime reporting of the conversion errors.
Bug: 204062171 Test: rbcrun build/make/tests/conversion_error.rbc (displays a message, stops) rbcrun RBC_MK2RBC_CONTINUE=t build/make/tests/conversion_error.rbc (displays a message and continues) Change-Id: Idf0fe6bbb08b1eca1f392d81950eed4a214f3289
This commit is contained in:
@@ -549,6 +549,18 @@ def _mkwarning(file, message = ""):
|
|||||||
"""Prints warning."""
|
"""Prints warning."""
|
||||||
rblf_log(file, "warning", message, sep = ':')
|
rblf_log(file, "warning", message, sep = ':')
|
||||||
|
|
||||||
|
def _mk2rbc_error(loc, message):
|
||||||
|
"""Prints a message about conversion error and stops.
|
||||||
|
|
||||||
|
If RBC_MK2RBC_CONTINUE environment variable is set,
|
||||||
|
the execution will continue after the message is printed.
|
||||||
|
"""
|
||||||
|
if _options.mk2rbc_continue:
|
||||||
|
rblf_log(loc, message, sep = ':')
|
||||||
|
else:
|
||||||
|
_mkerror(loc, message)
|
||||||
|
|
||||||
|
|
||||||
def _mkinfo(file, message = ""):
|
def _mkinfo(file, message = ""):
|
||||||
"""Prints info."""
|
"""Prints info."""
|
||||||
rblf_log(message)
|
rblf_log(message)
|
||||||
@@ -659,6 +671,7 @@ def __get_options():
|
|||||||
rearrange = "",
|
rearrange = "",
|
||||||
trace_modules = False,
|
trace_modules = False,
|
||||||
trace_variables = [],
|
trace_variables = [],
|
||||||
|
mk2rbc_continue = False,
|
||||||
)
|
)
|
||||||
for x in getattr(rblf_cli, "RBC_OUT", "").split(","):
|
for x in getattr(rblf_cli, "RBC_OUT", "").split(","):
|
||||||
if x == "sort" or x == "unique":
|
if x == "sort" or x == "unique":
|
||||||
@@ -676,6 +689,8 @@ def __get_options():
|
|||||||
settings["trace_modules"] = True
|
settings["trace_modules"] = True
|
||||||
elif x != "":
|
elif x != "":
|
||||||
settings["trace_variables"].append(x)
|
settings["trace_variables"].append(x)
|
||||||
|
if getattr(rblf_cli, "RBC_MK2RBC_CONTINUE", ""):
|
||||||
|
settings["mk2rbc_continue"] = True
|
||||||
return struct(**settings)
|
return struct(**settings)
|
||||||
|
|
||||||
# Settings used during debugging.
|
# Settings used during debugging.
|
||||||
@@ -703,6 +718,7 @@ rblf = struct(
|
|||||||
init_globals = _init_globals,
|
init_globals = _init_globals,
|
||||||
inherit = _inherit,
|
inherit = _inherit,
|
||||||
indirect = _indirect,
|
indirect = _indirect,
|
||||||
|
mk2rbc_error = _mk2rbc_error,
|
||||||
mkdist_for_goals = _mkdist_for_goals,
|
mkdist_for_goals = _mkdist_for_goals,
|
||||||
mkinfo = _mkinfo,
|
mkinfo = _mkinfo,
|
||||||
mkerror = _mkerror,
|
mkerror = _mkerror,
|
||||||
|
27
tests/conversion_error.rbc
Normal file
27
tests/conversion_error.rbc
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
# Run test configuration and verify its result.
|
||||||
|
# The main configuration file is device.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
|
||||||
|
# * all runtime functions (wildcard, regex, etc.) work
|
||||||
|
|
||||||
|
load("//build/make/core:product_config.rbc", "rblf")
|
||||||
|
load(":version_defaults.rbc", "version_defaults")
|
||||||
|
load(":device.rbc", "init")
|
||||||
|
|
||||||
|
rblf.mk2rbc_error("file.mk:123", "cannot convert")
|
Reference in New Issue
Block a user