changeset 2614:561f0d6f3934

Make sure that the regression test openjdk/jdk/test/java/nio/MappedByteBuffer/Basic.java deletes all its work files.
author ptisnovs
date Thu, 23 Jun 2011 10:57:47 +0200
parents 4a46bd6fb3a5
children 24a5884be0de
files ChangeLog Makefile.am patches/jtreg-MappedByteBuffer-Basic.patch
diffstat 3 files changed, 105 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 22 10:52:24 2011 +0200
+++ b/ChangeLog	Thu Jun 23 10:57:47 2011 +0200
@@ -1,3 +1,11 @@
+2011-06-23  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* Makefile.am: added new patch
+	* patches/jtreg-MappedByteBuffer-Basic.patch:
+	Make sure that the regression test
+	openjdk/jdk/test/java/nio/MappedByteBuffer/Basic.java
+	deletes all its work files.
+
 2011-06-22  Pavel Tisnovsky  <ptisnovs@redhat.com>
 
 	* Makefile.am: added new patch
--- a/Makefile.am	Wed Jun 22 10:52:24 2011 +0200
+++ b/Makefile.am	Thu Jun 23 10:57:47 2011 +0200
@@ -361,7 +361,8 @@
 	patches/jtreg-ChannelsWrite.patch \
 	patches/jtreg-bug7036148-test.patch \
 	patches/jtreg-ReadWriteProfileTest.patch \
-	patches/openjdk/6818312-com.sun.awt.SecurityWarning.getSize.patch
+	patches/openjdk/6818312-com.sun.awt.SecurityWarning.getSize.patch \
+	patches/jtreg-MappedByteBuffer-Basic.patch
 
 if WITH_ALT_HSBUILD
 ICEDTEA_PATCHES += \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/jtreg-MappedByteBuffer-Basic.patch	Thu Jun 23 10:57:47 2011 +0200
@@ -0,0 +1,95 @@
+--- openjdk.orig/jdk/test/java/nio/MappedByteBuffer/Basic.java	2011-06-16 00:15:19.000000000 +0200
++++ openjdk/jdk/test/java/nio/MappedByteBuffer/Basic.java	2011-06-16 16:13:50.000000000 +0200
+@@ -35,45 +35,56 @@
+         byte[] srcData = new byte[20];
+         for (int i=0; i<20; i++)
+             srcData[i] = 3;
+-        File blah = File.createTempFile("blah", null);
+-        blah.deleteOnExit();
+-        FileOutputStream fos = new FileOutputStream(blah);
+-        FileChannel fc = fos.getChannel();
+-        fc.write(ByteBuffer.wrap(srcData));
+-        fc.close();
+-        fos.close();
++        File blah = null;
++        try {
++            blah = File.createTempFile("blah", null);
++            blah.deleteOnExit();
++            FileOutputStream fos = new FileOutputStream(blah);
++            FileChannel fc = fos.getChannel();
++            fc.write(ByteBuffer.wrap(srcData));
++            fc.close();
++            fos.close();
+ 
+-        FileInputStream fis = new FileInputStream(blah);
+-        fc = fis.getChannel();
+-        MappedByteBuffer mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, 10);
+-        mbb.load();
+-        mbb.isLoaded();
+-        mbb.force();
+-        if (!mbb.isReadOnly())
+-            throw new RuntimeException("Incorrect isReadOnly");
++            FileInputStream fis = new FileInputStream(blah);
++            fc = fis.getChannel();
++            MappedByteBuffer mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, 10);
++            mbb.load();
++            mbb.isLoaded();
++            mbb.force();
++            if (!mbb.isReadOnly()) {
++                throw new RuntimeException("Incorrect isReadOnly");
++            }
+ 
+-        // repeat with unaligned position in file
+-        mbb = fc.map(FileChannel.MapMode.READ_ONLY, 1, 10);
+-        mbb.load();
+-        mbb.isLoaded();
+-        mbb.force();
+-        fc.close();
+-        fis.close();
++            // repeat with unaligned position in file
++            mbb = fc.map(FileChannel.MapMode.READ_ONLY, 1, 10);
++            mbb.load();
++            mbb.isLoaded();
++            mbb.force();
++            fc.close();
++            fis.close();
+ 
+-        RandomAccessFile raf = new RandomAccessFile(blah, "r");
+-        fc = raf.getChannel();
+-        mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, 10);
+-        if (!mbb.isReadOnly())
+-            throw new RuntimeException("Incorrect isReadOnly");
+-        fc.close();
+-        raf.close();
++            RandomAccessFile raf = new RandomAccessFile(blah, "r");
++            fc = raf.getChannel();
++            mbb = fc.map(FileChannel.MapMode.READ_ONLY, 0, 10);
++            if (!mbb.isReadOnly()) {
++                throw new RuntimeException("Incorrect isReadOnly");
++            }
++            fc.close();
++            raf.close();
+ 
+-        raf = new RandomAccessFile(blah, "rw");
+-        fc = raf.getChannel();
+-        mbb = fc.map(FileChannel.MapMode.READ_WRITE, 0, 10);
+-        if (mbb.isReadOnly())
+-            throw new RuntimeException("Incorrect isReadOnly");
+-        fc.close();
+-        raf.close();
++            raf = new RandomAccessFile(blah, "rw");
++            fc = raf.getChannel();
++            mbb = fc.map(FileChannel.MapMode.READ_WRITE, 0, 10);
++            if (mbb.isReadOnly()) {
++                throw new RuntimeException("Incorrect isReadOnly");
++            }
++            fc.close();
++            raf.close();
++        }
++        finally {
++            if (blah != null) {
++                blah.delete();
++            }
++        }
+     }
+ }