[kaffe] CVS kaffe (kaz): test/regression/BufferedInputStreamAvailableTest.java:

Dalibor Topic robilad at kaffe.org
Wed Aug 3 17:48:47 PDT 2005


Ito Kazumitsu wrote:
> From: Kaffe CVS <cvs-commits at kaffe.org>
> Subject: [kaffe] CVS kaffe (kaz): test/regression/BufferedInputStreamAvailableTest.java:
> Date: Tue, 02 Aug 2005 09:29:24 -0700
> 
> 
>> 	BufferedInputStream is = new BufferedInputStream(
>> 	  new FileInputStream(file), (int)flen);
>> 	int alen = is.available();
>>-	System.out.println((int)flen == alen);
>>+	// System.out.println((int)flen == alen);
>>+	// We are happy if (int)flen == alen, but that is not necessarily true.
>>+	System.out.println(alen >= 0);
> 
> 
> I added this test in order to know whether the problem about
> FreeBSD's ioctl (http://www.kaffe.org/pipermail/kaffe/2005-July/103009.html)
> has been solved.

Thanks, Ito. I think the problems were caused by my merge of native 
portion of FileChannelImpl from GNU Classpath, in particular by the 
TARGET_* layer not being adapated to utilize Kaffe's K* thread-safe 
native wrapper functions. I've in the mean time fixed some of the 
issues, and am atm working on fixing the others. I am sorry for the 
inconvenience, I did not realize the extent of problems this change 
would cause. ;(

I've removed the ioctl based implementation of avail in the target layer 
since Kaffe does not have a thread safe ioctl wrapper, and I did not 
want to introduce one without need.

> But this test failed on Linux 2.6.7-co-0.6.2 because available()
> returned 1. So I changed the test criterion.

Thanks!

> By the way, isn't it a problem that available() returns 1 when
> a several hundred byte file is being read?

The current implementation should be able to return the full file size 
for normal files when fstat is used. Unfortunately, I had forgotten to 
add a check for fstat to configure.ac, which caused that code to be 
ignored, and instead the select implementation of available to be used. 
The select implementation can only detect whether something is available 
for reading or not, so therefore the 0 or 1 answers for available length.

I have added the missing test to configure.ac, and checked it in. Thank 
you very much for reporting and tracking down the bug, Ito!

cheers,
dalibor topic




More information about the kaffe mailing list