CR 6868690 test fix for openjdk8 - requesting a sponsor

2012-01-09 Thread valerii.poto...@oracle.com

Hi All,

I've attached a patch for awt category test fix.
The fix is related to openjdk8 (also to openjdk7).

test/java/awt/FontClass/CreateFont/BigFont.java

The failure is a showstopper, it causes a hang of test execution when launched using 
"make jdk_awt".

The reason of failure is known and has been fixed already in jdk6.

It has a corresponding CR 6868690 in the Bugster.

I am requesting a sponsor to review and to integrate the fix.

Regards,
Valerii


diff -r cfd7602f5c52 test/java/awt/FontClass/CreateFont/BigFont.java
--- a/test/java/awt/FontClass/CreateFont/BigFont.java   Wed Jun 22 10:11:19 
2011 -0700
+++ b/test/java/awt/FontClass/CreateFont/BigFont.java   Tue Dec 06 14:51:31 
2011 +
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -21,6 +21,12 @@
  * questions.
  */
 
+/*
+  @test  
+  @bug 6522586
+  @summary Enforce limits on font creation
+  @run main BigFont
+*/
 import java.applet.*;
 import java.awt.*;
 import java.io.*;
@@ -28,8 +34,12 @@
 
 public class BigFont extends Applet {
 
+   public static void main(String args[]) {
+System.setSecurityManager(new SecurityManager());
+(new BigFont()).runTest1();
+   }
+
static private class SizedInputStream extends InputStream {
-
int size;
int cnt = 0;
 
@@ -57,9 +67,12 @@
 public void init() {
 id = getParameter("number");
 fileName = getParameter("font");
-
 System.out.println("Applet " + id + " "+
Thread.currentThread().getThreadGroup());
+runTest1();
+runTest2();
+}
+void runTest1() {
 // Larger than size for a single font.
 int fontSize = 64 * 1000 * 1000;
 SizedInputStream sis = new SizedInputStream(fontSize);
@@ -74,6 +87,8 @@
 throw new RuntimeException("Allowed file to be too large.");
 }
 }
+ }
+ void runTest2() {
 // The following part of the test was verified manually but
 // is impractical to enable  because it requires a fairly large
 // valid font to be part of the test, and we can't easily include
diff -r cfd7602f5c52 test/java/awt/FontClass/CreateFont/bigfont.html
--- a/test/java/awt/FontClass/CreateFont/bigfont.html   Wed Jun 22 10:11:19 
2011 -0700
+++ b/test/java/awt/FontClass/CreateFont/bigfont.html   Tue Dec 06 14:51:31 
2011 +
@@ -1,6 +1,6 @@
 
 
 
@@ -45,4 +40,3 @@
 
   
 
-


CR 6802962 test fix for openjdk8 - requesting a sponsor

2012-01-09 Thread valerii.poto...@oracle.com

Hi All,

I've attached a patch for awt category test fix.
The fix is related to openjdk8 (also to openjdk7).

test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java

The failure is a showstopper, it causes a hang of test execution when 
launched using "make jdk_awt".


The reason of failure is known and has been fixed already in jdk6.

It has a corresponding CR 6802962 in the Bugster.

I am requesting a sponsor to review and to integrate the fix.

Regards,
Valerii
diff -r cfd7602f5c52 test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java
--- a/test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java   Wed Jun 
22 10:11:19 2011 -0700
+++ b/test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java   Tue Dec 
06 13:28:47 2011 +
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, 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
@@ -22,9 +22,19 @@
  */
 
 /*
- * @test
+ * @test  
  * @bug 6652929
  * @summary verify handling of File.getPath()
+ * @compile FontFile.java
+ * @run shell TestFontFile.sh
+ */
+
+/*
+ * When using jtreg this test needs to be run by shell script,
+ * since otherwise jtreg reflectively invokes the main method
+ * and the codebase for the purposes of the security manager
+ * is that of the jtreg harness, not the codebase (class file location)
+ * of this program, thus access to read to that location is not available.
  */
 
 import java.awt.*;
@@ -34,10 +44,21 @@
 public static void main(String[] args) throws Exception {
 String sep = System.getProperty("file.separator");
 String fname = ".." + sep + "A.ttf";
-String dir = System.getProperty("test.src");
+//String dir = System.getProperty("test.src");
+String dir = System.getenv("TESTSRC");
 if (dir != null) {
 fname = dir + sep + fname;
 }
+//String classesDir = System.getProperty("test.classes");
+String classesDir = System.getenv("TESTCLASSES");
+System.out.println("classesDir="+classesDir);
+String testfile = "somefile";
+if (classesDir != null) {
+testfile = classesDir + sep + testfile;
+}
+final String somefile = testfile;
+System.out.println("somefile="+somefile);
+System.out.println("userdir="+System.getProperty("user.dir"));
 final String name = fname;
 System.out.println("Will try to access " + name);
 if (!(new File(name)).canRead()) {
@@ -57,7 +78,7 @@
 // Good.
 }
 
-try {
+try { 
 Font font = Font.createFont(Font.TRUETYPE_FONT,
 new File("nosuchfile") {
 private boolean read;
@@ -66,7 +87,7 @@
 return name;
 } else {
 read = true;
-return "somefile";
+return somefile;
 }
 }
 @Override public boolean canRead() {
diff -r cfd7602f5c52 
test/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/test/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh Tue Dec 
06 13:28:47 2011 +
@@ -0,0 +1,84 @@
+#
+# Copyright (c) 2011, 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#!/bin/sh
+
+if [ "${TESTSRC}" = "" ]
+then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+BIT_FLAG=""
+
+# set platform-dependent variable

Re: CR 6868690 test fix for openjdk8 - requesting a sponsor

2012-01-10 Thread valerii.poto...@oracle.com

Yes, I see it now. I'll re-submit it for the right category.

Thanks,
Valerii

On 01/ 9/12 05:49 PM, Phil Race wrote:
This test and the font APIS are Java 2D not AWT .. you should repost 
the discussion on 2d-dev.


-phil.

On 1/9/2012 9:35 AM, [email protected] wrote:

Hi All,

I've attached a patch for awt category test fix.
The fix is related to openjdk8 (also to openjdk7).

test/java/awt/FontClass/CreateFont/BigFont.java

The failure is a showstopper, it causes a hang of test execution when 
launched using "make jdk_awt".


The reason of failure is known and has been fixed already in jdk6.

It has a corresponding CR 6868690 in the Bugster.

I am requesting a sponsor to review and to integrate the fix.

Regards,
Valerii