[llvm-bugs] [Bug 31730] New: Tests should not use rand()

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 23 19:05:24 PST 2017


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: unassignedbugs at nondot.org
          Reporter: matze at braunis.de
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170124/119f660e/attachment.html>


More information about the llvm-bugs mailing list