Commit aaa52a3d7137720dff136143368cd9febd282256

Steffen Jaeckel 2017-10-19T12:01:58

also run test vs mtest with real random data

diff --git a/.travis.yml b/.travis.yml
index fcc6dc2..37fe211 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,9 @@ script:
   - ./testme.sh --with-cc=$CC ${BUILDOPTIONS}
 env:
   - |
-    BUILDOPTIONS="--test-vs-mtest=666666"
+    BUILDOPTIONS="--test-vs-mtest=333333"
+  - |
+    BUILDOPTIONS="--test-vs-mtest=333333 --mtest-real-rand"
   - |
     BUILDOPTIONS="--with-low-mp"
   - |
diff --git a/mtest/mtest.c b/mtest/mtest.c
index af86920..1e2da10 100644
--- a/mtest/mtest.c
+++ b/mtest/mtest.c
@@ -151,8 +151,9 @@ int main(int argc, char *argv[])
    if (rng == NULL) {
       rng = fopen("/dev/random", "rb");
       if (rng == NULL) {
-         fprintf(stderr, "\nWarning:  stdin used as random source\n\n");
-         rng = stdin;
+         fprintf(stderr, "\nWarning:  no /dev/[u]random available\n\n");
+         printf("exit\n");
+         return 1;
       }
    }
 #else
diff --git a/testme.sh b/testme.sh
index acb8891..5dce2d2 100755
--- a/testme.sh
+++ b/testme.sh
@@ -48,6 +48,8 @@ _help()
   echo
   echo "    --with-low-mp           Also build&run tests with -DMP_{8,16,32}BIT."
   echo
+  echo "    --mtest-real-rand       Use real random data when running mtest."
+  echo
   echo "Godmode:"
   echo
   echo "    --all                   Choose all architectures and gcc and clang as compilers"
@@ -115,6 +117,7 @@ COMPILERS=""
 CFLAGS=""
 WITH_LOW_MP=""
 TEST_VS_MTEST=""
+MTEST_RAND=""
 
 while [ $# -gt 0 ];
 do
@@ -142,6 +145,9 @@ do
          exit -1
       fi
     ;;
+    --mtest-real-rand)
+      MTEST_RAND="-DLTM_MTEST_REAL_RAND"
+    ;;
     --all)
       COMPILERS="gcc clang"
       ARCHFLAGS="-m64 -m32 -mx32"
@@ -184,7 +190,7 @@ then
    make clean > /dev/null
    _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test"
    echo
-   _make "gcc" "" "mtest"
+   _make "gcc" "$MTEST_RAND" "mtest"
    echo
    echo "Run test vs. mtest for $TEST_VS_MTEST iterations"
    for i in `seq 1 10` ; do sleep 500 && echo alive; done &