}
while (std::getline(library_file, library_name)) {
+ library_name = android::base::Trim(library_name);
if (!library_name.empty()) {
library_list.insert(library_name);
}
LibraryList public_library_list;
std::set_difference(
- library_list->begin(), library_list->end(), private_library_list->begin(),
+ library_list->begin(),
+ library_list->end(),
+ private_library_list->begin(),
private_library_list->end(),
std::inserter(public_library_list, public_library_list.begin()));
LibraryList private_only_library_list;
- std::set_intersection(library_list->begin(), library_list->end(),
+ std::set_intersection(library_list->begin(),
+ library_list->end(),
private_library_list->begin(),
private_library_list->end(),
std::inserter(private_only_library_list,
"/generator/tests/data/library_list_a.txt";
const std::string kLibraryListB = android::base::GetExecutableDirectory() +
"/generator/tests/data/library_list_b.txt";
+const std::string kLibraryListC = android::base::GetExecutableDirectory() +
+ "/generator/tests/data/library_list_c.txt";
const std::string kLibraryListInvalid =
android::base::GetExecutableDirectory() +
"/generator/tests/data/library_list_invalid.txt";
TEST(linkerconfig_librarylistloader, get_libraries) {
const auto& library_list = GetLibrariesString(kLibraryListA);
- ASSERT_EQ(library_list, "a.so:b.so:c.so:d.so:e.so:f.so");
+ ASSERT_EQ("a.so:b.so:c.so:d.so:e.so:f.so", library_list);
const auto& library_list_invalid = GetLibrariesString(kLibraryListInvalid);
ASSERT_TRUE(library_list_invalid.empty());
+
+ const auto& library_list_empty = GetLibrariesString(kLibraryListC);
+ ASSERT_EQ("", library_list_empty);
}
TEST(linkerconfig_librarylistloader, get_public_libraries) {
const auto& public_library_list =
GetPublicLibrariesString(kLibraryListA, kLibraryListB);
- ASSERT_EQ(public_library_list, "a.so:b.so:c.so:d.so");
+ ASSERT_EQ("a.so:b.so:c.so:d.so", public_library_list);
const auto& all_private_library_list =
GetPublicLibrariesString(kLibraryListA, kLibraryListA);
const auto& private_library_invalid_list =
GetPublicLibrariesString(kLibraryListA, kLibraryListInvalid);
- ASSERT_EQ(private_library_invalid_list, "a.so:b.so:c.so:d.so:e.so:f.so");
+ ASSERT_EQ("a.so:b.so:c.so:d.so:e.so:f.so", private_library_invalid_list);
+
+ const auto& empty_library_list =
+ GetPublicLibrariesString(kLibraryListC, kLibraryListA);
+ ASSERT_EQ("", empty_library_list);
}
TEST(linkerconfig_librarylistloader, get_private_libraries) {
const auto& private_library_list =
GetPrivateLibrariesString(kLibraryListA, kLibraryListB);
- ASSERT_EQ(private_library_list, "e.so:f.so");
+ ASSERT_EQ("e.so:f.so", private_library_list);
const auto& all_private_library_list =
GetPrivateLibrariesString(kLibraryListA, kLibraryListA);
- ASSERT_EQ(all_private_library_list, "a.so:b.so:c.so:d.so:e.so:f.so");
+ ASSERT_EQ("a.so:b.so:c.so:d.so:e.so:f.so", all_private_library_list);
const auto& invalid_library_list =
GetPrivateLibrariesString(kLibraryListInvalid, kLibraryListB);
Variables::AddValue("TEST_KEY", "TEST_VALUE");
auto value = Variables::GetValue("TEST_KEY");
ASSERT_TRUE(value.has_value());
- ASSERT_EQ(value.value(), "TEST_VALUE");
+ ASSERT_EQ("TEST_VALUE", value.value());
}
TEST(linkerconfig_variables, load_from_property) {
std::chrono::seconds(1)));
auto value = Variables::GetValue("debug.linkerconfig.test_prop_key");
ASSERT_TRUE(value.has_value());
- ASSERT_EQ(value.value(), "TEST_PROP_VALUE");
+ ASSERT_EQ("TEST_PROP_VALUE", value.value());
#endif
}
TEST(linkerconfig_variables, fallback_value) {
auto value = Variables::GetValue("INVALID_KEY");
ASSERT_FALSE(value.has_value());
+}
+
+TEST(linkerconfig_variables, empty_value) {
+ Variables::AddValue("TEST_KEY", "");
+ ASSERT_FALSE(Variables::GetValue("TEST_KEY").has_value());
}
\ No newline at end of file