lördag 26 april 2014

Uri's messing with my forks

I'm still stumped on the URI handling. Some mauve tests tries to assert the correctness of the URI and URL, returned by the two methods toURI(), and toURL() of a java.io.File object (where the latter is now deprecated, in favour of the first one). However, the mauve tests cannot be correct, since it for the URI thinks a corect result is the path appended with a file separator, and for the URL result doesn't want the file separator. I.e. in the mauve test, an URI should be "file:ram:t/", and the URL should be "file:ram:t", which is just plain wrong (as corroborated by a simple test on OpenJDK on my mac). If the path points to a directory, it should end with a "/", if it's a file, it should have no ending. So it should in both the URI and URL case be "file:ram:t/".

How to mauve forward

It's very unsettling not being able to rely on the automated tests being correct. So, I'm thinking that I shouldn't give them to much gravitas, but try to get the most obvious errors in JAmiga fixed with the help of Mauve, but not aim for a hundred percent fully successful test run.

Some more URI ranting

GNU classpath has a tendency to add slashes to the end of paths, which denote directories, but doesn't have the ending slash. Like above, the path "ram:t", would become "ram:t/". However, if the path is just "ram:" (being a root directory), it will also get a slash at the end, since GNU classpath doesn't know that colon is a file separator in the amiga world. This leads to the path "ram:/". This is coincidental how Windows does it file URI's, like "C:/" (here normalized from Windows normal backslash notation).

For now i think I'll try and keep it like this, so we might get URI's like "file:ram:/t/tempfile" for our Amiga paths "ram:t/tempfile". Hopefully that will work. Because, like I've on numerous occasions blogged about, the whole URI/file/path-handling is all over the place.

onsdag 23 april 2014

Tests in progress

Mauving forward (have I already used that pun...?)

I'm, as always, continuing my mauve testing. I might just spot stuff, that might make other stuff run.
I've been at this previosuly, but I'm now re-iterating the java-io tests. My progrss so far? See for yourselves:

Passed java.io tests

