8227615: [TESTBUG] JTReg "jdk/sun/security/util/FilePermCompat/CompatImpact.java" fails with graal

Reviewed-by: kvn
This commit is contained in:
Xiaohong Gong 2019-07-17 10:11:05 +08:00 committed by Ningsheng Jian
parent a5388f21b7
commit 2c6a826899

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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,7 +90,7 @@ public class CompatImpact {
.debug(testcase)
.start();
if (p.waitFor() != 0) {
Files.copy(Paths.get("stderr." + testcase), System.out);
Files.copy(Paths.get(testcase + ".stderr"), System.out);
failed += testcase + " ";
}
@ -101,7 +101,7 @@ public class CompatImpact {
.debug(testcase)
.start();
if (p.waitFor() != 0) {
Files.copy(Paths.get("stderr." + testcase), System.out);
Files.copy(Paths.get(testcase + ".stderr"), System.out);
failed += testcase + " ";
}
@ -114,7 +114,7 @@ public class CompatImpact {
.debug(testcase)
.start();
if (p.waitFor() != 0) {
Files.copy(Paths.get("stderr." + testcase), System.out);
Files.copy(Paths.get(testcase + ".stderr"), System.out);
failed += testcase + " ";
}
@ -126,7 +126,7 @@ public class CompatImpact {
.debug(testcase)
.start();
if (p.waitFor() != 0) {
Files.copy(Paths.get("stderr." + testcase), System.out);
Files.copy(Paths.get(testcase + ".stderr"), System.out);
failed += testcase + " ";
}
@ -138,7 +138,7 @@ public class CompatImpact {
.debug(testcase)
.start();
if (p.waitFor() != 0) {
Files.copy(Paths.get("stderr." + testcase), System.out);
Files.copy(Paths.get(testcase + ".stderr"), System.out);
failed += testcase + " ";
}
@ -238,6 +238,7 @@ public class CompatImpact {
// For my policy, f is passed into test and new MP(f)
// will be set as new policy
p.perm(new SecurityPermission("setPolicy"));
p.perm(new SecurityPermission("getPolicy"));
p.args(f);
break;
default:
@ -249,7 +250,9 @@ public class CompatImpact {
// My own Policy impl, with only one granted permission, also not smart
// enough to know whether ProtectionDomain grants any permission
static class MP extends Policy {
static final Policy DEFAULT_POLICY = Policy.getPolicy();
final PermissionCollection pc;
MP(String f) {
FilePermission p = new FilePermission(f, "read");
pc = p.newPermissionCollection();
@ -267,7 +270,7 @@ public class CompatImpact {
@Override
public boolean implies(ProtectionDomain domain, Permission permission) {
return pc.implies(permission);
return pc.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
}
}
}