From: "Jyothsna.ltp" <[email protected]>
Subject: Re: [LTP] [PATCH] Growfiles: Fix Test Failures
Date: Fri, 10 Apr 2009 17:52:58 -0700 (PDT)

> 
> I observed something in tlibio.h.
> 
> LIO_IO_TYPES and LIO_WAIT_TYPES are not defined for uClinux.
> 
> They are defined for other linux varieties like regular linux, cray, hp etc.
> but not uClinux.
> 
> and that is why io_type gets a wrong value in fs/doio/growfile.c(though
> LIO_RANDOM bit inside is correct) 
> which eventually fails at line 996 in tlibio.c(shown below) as no random
> method could be obtained as LIO_IO_TYPES and LIO_WAIT_TYPES are undefined
> for uClinux
> 
> case 'I':
> #if NEWIO
>                       if((io_type=lio_parse_io_arg1(optarg)) == -1 ) {
> 
> 
> else {
>   996         printf("DEBUG %s/%d: No I/O method chosen\n", __FILE__, 
> __LINE__ );
>

I am not sure what kinds of IO and wait methods are available on
uClinux, but by looking at the code in tlibio.h, the following method
seems not supported there,

  #if defined(sgi) || (defined(__linux__) && !defined(__UCLIBC__))
      else if ( method & LIO_IO_SYNCP ) {

     ...
          io_type="pwrite(2)";
      } /* LIO_IO_SYNCP */
  #endif

So whenever LIO_IO_SYNCP was chosen as the random IO method, it will
skip the above code and failback to "No I/O method chosen". Can you try
the following patch to see if it fixes the problem? It drops
LIO_IO_SYNCP as an avaliable method for uClinux, and also narrows down
the wait methods since it does not support async IO there. I'd hope
someone knew better than me about uClinux to review this patch.

Signed-off-by: CAI Qian <[email protected]>

--- include/tlibio.h.orig       2009-04-12 19:47:29.000000000 +0800
+++ include/tlibio.h    2009-04-12 20:35:23.000000000 +0800
@@ -41,12 +41,12 @@
 #define LIO_IO_ATYPES           00077   /* all io types */
 #define LIO_IO_TYPES            00061   /* all io types, non-async */
 #endif /* sgi */
-#if defined(__linux__)
+#if defined(__linux__) && !defined(__UCLIBC__)
 #define LIO_IO_TYPES            00061   /* all io types */
 #define LIO_IO_ATYPES           00077   /* all io types */
 #endif
-#if defined(__sun) || defined(__hpux) || defined(_AIX)
-#define LIO_IO_TYPES            00021   /* all io types */
+#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__)
+#define LIO_IO_TYPES            00021   /* all io types except pread/pwrite */
 #endif /* linux */
 #ifdef CRAY
 #define LIO_IO_TYPES            00017   /* all io types */
@@ -61,13 +61,13 @@
 #define LIO_WAIT_RECALL         00040000 /* call recall(2)/aio_suspend(3) */
 #define LIO_WAIT_SIGPAUSE       00100000 /* call pause */
 #define LIO_WAIT_SIGACTIVE      00200000 /* spin waiting for signal */
-#if defined(sgi) || defined(__linux__)
+#if defined(sgi) || defined(__linux__) || !defined(__UCLIBC__)
 #define LIO_WAIT_CBSUSPEND      00400000 /* aio_suspend waiting for callback */
 #define LIO_WAIT_SIGSUSPEND     01000000 /* aio_suspend waiting for signal */
 #define LIO_WAIT_ATYPES         01760000 /* all async wait types, except 
nowait */
 #define LIO_WAIT_TYPES          00020000 /* all sync wait types (sorta) */
 #endif /* sgi */
-#if defined(__sun) || defined(__hpux) || defined(_AIX)
+#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__)
 #define LIO_WAIT_TYPES          00300000 /* all wait types, except nowait */
 #endif /* linux */
 #ifdef CRAY
 
> 
> 
> Cai Qian-6 wrote:
>> 
>> Hi,
>> 
>> This patch fixes gf07 and other gf* test failures reported earlier,
>> 
>> gf01                           FAIL       1
>> gf02                           FAIL       1
>> gf03                           PASS       0
>> gf04                           PASS       0
>> gf05                           FAIL       1
>> gf06                           PASS       0
>> gf07                           FAIL       1
>> gf08                           PASS       0
>> gf09                           FAIL       1
>> gf10                           FAIL       1
>> gf11                           FAIL       1
>> gf12                           PASS       0
>> gf13                           FAIL       1
>> gf14                           PASS       0
>> gf15                           FAIL       1
>> gf16                           PASS       0
>> gf17                           PASS       0
>> gf18                           FAIL       1
>> gf19                           FAIL       1
>> 
>> The first problem is that the lastest patch against lib/Makefile always
>> exported some unnecessary symbols,
>> 
>>   CFLAGS+= -D_USC_LIB_ -D__UCLIBC__
>> 
>> which broke the tlibio.c functionalities. For example,
>> 
>> ...
>>   #if defined(sgi) || (defined(__linux__) && !defined(__UCLIBC__))
>>       else if ( method & LIO_IO_SYNCP ) {
>>        io_type="pread(2)";
>> ...
>> 
>> All of those code above will never get executed for Linux PCs, even if
>> it has nothing to do with UCLIBC. As the results, tests failed due to
>> falling back to no suitable IO methods found,
>> 
>>   else {
>>      printf("DEBUG %s/%d: No I/O method chosen\n", __FILE__, __LINE__ );
>>      return -1;
>> 
>> The second problem is that gf07 test case failed with the following
>> (with debug flags enabled for both tlibio.c and growfiles.c),
>> 
>> # growfiles -W gf07 -b -e 1 -r 1-5000 -R 0--2 -i 0 -L 30 -C 1 -I p
>>   g_rand13 g_rand13.2 -D 9
>> 
>> ...
>> growfiles: 12182 DEBUG3 growfiles.c/2038: lseeked to random offset 2052
>> (fsz:0)
>> growfiles: 12182 DEBUG3 growfiles.c/2080: attempting to write 4250 bytes
>> ...
>> growfiles: 12182 DEBUG5 growfiles.c/2173: about to chop Woffset.
>> tmp=2052, grow_incr=4250, Woffset was 2052
>> growfiles: 12182 DEBUG2 growfiles.c/2197: 1 wrote 4250 bytes(off:0),
>> grew file by 4250 bytes
>> growfiles: 12182 DEBUG3 growfiles.c/2418: about to do write validation,
>> offset = 0, size = 4250
>> growfiles: 12182 DEBUG4 growfiles.c/2428: lseeked to offset:0
>> DEBUG tlibio.c/1337: aio_read(fildes=3, buf, nbytes=4250, signo=10)
>> ...
>> growfiles(gf07): 12182 growfiles.c/2513: 1 CW data mismatch at offset 0,
>> exp:0101, act:0 in file g_rand13
>> ...
>> 
>> This is due to when doing write validation, it started from an incorrect
>> offset -- 0! The file was originally written from a random offset
>> 2052. However, it looks like a known issue for async IO highlighted in
>> growfiles.c, which has already been manually worked around for SGI
>> platform.
>> 
>> #if NEWIO
>> #ifdef sgi
>>  /* If this is POSIX I/O and it is via aio_{read,write}
>>   * or lio_listio then after completion of the I/O the
>>   * value of the file offset for the file is
>>   * unspecified--which means we cannot trust what
>>   * tell() told us.  Fudge it here.
>>   */
>> 
>> So, we probably need to do the same for __linux__.
>> 
>> Signed-off-by: CAI Qian <[email protected]>
>> 
>> --- ltp-full-20090228/lib/Makefile.orig      2009-04-02 15:33:19.000000000
>> +0800
>> +++ ltp-full-20090228/lib/Makefile   2009-04-02 15:39:21.000000000 +0800
>> @@ -2,12 +2,13 @@
>>  PREFIX=/opt/ltp
>>  
>>  CFLAGS+= -Wall
>> -CFLAGS+= -D_USC_LIB_ -D__UCLIBC__
>>  CPPFLAGS+= -I../include 
>>  ifeq ($(shell uname -s),HP-UX)
>>  CFLAGS+=-Ae -D_LARGEFILE64_SOURCE +DA1.1
>>  endif
>> -CFLAGS+=$(if $(UCLINUX),-DUCLINUX)
>> +ifeq ($(UCLINUX),1)
>> +CFLAGS+= -D_USC_LIB_ -D__UCLIBC__ -DUCLINUX
>> +endif
>>  LDFLAGS+=
>>  TARGET=libltp.a
>>  SRCS=$(wildcard *.c)
>> --- ltp-full-20090228/testcases/kernel/fs/doio/growfiles.c.orig      
>> 2009-04-02
>> 15:31:39.000000000 +0800
>> +++ ltp-full-20090228/testcases/kernel/fs/doio/growfiles.c   2009-04-02
>> 15:32:53.000000000 +0800
>> @@ -2115,7 +2115,7 @@
>>                              return -1;
>>                      }
>>  #if NEWIO
>> -#ifdef sgi
>> +#if defined(sgi) || defined(__linux__)
>>                      /* If this is POSIX I/O and it is via aio_{read,write}
>>                       * or lio_listio then after completion of the I/O the
>>                       * value of the file offset for the file is
>> @@ -2131,7 +2131,7 @@
>>                                      tmp = Woffset + grow_incr;
>>                              }
>>                      }
>> -#endif
>> +#endif /* sgi __linux__ */
>>  #endif
>>              }
>>              *curr_size_ptr=tmp;     /* BUG:14136 */
>> 
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Ltp-list mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>> 
>> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/-PATCH--Growfiles%3A-Fix-Test-Failures-tp22844092p22996795.html
> Sent from the ltp-list mailing list archive at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to