maint: update copyright
[gnulib.git] / tests / test-getloadavg.c
index f9b4a79..37661c2 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of getting load average.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2014 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -30,6 +30,14 @@ check_avg (int minutes, double avg, int printit)
 {
   if (printit)
     printf ("%d-minute: %f  ", minutes, avg);
+  else
+    {
+      /* Plausibility checks.  */
+      if (avg < 0.01)
+        printf ("suspiciously low %d-minute average: %f\n", minutes, avg);
+      if (avg > 1000000)
+        printf ("suspiciously high %d-minute average: %f\n", minutes, avg);
+    }
   if (avg < 0 || avg != avg)
     exit (minutes);
 }
@@ -52,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;