TEST PASSED (3 checks) java.io.File.ReadMethods
TEST PASSED (3 checks) java.io.File.WriteMethods
TEST PASSED (51 checks) java.io.File.jdk11
TEST PASSED (4 checks) java.io.CharArrayReader.MarkReset
TEST PASSED (4 checks) java.io.CharArrayReader.ProtectedVars
TEST PASSED (1 checks) java.io.CharArrayReader.SimpleRead
TEST PASSED (2 checks) java.io.CharArrayReader.OutOfBounds
TEST PASSED (8 checks) java.io.StringReader.Test
TEST PASSED (5 checks) java.io.FilterInputStream.MarkReset
TEST PASSED (2 checks) java.io.FilterInputStream.SimpleRead
TEST PASSED (2 checks) java.io.PushbackInputStream.ProtectedVars
TEST PASSED (3 checks) java.io.PushbackInputStream.Unread
TEST PASSED (1 checks) java.io.PushbackInputStream.BufferOverflow
TEST PASSED (2 checks) java.io.FileDescriptor.jdk11
TEST PASSED (0 checks) java.io.Serializable.ParentWriteReplace
TEST PASSED (0 checks) java.io.Serializable.ParentReadResolve
TEST PASSED (6 checks) java.io.Writer.Test
TEST PASSED (4 checks) java.io.ObjectStreamClass.ProxyTest
TEST PASSED (4 checks) java.io.SequenceInputStream.Test
TEST PASSED (4 checks) java.io.BufferedInputStream.MarkReset
TEST PASSED (5 checks) java.io.BufferedInputStream.ProtectedVars
TEST PASSED (5 checks) java.io.BufferedInputStream.SimpleRead
TEST PASSED (1 checks) java.io.BufferedInputStream.ZeroRead
TEST PASSED (24 checks) java.io.BufferedInputStream.BigMark
TEST PASSED (2 checks) java.io.BufferedInputStream.Skip
TEST PASSED (10 checks) java.io.OutputStreamWriter.jdk11
TEST PASSED (2 checks) java.io.LineNumberInputStream.Test
TEST PASSED (4 checks) java.io.FilterReader.MarkReset
TEST PASSED (2 checks) java.io.FilterReader.SimpleRead
TEST PASSED (9 checks) java.io.Reader.Test
TEST PASSED (34 checks) java.io.LineNumberReader.Test2
TEST PASSED (120 checks) java.io.LineNumberReader.mark
TEST PASSED (5 checks) java.io.LineNumberReader.Test
TEST PASSED (5 checks) java.io.ByteArrayInputStream.MarkReset
TEST PASSED (4 checks) java.io.ByteArrayInputStream.ProtectedVars
TEST PASSED (1 checks) java.io.ByteArrayInputStream.SimpleRead
TEST PASSED (4 checks) java.io.ObjectOutputStream.useProtocolVersion
TEST PASSED (2 checks) java.io.BufferedReader.MarkReset
TEST PASSED (1 checks) java.io.BufferedReader.SimpleRead
TEST PASSED (19 checks) java.io.BufferedReader.mark
TEST PASSED (5 checks) java.io.BufferedReader.boundary
TEST PASSED (7 checks) java.io.StreamTokenizer.WordWhiteChars
TEST PASSED (11 checks) java.io.StreamTokenizer.newline
TEST PASSED (11 checks) java.io.StreamTokenizer.misc
TEST PASSED (9 checks) java.io.StreamTokenizer.commentchar
TEST PASSED (8 checks) java.io.StreamTokenizer.Test
TEST PASSED (7 checks) java.io.StreamTokenizer.slashstar
TEST PASSED (7 checks) java.io.StreamTokenizer.slashslash
TEST PASSED (1 checks) java.io.InputStreamReader.except
TEST PASSED (52 checks) java.io.InputStreamReader.getEncoding
TEST PASSED (1 checks) java.io.InputStreamReader.hang
TEST PASSED (2 checks) java.io.InputStreamReader.utf8
TEST PASSED (5 checks) java.io.InputStreamReader.jdk11
TEST PASSED (2 checks) java.io.BufferedWriter.Test
TEST PASSED (37 checks) java.io.DataInputStream.readLine
TEST PASSED (3 checks) java.io.FileReader.jdk11
TEST PASSED (4 checks) java.io.PushbackReader.Unread
TEST PASSED (1 checks) java.io.PushbackReader.BufferOverflow
TEST PASSED (4 checks) java.io.PrintWriter.checkError
TEST PASSED (10 checks) java.io.PrintWriter.jdk11
TEST PASSED (3 checks) java.io.InputStream.Test
TEST PASSED (2 checks) java.io.CharArrayWriter.ProtectedVars
TEST PASSED (4 checks) java.io.CharArrayWriter.BasicTests
TEST PASSED (9 checks) java.io.ByteArrayOutputStream.write
TEST PASSED (12 checks) java.io.ByteArrayOutputStream.subclass
TEST PASSED (5 checks) java.io.OutputStream.Test
TEST PASSED (2 checks) java.io.PipedReaderWriter.Test
TEST PASSED (6 checks) java.io.BufferedOutputStream.interrupt
TEST PASSED (2 checks) java.io.BufferedOutputStream.Test
TEST PASSED (1 checks) java.io.PipedStream.receive
TEST PASSED (1 checks) java.io.PipedStream.close
TEST PASSED (3 checks) java.io.PipedStream.Test
TEST PASSED (250 checks) java.io.FilePermission.simple
TEST PASSED (6 checks) java.io.FilterWriter.write
TEST PASSED (5 checks) java.io.StringBufferInputStream.MarkReset
TEST PASSED (3 checks) java.io.StringBufferInputStream.ProtectedVars
TEST PASSED (2 checks) java.io.StringBufferInputStream.SimpleRead
TEST PASSED (2 checks) java.io.FileOutputStream.jdk12
TEST PASSED (3 checks) java.io.StringWriter.Test
TEST PASSED (6 checks) java.io.FilterOutputStream.write
TEST PASSED (2 checks) java.io.PrintStream.encodings
TEST PASSED (1 checks) java.io.PrintStream.subclass
TEST PASSED (2 checks) java.io.Utf8Encoding.ReadReference
TEST PASSED (3 checks) java.io.Utf8Encoding.WriteRead
TEST PASSED (68 checks) java.io.Utf8Encoding.mojo
TEST PASSED (1 checks) java.io.DataOutputStream.writeUTF               

Failed java.io tsts

