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("VENDOR_VNDK_VERSION",
22 "99");
23 android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
24 "99");
25 android::linkerconfig::modules::Variables::AddValue("PRODUCT", "product");
26 android::linkerconfig::modules::Variables::AddValue("SYSTEM_EXT",
27 "system_ext");
28 android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_VENDOR",
29 "llndk_libraries");
30 android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_PRODUCT",
31 "llndk_libraries");
32 android::linkerconfig::modules::Variables::AddValue(
33 "SANITIZER_RUNTIME_LIBRARIES", "sanitizer_runtime_libraries");
34 android::linkerconfig::modules::Variables::AddValue(
35 "PRIVATE_LLNDK_LIBRARIES_VENDOR", "private_llndk_libraries");
36 android::linkerconfig::modules::Variables::AddValue(
37 "PRIVATE_LLNDK_LIBRARIES_PRODUCT", "private_llndk_libraries");
38 android::linkerconfig::modules::Variables::AddValue(
39 "VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "vndk_sameprocess_libraries");
40 android::linkerconfig::modules::Variables::AddValue(
41 "VNDK_SAMEPROCESS_LIBRARIES_PRODUCT", "vndk_sameprocess_libraries");
42 android::linkerconfig::modules::Variables::AddValue(
43 "VNDK_CORE_LIBRARIES_VENDOR", "vndk_core_libraries");
44 android::linkerconfig::modules::Variables::AddValue(
45 "VNDK_CORE_LIBRARIES_PRODUCT", "vndk_core_libraries");
46 android::linkerconfig::modules::Variables::AddValue(
47 "VNDK_USING_CORE_VARIANT_LIBRARIES", "");
48 android::linkerconfig::modules::Variables::AddValue(
49 "SANITIZER_DEFAULT_VENDOR", "sanitizer_default_libraries");
50 android::linkerconfig::modules::Variables::AddValue(
51 "SANITIZER_DEFAULT_PRODUCT", "sanitizer_default_libraries");
52 }
53
MockVndkVersion(std::string vndk_version)54 inline void MockVndkVersion(std::string vndk_version) {
55 android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
56 vndk_version);
57 android::linkerconfig::modules::Variables::AddValue("PRODUCT_VNDK_VERSION",
58 vndk_version);
59 }
60
MockVndkUsingCoreVariant()61 inline void MockVndkUsingCoreVariant() {
62 android::linkerconfig::modules::Variables::AddValue(
63 "VNDK_USING_CORE_VARIANT_LIBRARIES", "vndk_using_core_variant_libraries");
64 }
65
GenerateContextWithVndk()66 inline android::linkerconfig::contents::Context GenerateContextWithVndk() {
67 android::linkerconfig::modules::ApexInfo vndk_apex;
68 vndk_apex.name = "com.android.vndk.v99";
69
70 android::linkerconfig::contents::Context ctx;
71 ctx.AddApexModule(vndk_apex);
72
73 return ctx;
74 }
75