[Ecm-commits] r2621 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Tue Feb 17 09:24:47 CET 2015


Author: zimmerma
Date: 2015-02-17 09:24:47 +0100 (Tue, 17 Feb 2015)
New Revision: 2621

Modified:
   trunk/random.c
   trunk/test.ecm
Log:
more coverage


Modified: trunk/random.c
===================================================================
--- trunk/random.c	2015-02-15 19:39:46 UTC (rev 2620)
+++ trunk/random.c	2015-02-17 08:24:47 UTC (rev 2621)
@@ -146,35 +146,22 @@
   rndfd = fopen ("/dev/urandom", "rb");
   if (rndfd != NULL)
     {
-      if (fread (&t, sizeof (unsigned long), 1, rndfd) == 1)
-        {
-/* warning: outputf is not exported from libecm */
-#if !defined (OUTSIDE_LIBECM)
-          outputf (OUTPUT_DEVVERBOSE, "Got seed for RNG from /dev/urandom\n");
-#endif
-          fclose (rndfd);
-          return t;
-        }
+      int res;
+
+      res = fread (&t, sizeof (unsigned long), 1, rndfd);
       fclose (rndfd);
+      if (res == 1)
+        return t;
     }
 
 #ifdef HAVE_GETTIMEOFDAY
   if (gettimeofday (&tv, NULL) == 0)
     {
-/* warning: outputf is not exported from libecm */
-#if !defined (OUTSIDE_LIBECM)
-      outputf (OUTPUT_DEVVERBOSE, "Got seed for RNG from gettimeofday()\n");
-#endif
       return (unsigned long) tv.tv_sec + 
              (unsigned long) tv.tv_usec * 2147483629UL;
     }
 #endif
 
-/* warning: outputf is not exported from libecm */
-#if !defined (OUTSIDE_LIBECM)
-  outputf (OUTPUT_DEVVERBOSE, "Got seed for RNG from time()+getpid()\n");
-#endif
-
   /* Multiply one value by a large prime to get a bit of avalance effect */
   return (unsigned long) time (NULL) + 
          (unsigned long) getpid () * 2147483629UL;

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-15 19:39:46 UTC (rev 2620)
+++ trunk/test.ecm	2015-02-17 08:24:47 UTC (rev 2621)
@@ -353,6 +353,10 @@
 # exercise batch mode
 echo 33852066257429811148979390609187539760850944806763555795340084882048986912482949506591909041130651770779842162499482875755533111808276172876211496409325473343590723224081353129229935527059488811457730702694849036693756201766866018562295004353153066430367 | $ECM -v -sigma 1:17 1e6; checkcode $? 0
 fi
+
+# exercise -h
+$ECM -h
+
 $ECM -printconfig | grep Tuning
 
 echo "All ECM tests are ok."



More information about the Ecm-commits mailing list