aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSasha Smundak <asmundak@google.com>2021-05-04 09:01:16 -0700
committerSasha Smundak <asmundak@google.com>2021-09-17 11:00:29 -0700
commitb2220c29904e55ba4719553f56e3448456c45081 (patch)
treed91dd034b5b4b46e240f074b04f76c94126116ce /tests
parent1646ba08142d28f4ab4950df83e13def5fc8b7ba (diff)
downloadbuild-b2220c29904e55ba4719553f56e3448456c45081.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/run.rbc9
-rw-r--r--tests/version_defaults.rbc11
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/run.rbc b/tests/run.rbc
index 2c15b8105c..eef217ba75 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(["from/a:to/a", "from/b:to/b"], rblf.product_copy_files_by_pattern("fr
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 @@ assert_eq(
},
{k:v for k, v in sorted(ns.items()) }
)
+
+assert_eq("S", globals["PLATFORM_VERSION"])
+assert_eq(30, globals["PLATFORM_SDK_VERSION"])
diff --git a/tests/version_defaults.rbc b/tests/version_defaults.rbc
new file mode 100644
index 0000000000..9b35b575d6
--- /dev/null
+++ b/tests/version_defaults.rbc
@@ -0,0 +1,11 @@
+version_defaults = struct(
+ codenames = { "SP1A" : "S" },
+ default_platform_version = "SP1A",
+ max_platform_version = "SP1A",
+ min_platform_version = "SP1A",
+ platform_base_sdk_extension_version = 0,
+ platform_sdk_extension_version = 1,
+ platform_sdk_version = 30,
+ platform_security_patch = "2021-08-05",
+ platform_version_last_stable = 11,
+)