Make global config depend on version defaults.
Starlark-based product configuration can now share version settings
with makefile product config (mk2rbc converts version_defaults.mk into
version_defaults.rbc which is consumed by runtime initialization).
Bug: 198995713
Test: rbcrun build/make/tests/run.rbc
Change-Id: I1d3ddfed3b15d346b3e10714a195a9f0a3a55a56
diff --git a/tests/run.rbc b/tests/run.rbc
index 2c15b81..eef217b 100644
--- a/tests/run.rbc
+++ b/tests/run.rbc
@@ -21,15 +21,17 @@
# * 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")
def assert_eq(expected, actual):
if expected != actual:
- fail("Expected %s, got %s" % (expected, actual))
+ fail("Expected '%s', got '%s'" % (expected, actual))
# Unit tests for non-trivial runtime functions
assert_eq("", rblf.mkstrip(" \n \t "))
assert_eq("a b c", rblf.mkstrip(" a b \n c \t"))
+assert_eq(1, rblf.mkstrip(1))
assert_eq("b1 b2", rblf.mksubst("a", "b", "a1 a2"))
assert_eq(["b1", "x2"], rblf.mksubst("a", "b", ["a1", "x2"]))
@@ -50,7 +52,7 @@
assert_eq([], rblf.filter(["a", "", "b"], "f"))
assert_eq(["", "b"], rblf.filter_out(["a", "" ], ["a", "", "b"] ))
-globals, config = rblf.product_configuration("test/device", init)
+(globals, config, globals_base) = rblf.product_configuration("test/device", init, version_defaults)
assert_eq(
{
"PRODUCT_COPY_FILES": [
@@ -87,3 +89,6 @@
},
{k:v for k, v in sorted(ns.items()) }
)
+
+assert_eq("S", globals["PLATFORM_VERSION"])
+assert_eq(30, globals["PLATFORM_SDK_VERSION"])