TEST FAILED: 8 of 14 checks failed java.io.File.listFiles
TEST FAILED: 8 of 14 checks failed java.io.File.list
TEST FAILED: 7 of 19 checks failed java.io.File.canWrite
TEST FAILED: 8 of 15 checks failed java.io.File.emptyFile
TEST FAILED: 17 of 22 checks failed java.io.File.security
TEST FAILED: 1 of 1 checks failed java.io.File.createFile
TEST FAILED: 2 of 4 checks failed java.io.File.URI
TEST FAILED: uncaught exception java.io.File.newFileURI
TEST FAILED: 1 of 3 checks failed java.io.File.ExecuteMethods
TEST FAILED: 1 of 17 checks failed java.io.File.newFile
TEST FAILED: 2 of 4 checks failed java.io.File.UnicodeURI
TEST FAILED: 1 of 1 checks failed java.io.RandomAccessFile.setLength
TEST FAILED: 1 of 2 checks failed java.io.RandomAccessFile.security
TEST FAILED: 2 of 2 checks failed java.io.RandomAccessFile.randomaccessfile
TEST FAILED: 1 of 1 checks failed java.io.RandomAccessFile.jdk11
TEST FAILED: 1 of 1 checks failed java.io.Serializable.BreakMe
TEST FAILED: uncaught exception java.io.Serializable.readResolve
TEST FAILED: 1 of 1 checks failed java.io.Serializable.BreakMeTestSer
TEST FAILED: 1 of 2 checks failed java.io.FileWriter.jdk11
TEST FAILED: uncaught exception java.io.ObjectStreamClass.Test
TEST FAILED: 3 of 3 checks failed java.io.FileInputStream.security
TEST FAILED: 2 of 2 checks failed java.io.FileInputStream.fileinputstream
TEST FAILED: 1 of 2 checks failed java.io.FileInputStream.read
TEST FAILED: uncaught exception java.io.ObjectInputStream.registerValidation
TEST FAILED: uncaught exception java.io.ObjectInputStream.ClassLoaderTest
TEST FAILED: 2 of 3 checks failed java.io.ObjectInputStream.security
TEST FAILED: 1 of 4 checks failed java.io.ObjectInputStream.readResolve
TEST FAILED: uncaught exception java.io.ObjectOutputStream.StreamDataTest
TEST FAILED: 2 of 3 checks failed java.io.ObjectOutputStream.security
TEST FAILED: 1 of 5 checks failed java.io.DataInputStream.ReadReference
TEST FAILED: 1 of 6 checks failed java.io.DataInputStream.ReadReference2
TEST FAILED: 1 of 1 checks failed java.io.ObjectInputOutput.ExtTest
TEST FAILED: uncaught exception java.io.ObjectInputOutput.LoopSerializationTest
TEST FAILED: 2 of 3 checks failed java.io.ObjectInputOutput.Compat2
TEST FAILED: uncaught exception java.io.ObjectInputOutput.HierarchyTest
TEST FAILED: uncaught exception java.io.ObjectInputOutput.OutputTest
TEST FAILED: uncaught exception java.io.ObjectInputOutput.ProxySerializationTest
TEST FAILED: 1 of 1 checks failed java.io.ObjectInputOutput.SerTest
TEST FAILED: 2 of 3 checks failed java.io.ObjectInputOutput.Compat1
TEST FAILED: uncaught exception java.io.ObjectInputOutput.Deserializable
TEST FAILED: 6 of 6 checks failed java.io.ObjectInputOutput.InputTest
TEST FAILED: 12 of 26 checks failed java.io.FilePermission.traversal2
TEST FAILED: 45 of 66 checks failed java.io.FilePermission.traversal
TEST FAILED: 1 of 2 checks failed java.io.FileOutputStream.fileoutputstream
TEST FAILED: 2 of 3 checks failed java.io.FileOutputStream.security
TEST FAILED: 1 of 1 checks failed java.io.FileOutputStream.append
TEST FAILED: 1 of 1 checks failed java.io.FileOutputStream.write
TEST FAILED: 1 of 9 checks failed java.io.DataOutputStream.WriteRead2
TEST FAILED: 1 of 6 checks failed java.io.DataOutputStream.WriteRead              

Conclusion:

86 of 135 test passed.

Looking more closely at the test result, reveals that some native method are missing. But at a even closer look -- are they realy missing?
It turns out that I've just misspelled them; instead of "java.io.ObjectStreamClass", my javaio.librar refers to just "java.io.ObjectStream", missing the "Class" postfix (actually its not per se my misspell, its actually my javah implementation, that must be ignoring the Class ending. So, in the end, still my fault.). With that in place, I just managed to run one of the tests successfully! And I bet you that a few other test cases might be solved by this as well.

Minor update:

These tests now succeeds:

TEST PASSED (14 checks) java.io.ObjectStreamClass.Test
TEST PASSED (27 checks) java.io.RandomAccessFile.jdk11
TEST PASSED (23 checks) java.io.ObjectOutputStream.StreamDataTest
Not as many as I had hoped for, but its something.
Some of the now failing test do however have some more success as they don't throw exceptions.