8227422: sun/net/www/protocol/file/DirPermissionDenied.java failed on Windows 2016 because DirPermissionDenied directory has no read permission
authorfyuan
Fri, 12 Jul 2019 13:59:22 +0800
changeset 55669 07e09cb9ed70
parent 55668 7b11ce080798
child 55670 a87f5fdcd177
8227422: sun/net/www/protocol/file/DirPermissionDenied.java failed on Windows 2016 because DirPermissionDenied directory has no read permission Reviewed-by: dfuchs
test/jdk/sun/net/www/protocol/file/DirPermissionDenied.java
--- a/test/jdk/sun/net/www/protocol/file/DirPermissionDenied.java	Fri Jul 12 09:27:00 2019 +0530
+++ b/test/jdk/sun/net/www/protocol/file/DirPermissionDenied.java	Fri Jul 12 13:59:22 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,8 +90,12 @@
     }
 
     @AfterTest
-    public void tearDown() throws IOException {
+    public void tearDown() throws Throwable {
+        // add read permission to ensure the dir removable
+        ProcessTools.executeCommand("chmod", "733", TEST_DIR.toString())
+                    .outputTo(System.out)
+                    .errorTo(System.out)
+                    .shouldHaveExitValue(0);
         FileUtils.deleteFileIfExistsWithRetry(TEST_DIR);
     }
 }
-