Loading ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +13 −31 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,11 @@ public class RavenwoodCommonUtils { public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( "RAVENWOOD_VERBOSE")); "RAVENWOOD_VERBOSE")); /** Directory name of `out/host/linux-x86/testcases/ravenwood-runtime` */ /** private static final String RAVENWOOD_RUNTIME_DIR_NAME = "ravenwood-runtime"; * Env var name for the runtime dir. When running a test locally, it'll contain * `/...(path).../out/host/linux-x86/testcases/ravenwood-runtime`. */ private static final String RAVENWOOD_RUNTIME_DIR_ENV = "RAVENWOOD_RUNTIME_DIR"; private static boolean sEnableExtraRuntimeCheck = private static boolean sEnableExtraRuntimeCheck = "1".equals(System.getenv("RAVENWOOD_ENABLE_EXTRA_RUNTIME_CHECK")); "1".equals(System.getenv("RAVENWOOD_ENABLE_EXTRA_RUNTIME_CHECK")); Loading Loading @@ -208,36 +211,15 @@ public class RavenwoodCommonUtils { if (!isOnRavenwood()) { if (!isOnRavenwood()) { return null; return null; } } var path = System.getProperty("java.library.path"); var dir = System.getenv(RAVENWOOD_RUNTIME_DIR_ENV); if (dir == null || dir.isEmpty()) { System.out.println("Looking for " + RAVENWOOD_RUNTIME_DIR_NAME + " directory" throw new IllegalStateException("$" + RAVENWOOD_RUNTIME_DIR_ENV + " not set"); + " in java.library.path:" + path); try { if (path == null) { throw new IllegalStateException("java.library.path shouldn't be null"); } for (var dir : path.split(":")) { // For each path, see if the path contains RAVENWOOD_RUNTIME_DIR_NAME. var d = new File(dir); for (;;) { if (d.getParent() == null) { break; // Root dir, stop. } if (RAVENWOOD_RUNTIME_DIR_NAME.equals(d.getName())) { var ret = d.getAbsolutePath() + "/"; System.out.println("Found: " + ret); return ret; } d = d.getParentFile(); } } if (!(new File(dir).isDirectory())) { throw new IllegalStateException("$" + RAVENWOOD_RUNTIME_DIR_ENV + " contains " + dir + ", but it's not a directory"); } } throw new IllegalStateException(RAVENWOOD_RUNTIME_DIR_NAME + " not found"); return dir; } catch (Throwable e) { dumpFiles(System.out); throw e; } } } /** Close an {@link AutoCloseable}. */ /** Close an {@link AutoCloseable}. */ Loading Loading
ravenwood/runtime-common-src/com/android/ravenwood/common/RavenwoodCommonUtils.java +13 −31 Original line number Original line Diff line number Diff line Loading @@ -48,8 +48,11 @@ public class RavenwoodCommonUtils { public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( public static final boolean RAVENWOOD_VERBOSE_LOGGING = "1".equals(System.getenv( "RAVENWOOD_VERBOSE")); "RAVENWOOD_VERBOSE")); /** Directory name of `out/host/linux-x86/testcases/ravenwood-runtime` */ /** private static final String RAVENWOOD_RUNTIME_DIR_NAME = "ravenwood-runtime"; * Env var name for the runtime dir. When running a test locally, it'll contain * `/...(path).../out/host/linux-x86/testcases/ravenwood-runtime`. */ private static final String RAVENWOOD_RUNTIME_DIR_ENV = "RAVENWOOD_RUNTIME_DIR"; private static boolean sEnableExtraRuntimeCheck = private static boolean sEnableExtraRuntimeCheck = "1".equals(System.getenv("RAVENWOOD_ENABLE_EXTRA_RUNTIME_CHECK")); "1".equals(System.getenv("RAVENWOOD_ENABLE_EXTRA_RUNTIME_CHECK")); Loading Loading @@ -208,36 +211,15 @@ public class RavenwoodCommonUtils { if (!isOnRavenwood()) { if (!isOnRavenwood()) { return null; return null; } } var path = System.getProperty("java.library.path"); var dir = System.getenv(RAVENWOOD_RUNTIME_DIR_ENV); if (dir == null || dir.isEmpty()) { System.out.println("Looking for " + RAVENWOOD_RUNTIME_DIR_NAME + " directory" throw new IllegalStateException("$" + RAVENWOOD_RUNTIME_DIR_ENV + " not set"); + " in java.library.path:" + path); try { if (path == null) { throw new IllegalStateException("java.library.path shouldn't be null"); } for (var dir : path.split(":")) { // For each path, see if the path contains RAVENWOOD_RUNTIME_DIR_NAME. var d = new File(dir); for (;;) { if (d.getParent() == null) { break; // Root dir, stop. } if (RAVENWOOD_RUNTIME_DIR_NAME.equals(d.getName())) { var ret = d.getAbsolutePath() + "/"; System.out.println("Found: " + ret); return ret; } d = d.getParentFile(); } } if (!(new File(dir).isDirectory())) { throw new IllegalStateException("$" + RAVENWOOD_RUNTIME_DIR_ENV + " contains " + dir + ", but it's not a directory"); } } throw new IllegalStateException(RAVENWOOD_RUNTIME_DIR_NAME + " not found"); return dir; } catch (Throwable e) { dumpFiles(System.out); throw e; } } } /** Close an {@link AutoCloseable}. */ /** Close an {@link AutoCloseable}. */ Loading