OSDN Git Service

Fix linkerconfig_backward_compatibility_test
authorJooyung Han <jooyung@google.com>
Wed, 12 Feb 2020 23:41:15 +0000 (08:41 +0900)
committerJooyung Han <jooyung@google.com>
Wed, 12 Feb 2020 23:41:15 +0000 (08:41 +0900)
The current GetValue() falls back to GetProperty(). This makes the test
show different result on different running environment. For consistent
test result, MockVariables() now overrides all product/vendor variables.

Bug: n/a
Test: atest --host linkerconfig_backward_compatibility_test
      atest linkerconfig_backward_compatibility_test

Change-Id: I4b7533e10058b0236a8aef4c54fbb58f3bec0ccc

contents/tests/backward_compatibility/testbase.h

index 03ff680..83d9aa2 100644 (file)
 
 #include "linkerconfig/variables.h"
 
+inline void MockVndkVariables(std::string partition, std::string vndk_ver) {
+  using android::linkerconfig::modules::Variables;
+
+  Variables::AddValue(partition + "_VNDK_VERSION", vndk_ver);
+  Variables::AddValue("LLNDK_LIBRARIES_" + partition, "llndk_libraries");
+  Variables::AddValue("PRIVATE_LLNDK_LIBRARIES_" + partition,
+                      "private_llndk_libraries");
+  Variables::AddValue("VNDK_SAMEPROCESS_LIBRARIES_" + partition,
+                      "vndk_sameprocess_libraries");
+  Variables::AddValue("VNDK_CORE_LIBRARIES_" + partition, "vndk_core_libraries");
+}
+
 inline void MockVariables(std::string vndk_ver = "Q") {
-  android::linkerconfig::modules::Variables::AddValue("VENDOR_VNDK_VERSION",
-                                                      vndk_ver);
-  android::linkerconfig::modules::Variables::AddValue("PRODUCT", "product");
-  android::linkerconfig::modules::Variables::AddValue("SYSTEM_EXT",
-                                                      "system_ext");
-  android::linkerconfig::modules::Variables::AddValue("LLNDK_LIBRARIES_VENDOR",
-                                                      "llndk_libraries");
-  android::linkerconfig::modules::Variables::AddValue(
-      "SANITIZER_RUNTIME_LIBRARIES", "sanitizer_runtime_libraries");
-  android::linkerconfig::modules::Variables::AddValue(
-      "PRIVATE_LLNDK_LIBRARIES", "private_llndk_libraries");
-  android::linkerconfig::modules::Variables::AddValue(
-      "VNDK_SAMEPROCESS_LIBRARIES_VENDOR", "vndk_sameprocess_libraries");
-  android::linkerconfig::modules::Variables::AddValue(
-      "VNDK_CORE_LIBRARIES_VENDOR", "vndk_core_libraries");
-  android::linkerconfig::modules::Variables::AddValue(
-      "VNDK_USING_CORE_VARIANT_LIBRARIES", "vndk_using_core_variant_libraries");
-  android::linkerconfig::modules::Variables::AddValue("STUB_LIBRARIES",
-                                                      "stub_libraries");
+  using android::linkerconfig::modules::Variables;
+
+  MockVndkVariables("VENDOR", vndk_ver);
+  Variables::AddValue("ro.vndk.version", vndk_ver);
+
+  MockVndkVariables("PRODUCT", vndk_ver);
+  Variables::AddValue("ro.product.vndk.version", vndk_ver);
+
+  Variables::AddValue("VNDK_USING_CORE_VARIANT_LIBRARIES",
+                      "vndk_using_core_variant_libraries");
+  Variables::AddValue("STUB_LIBRARIES", "stub_libraries");
+  Variables::AddValue("SANITIZER_RUNTIME_LIBRARIES",
+                      "sanitizer_runtime_libraries");
 }
 
 inline void MockVnkdLite() {