1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "linkerconfig/variables.h"
19 
MockGenericVariables()20 inline void MockGenericVariables() {
21   android::linkerconfig::modules::Variables::AddValue("ro.treble.enabled",
22                                                       "true");
23   android::linkerconfig::modules::Variables::AddValue("ro.vndk.version", "99");
24   android::linkerconfig::modules::Variables::AddValue("ro.product.vndk.version",
25                                                       "99");
26   android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
27                                                       "99");
28   android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
29                                                       "99");
30   android::linkerconfig::modules::Variables::AddValue("PRODUCT", "product");
31   android::linkerconfig::modules::Variables::AddValue("SYSTEM_EXT",
32                                                       "system_ext");
33   android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_VENDOR",
34                                                       "llndk_libraries");
35   android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_PRODUCT",
36                                                       "llndk_libraries");
37   android::linkerconfig::modules::Variables::AddValue(
38       "SANITIZER_RUNTIME_LIBRARIES", "sanitizer_runtime_libraries");
39   android::linkerconfig::modules::Variables::AddValue(
40       "PRIVATE_LLNDK_LIBRARIES_VENDOR", "private_llndk_libraries");
41   android::linkerconfig::modules::Variables::AddValue(
42       "PRIVATE_LLNDK_LIBRARIES_PRODUCT", "private_llndk_libraries");
43   android::linkerconfig::modules::Variables::AddValue(
44       "VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "vndk_sameprocess_libraries");
45   android::linkerconfig::modules::Variables::AddValue(
46       "VNDK_SAMEPROCESS_LIBRARIES_PRODUCT", "vndk_sameprocess_libraries");
47   android::linkerconfig::modules::Variables::AddValue(
48       "VNDK_CORE_LIBRARIES_VENDOR", "vndk_core_libraries");
49   android::linkerconfig::modules::Variables::AddValue(
50       "VNDK_CORE_LIBRARIES_PRODUCT", "vndk_core_libraries");
51   android::linkerconfig::modules::Variables::AddValue(
52       "VNDK_USING_CORE_VARIANT_LIBRARIES", "");
53   android::linkerconfig::modules::Variables::AddValue(
54       "SANITIZER_DEFAULT_VENDOR", "sanitizer_default_libraries");
55   android::linkerconfig::modules::Variables::AddValue(
56       "SANITIZER_DEFAULT_PRODUCT", "sanitizer_default_libraries");
57 }
58 
MockVndkVersion(std::string vndk_version)59 inline void MockVndkVersion(std::string vndk_version) {
60   android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
61                                                       vndk_version);
62   android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
63                                                       vndk_version);
64 }
65 
MockVndkUsingCoreVariant()66 inline void MockVndkUsingCoreVariant() {
67   android::linkerconfig::modules::Variables::AddValue(
68       "VNDK_USING_CORE_VARIANT_LIBRARIES", "vndk_using_core_variant_libraries");
69 }
70 
CreateTestVndkApex()71 inline android::linkerconfig::modules::ApexInfo CreateTestVndkApex() {
72   android::linkerconfig::modules::ApexInfo vndk_apex;
73   vndk_apex.name = "com.android.vndk.v99";
74   return vndk_apex;
75 }
76