https://llvm.org/bugs/show_bug.cgi?id=31730

            Bug ID: 31730
           Summary: Tests should not use rand()
           Product: Test Suite
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Programs Tests
          Assignee: unassignedb...@nondot.org
          Reporter: ma...@braunis.de
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

rand() can produce different numbers with different libc implementations.
Therefore we should not use it in the test-suite to get portable tests. Today a
test like this:

$ grep "\<rand\s*()" SingleSource/ MultiSource/ -r

shows 54 affected files. We should probably write a simple everything in one
header  random number generator and replace the rand() usage with that in the
tests.


There is an additional problem of benchmarks that do not even use srand() to
get a deterministic random number sequence from run to run. We spotted this
benchmarking anti-pattern in SingleSource//UnitTests/SignlessTypes/rem.c but
the other benchmarks should be audited for that as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to