getloadavg test: skip the test on GNU/Linux without /proc mounted
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 11 Jan 2012 20:49:06 +0000 (00:49 +0400)
committerEric Blake <eblake@redhat.com>
Wed, 11 Jan 2012 20:54:10 +0000 (13:54 -0700)
GNU libc implements getloadavg(3) on Linux by parsing /proc/loadavg
file.  When /proc is not mounted, it always fails with ENOENT.
* tests/test-getloadavg.c (main): Treat ENOENT return code from
getloadavg(3) the same way as ENOSYS and ENOTSUP.

ChangeLog
tests/test-getloadavg.c

index f302d88..9d5f746 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-11  Dmitry V. Levin  <ldv@altlinux.org>
+
+       getloadavg test: skip the test on GNU/Linux without /proc mounted
+       GNU libc implements getloadavg(3) on Linux by parsing /proc/loadavg
+       file.  When /proc is not mounted, it always fails with ENOENT.
+       * tests/test-getloadavg.c (main): Treat ENOENT return code from
+       getloadavg(3) the same way as ENOSYS and ENOTSUP.
+
 2012-01-10  Bruno Haible  <bruno@clisp.org>
 
        regex: Avoid link error on MSVC 9.
index afed69c..39a8375 100644 (file)
@@ -60,7 +60,7 @@ main (int argc, char **argv)
       int loads = getloadavg (avg, 3);
       if (loads == -1)
         {
-          if (! (errno == ENOSYS || errno == ENOTSUP))
+          if (! (errno == ENOSYS || errno == ENOTSUP || errno == ENOENT))
             return 1;
           perror ("Skipping test; load average not supported");
           return 77;