bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linux 2.0 test failures (was glibc 2.2: math test failures)


From: Michael Deutschmann
Subject: Linux 2.0 test failures (was glibc 2.2: math test failures)
Date: Sun, 10 Jun 2001 11:54:46 -0700 (PDT)

On 30 Apr 2001, you wrote:
> > No, I meant that the tests presuppose Linux 2.2 features, so if I run
> > "make check" on Linux *2.0*, these two tests always fail, as 2.0 does not
> > support LFS or "realtime" signals above 32.
> 
> I see.  If it still fails for you in 2.2.3, please send a patch to fix
> it.  The glibc developers don't use such an old kernel and therefore

2.2.3 still has the problems, although I think I've got them handled.

The LFS was actually easy to fix.  The test was already prepared to 
check for LFS-not-available.  The problem was it expected an unimplemented
write() in the 64-bit region to return EINVAL, rather than EFBIG.

That said, there are some other minor niggles with the test.  From most 
serious down:

  - it assumes write() will always return -1 or 5.  Incomplete writes are
highly unlikely on such a small area of a regular file, but this isn't
guaranteed to my knowledge.  As it is, if it did happen, it would be 
reported as an error using whatever garbage happened to be in errno. 
  
  - It would be a good idea to verify that the filesystem supports holes 
before performing the check -- otherwise `spurious' ENOSPC errors could 
occur...

  - it considers the LFS not supported case in the stdio-level subtests.
    this is actually not neccessary since that part would be skipped if 
    the low-level test detected no LFS.  If LFS is available at the low 
    level, then there is no excuse for a failure at stdio-level.

  - there are a few cases where the punctuation at the end of a message 
    in "error()" is not appropriate, considering that error() will tack 
    on the strerror() text.

But I decided to keep it simple for now and just change EINVAL to EFBIG.

I also changed the aio4 test to detect lack of SIGRTMIN/SIGRTMAX.  One 
thing -- I noticed the present code just assumes SIGRTMIN+11 is 
available, without verifying it is under SIGRTMAX.  My code takes the 
average of the two values to choose a signal.  (I assume there was some 
reason just using SIGRTMAX or SIGRTMIN wouldn't trip as many bugs.)

> can't test it themselves - and no, we're not going to add a test "if
> this is Linux 2.0,..." but checks for ENOSYS tests are fine.

Fine.  Although you should know glibc already has such a test, for the 
same feature.  The code reads the kernel version in uname() and compares 
against 2.1.70 -- something that could be unstable in the face of 
backports, "slimmed down" kernels, and Linux emulators.

IMO, it would be better if you probed by attempting to read the signal 
handler for __SIGRTMAX with sigaction(), and checking for EINVAL.  This 
could easily be extended to a binary search for the highest working 
RT signal, allowing kernels with any number of signals to be supported.

--

Finally, about the failures of tst-chmod under NFS.  I was wondering -- I
notice the test goes to some trouble to create the directory in the build
directory (needing it passed in on the command line).  If it used the /tmp
directory like most other ones do, it would not have been exposed to the
nonidealities of NFS (and thus would work reliably).  Is there a reason
for this?

---- Michael Deutschmann <address@hidden>

diff -durpN glibc-2.2.3/io/test-lfs.c glibc-work/io/test-lfs.c
--- glibc-2.2.3/io/test-lfs.c   Fri Feb  9 10:04:07 2001
+++ glibc-work/io/test-lfs.c    Sun Jun 10 03:30:57 2001
@@ -115,7 +115,7 @@ test_ftello (void)
     }
 
   ret = fwrite ("Hello", 1, 5, f);
-  if (ret == -1 && errno == EINVAL)
+  if (ret == -1 && errno == EFBIG)
     {
       error (0, errno, "LFS seems not to be supported.");
       exit (EXIT_SUCCESS);
@@ -159,7 +159,7 @@ do_test (int argc, char *argv[])
     }
 
   ret = write (fd, "Hello", 5);
-  if (ret == -1 && errno == EINVAL)
+  if (ret == -1 && errno == EFBIG)
     {
       error (0, errno, "LFS seems not to be supported.");
       exit (EXIT_SUCCESS);
diff -durpN glibc-2.2.3/rt/tst-aio4.c glibc-work/rt/tst-aio4.c
--- glibc-2.2.3/rt/tst-aio4.c   Sat Jan  6 20:35:28 2001
+++ glibc-work/rt/tst-aio4.c    Sun Jun 10 03:30:57 2001
@@ -26,7 +26,7 @@
 /* We might need a bit longer timeout.  */
 #define TIMEOUT 10 /* sec */
 
-#define MY_SIGNO (SIGRTMIN + 11)
+int my_signo;
 
 volatile sig_atomic_t flag;
 
@@ -46,7 +46,7 @@ wait_flag (void)
       sleep (1);
     }
 
-  if (flag != MY_SIGNO)
+  if (flag != my_signo)
     {
       printf ("signal handler received wrong signal, flag is %d\n", flag);
       return 1;
@@ -68,6 +68,15 @@ do_test (int argc, char *argv[])
   struct sigaction sa;
   struct sigevent ev;
 
+  if (SIGRTMIN == -1)
+  {
+      printf("RT signals not supported.\n");
+      exit(0);
+  }
+
+  /* Select a signal from the middle of the available choices... */
+  my_signo = (SIGRTMAX + SIGRTMIN) / 2;
+
   fd = mkstemp (name);
   if (fd == -1)
     {
@@ -90,19 +99,19 @@ do_test (int argc, char *argv[])
   cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
   cb.aio_sigevent.sigev_notify_function = NULL;
   cb.aio_sigevent.sigev_notify_attributes = NULL;
-  cb.aio_sigevent.sigev_signo = MY_SIGNO;
+  cb.aio_sigevent.sigev_signo = my_signo;
   cb.aio_sigevent.sigev_value.sival_ptr = NULL;
 
   ev.sigev_notify = SIGEV_SIGNAL;
   ev.sigev_notify_function = NULL;
   ev.sigev_notify_attributes = NULL;
-  ev.sigev_signo = MY_SIGNO;
+  ev.sigev_signo = my_signo;
 
   sa.sa_handler = sighandler;
   sigemptyset (&sa.sa_mask);
   sa.sa_flags = SA_RESTART;
 
-  if (sigaction (MY_SIGNO, &sa, NULL) < 0)
+  if (sigaction (my_signo, &sa, NULL) < 0)
     {
       printf ("sigaction failed: %m\n");
       return 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]