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 
20 inline void MockVndkVariables(std::string partition, std::string vndk_ver) {
21   using android::linkerconfig::modules::Variables;
22 
23   Variables::AddValue(partition + "_VNDK_VERSION", vndk_ver);
24   Variables::AddValue("LLNDK_LIBRARIES_" + partition, "llndk_libraries");
25   Variables::AddValue("PRIVATE_LLNDK_LIBRARIES_" + partition,
26                       "private_llndk_libraries");
27   Variables::AddValue("VNDK_SAMEPROCESS_LIBRARIES_" + partition,
28                       "vndk_sameprocess_libraries");
29   Variables::AddValue("VNDK_CORE_LIBRARIES_" + partition, "vndk_core_libraries");
30   Variables::AddValue("SANITIZER_DEFAULT_" + partition,
31                       "sanitizer_default_libraries");
32 }
33 
34 inline void MockVariables(std::string vndk_ver = "Q") {
35   using android::linkerconfig::modules::Variables;
36 
37   MockVndkVariables("VENDOR", vndk_ver);
38   Variables::AddValue("ro.vndk.version", vndk_ver);
39 
40   MockVndkVariables("PRODUCT", vndk_ver);
41   Variables::AddValue("ro.product.vndk.version", vndk_ver);
42 
43   Variables::AddValue("SYSTEM_EXT", "/system_ext");
44   Variables::AddValue("PRODUCT", "/procut");
45 
46   Variables::AddValue("VNDK_USING_CORE_VARIANT_LIBRARIES",
47                       "vndk_using_core_variant_libraries");
48   Variables::AddValue("STUB_LIBRARIES", "stub_libraries");
49   Variables::AddValue("SANITIZER_RUNTIME_LIBRARIES",
50                       "sanitizer_runtime_libraries");
51 }
52 
53 inline void MockVnkdLite() {
54   android::linkerconfig::modules::Variables::AddValue("ro.vndk.lite", "true");
55 }