Skip unreadable libs / symlinks.

Some libraries might be unreadable due to SELinux rule. Change all the
std::filesystem calls to use the exception-free variants.

Test: presubmit
Fix: 183954738
Change-Id: I8babffe3e13f3d7dae95edd1196ca56fd239b87b
diff --git a/tests/native/apex_shared_libraries_test.cpp b/tests/native/apex_shared_libraries_test.cpp
index 5722cfa..9f536dc 100644
--- a/tests/native/apex_shared_libraries_test.cpp
+++ b/tests/native/apex_shared_libraries_test.cpp
@@ -73,19 +73,19 @@
       continue;
     }
     for (auto& p : fs::directory_iterator(lib)) {
-      if (!fs::is_symlink(p)) {
+      std::error_code ec;
+      if (!fs::is_symlink(p, ec)) {
         continue;
       }
 
       // We are only checking libraries pointing at a location inside
       // /apex/sharedlibs.
-      auto target = fs::read_symlink(p.path());
-      if (!StartsWith(target.string(), kApexSharedLibsRoot)) {
+      auto target = fs::read_symlink(p.path(), ec);
+      if (ec || !StartsWith(target.string(), kApexSharedLibsRoot)) {
         continue;
       }
 
       // Symlink validity check.
-      std::error_code ec;
       auto dest = fs::canonical(p.path(), ec);
       EXPECT_FALSE(ec) << "Failed to resolve " << p.path() << " (symlink to "
                        << target << "): " << ec;
@@ -131,7 +131,7 @@
       };
       bool found = (dl_iterate_phdr(dl_callback, &dest) == 1);
       EXPECT_TRUE(found) << "Error verifying library symlink " << p.path()
-                         << " which points to " << fs::read_symlink(p.path())
+                         << " which points to " << target
                          << " which resolves to file " << dest;
       if (found) {
         LOG(INFO) << "Verified that " << p.path()