Hi Paul,

A test can be non-silent when there is a hint that it is not working
correctly. For example, if the getloadavg() values are all 0, or if there
is a problem with the scaling. How about this? It's basically what a human
would do when executing the manual test.


2011-02-16  Bruno Haible  <br...@clisp.org>

        getloadavg test: Add some plausibility checks.
        * tests/test-getloadavg.c (check_avg): Print a warning when the value
        is improbable.

--- tests/test-getloadavg.c.orig        Wed Feb 16 12:24:44 2011
+++ tests/test-getloadavg.c     Wed Feb 16 12:24:21 2011
@@ -30,6 +30,14 @@
 {
   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 > 100)
+        printf ("suspiciously high %d-minute average: %f\n", minutes, avg);
+    }
   if (avg < 0 || avg != avg)
     exit (minutes);
 }

-- 
In memoriam Mildred Fish-Harnack <http://en.wikipedia.org/wiki/Mildred_Harnack>

Reply via email to