diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-08-15 07:25:32 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-08-15 07:25:32 +0000 |
commit | 0a84b8e54182e31a240af378a94c74de085dfcf5 (patch) | |
tree | 83b924d5bcfffff21a3a99a6eab76e84d41b2fac | |
parent | c9e211b60e2804e3e744d1f7d9e00d4550ba32a6 (diff) | |
parent | a9cb75a9dded3ba1eb18064e8c6e88725e3a24e3 (diff) | |
download | libcore-oreo-dr2-release.tar.gz |
release-request-4be129b1-3f50-40d3-bbd4-30899b786745-for-git_oc-dr1-release-4273712 snap-temp-L56000000093068720android-8.0.0_r34android-8.0.0_r33android-8.0.0_r27android-8.0.0_r26android-8.0.0_r25android-8.0.0_r24android-8.0.0_r23android-8.0.0_r22android-8.0.0_r21oreo-dr3-releaseoreo-dr2-releaseoreo-dr1-release
Change-Id: I4978d67c9fff8862e47967892cee8d53bff12f94
-rw-r--r-- | luni/src/test/java/libcore/java/io/FileTest.java | 13 |
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()); } } |