blob: 64781596a8ab0ce47c3ff8efe4e19dcdaed358ca [file] [log] [blame]
Sasha Smundak5c8b09b2020-11-03 23:44:14 -08001# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16# Run test configuration and verify its result.
17# The main configuration file is device.rbc.
18# It inherits part1.rbc and also includes include1.rbc
19# TODO(asmundak): more tests are needed to verify that:
20# * multi-level inheritance works as expected
21# * all runtime functions (wildcard, regex, etc.) work
22
23load("//build/make/core:product_config.rbc", "rblf")
24load(":device.rbc", "init")
25
26def assert_eq(expected, actual):
27 if expected != actual:
28 fail("Expected %s, got %s" % (expected, actual))
29
Sasha Smundakbe4ebca2021-06-10 12:12:28 -070030# Unit tests for non-trivial runtime functions
31assert_eq("", rblf.mkstrip(" \n \t "))
32assert_eq("a b c", rblf.mkstrip(" a b \n c \t"))
Sasha Smundak5c8b09b2020-11-03 23:44:14 -080033
34globals, config = rblf.product_configuration("test/device", init)
35assert_eq(
36 {
37 "PRODUCT_COPY_FILES": [
38 "part_from:part_to",
39 "device_from:device_to",
40 "device/google/redfin/audio/audio_platform_info_noextcodec_snd.xml:||VENDOR-PATH-PH||/etc/audio_platform_info_noextcodec_snd.xml",
41 "xyz"
42 ],
43 "PRODUCT_HOST_PACKAGES": ["host"],
44 "PRODUCT_PACKAGES": [
45 "dev",
46 "inc",
47 "dev_after"
48 ],
49 "PRODUCT_PRODUCT_PROPERTIES": ["part_properties"]
50 },
51 { k:v for k, v in sorted(config.items()) }
52)