aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-15 07:25:32 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-15 07:25:32 +0000
commit0a84b8e54182e31a240af378a94c74de085dfcf5 (patch)
tree83b924d5bcfffff21a3a99a6eab76e84d41b2fac
parentc9e211b60e2804e3e744d1f7d9e00d4550ba32a6 (diff)
parenta9cb75a9dded3ba1eb18064e8c6e88725e3a24e3 (diff)
downloadlibcore-oreo-dr2-release.tar.gz
Change-Id: I4978d67c9fff8862e47967892cee8d53bff12f94
-rw-r--r--luni/src/test/java/libcore/java/io/FileTest.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/luni/src/test/java/libcore/java/io/FileTest.java b/luni/src/test/java/libcore/java/io/FileTest.java
index 05b66c1f9af..3705f2b3c85 100644
--- a/luni/src/test/java/libcore/java/io/FileTest.java
+++ b/luni/src/test/java/libcore/java/io/FileTest.java
@@ -396,19 +396,22 @@ public class FileTest extends junit.framework.TestCase {
// http://b/62301183
public void test_canonicalCachesAreOff() throws Exception {
- File f1 = File.createTempFile("testCannonCachesOff1", "tmp");
- File f2 = File.createTempFile("testCannonCachesOff2", "tmp");
- File symlinkFile = new File("test_sl");
+ File tempDir = createTemporaryDirectory();
+ File f1 = new File(tempDir, "testCannonCachesOff1");
+ f1.createNewFile();
+ File f2 = new File(tempDir, "testCannonCachesOff2");
+ f2.createNewFile();
+ File symlinkFile = new File(tempDir, "symlink");
// Create a symlink from symlink to f1 and populate canonical path cache
assertEquals(0, Runtime.getRuntime().exec("ln -s " + f1.getAbsolutePath() + " " + symlinkFile.getAbsolutePath()).waitFor());
- assertEquals(symlinkFile.getCanonicalPath(), f1.toString());
+ assertEquals(symlinkFile.getCanonicalPath(), f1.getCanonicalPath());
// Remove it and replace it with a symlink to f2 (using java File/Files would flush caches).
assertEquals(0, Runtime.getRuntime().exec("rm " + symlinkFile.getAbsolutePath()).waitFor());
assertEquals(0, Runtime.getRuntime().exec("ln -s " + f2.getAbsolutePath() + " " + symlinkFile.getAbsolutePath()).waitFor());
// Did we cache canonical path results? hope not!
- assertEquals(symlinkFile.getCanonicalPath(), f2.toString());
+ assertEquals(symlinkFile.getCanonicalPath(), f2.getCanonicalPath());
}
}