diff options
-rw-r--r-- | devicetest/src/android/linkerconfig/gts/LinkerConfigTest.java | 11 | ||||
-rw-r--r-- | devicetest/src/android/linkerconfig/gts/utils/LibraryListLoader.java | 26 |
2 files changed, 19 insertions, 18 deletions
diff --git a/devicetest/src/android/linkerconfig/gts/LinkerConfigTest.java b/devicetest/src/android/linkerconfig/gts/LinkerConfigTest.java index e24ae18..eaf3829 100644 --- a/devicetest/src/android/linkerconfig/gts/LinkerConfigTest.java +++ b/devicetest/src/android/linkerconfig/gts/LinkerConfigTest.java @@ -152,9 +152,14 @@ public class LinkerConfigTest extends BaseHostJUnit4Test { "/system/etc/sanitizer.libraries.txt", true)); // Add LLNDK libraries - libraries.addAll(LibraryListLoader.getLibrariesFromFile(targetDevice, + if (vendorVndkVersion == null || vendorVndkVersion.isEmpty()) { + libraries.addAll(LibraryListLoader.getLibrariesFromFile(targetDevice, + "/system/etc/llndk.libraries.txt", true)); + } else { + libraries.addAll(LibraryListLoader.getLibrariesFromFile(targetDevice, "/apex/com.android.vndk.v" + vendorVndkVersion + "/etc/llndk.libraries." + vendorVndkVersion + ".txt", true)); + } // Add Stub libraries libraries.addAll(LibraryListLoader.STUB_LIBRARIES); @@ -210,10 +215,6 @@ public class LinkerConfigTest extends BaseHostJUnit4Test { fail("Target device is not available : " + e.getMessage()); } - if (vendorVndkVersion == null || vendorVndkVersion.isEmpty()) { - return; - } - Configuration conf = loadConfig(targetDevice, LINKER_CONFIG_LOCATION); List<Section> vendorSections = conf.dirToSections.entrySet().stream() diff --git a/devicetest/src/android/linkerconfig/gts/utils/LibraryListLoader.java b/devicetest/src/android/linkerconfig/gts/utils/LibraryListLoader.java index c12a7c3..b5aef51 100644 --- a/devicetest/src/android/linkerconfig/gts/utils/LibraryListLoader.java +++ b/devicetest/src/android/linkerconfig/gts/utils/LibraryListLoader.java @@ -16,7 +16,7 @@ package android.linkerconfig.gts.utils; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import com.android.tradefed.device.DeviceNotAvailableException; @@ -42,21 +42,21 @@ public class LibraryListLoader { fail("There is no available device : " + e.getMessage()); } - assertTrue("Failed to get library list file from " + path, - target.exists() || !expectFileExists); + if (target == null) { + assertFalse("Failed to get library list file from " + path, expectFileExists); + return libraries; + } - if (target.exists()) { - try (BufferedReader reader = new BufferedReader(new FileReader(target))) { - String library; - while ((library = reader.readLine()) != null) { - library = library.trim(); - if (!library.isEmpty()) { - libraries.add(library); - } + try (BufferedReader reader = new BufferedReader(new FileReader(target))) { + String library; + while ((library = reader.readLine()) != null) { + library = library.trim(); + if (!library.isEmpty()) { + libraries.add(library); } - } catch (Exception e) { - fail("Failed to read file " + path + " with error : " + e.getMessage()); } + } catch (Exception e) { + fail("Failed to read file " + path + " with error : " + e.getMessage()); } return libraries; |