From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 74216385780D; Tue, 26 Apr 2022 13:12:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74216385780D MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-10573] libstdc++: Make spurious std::random_device FAIL less likely X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 021540f17b80599adb1aa1475141d456a5194626 X-Git-Newrev: c8f35df75ddfd5bab377721582aafb6a5a1463fe Message-Id: <20220426131256.74216385780D@sourceware.org> Date: Tue, 26 Apr 2022 13:12:56 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2022 13:12:56 -0000 https://gcc.gnu.org/g:c8f35df75ddfd5bab377721582aafb6a5a1463fe commit r10-10573-gc8f35df75ddfd5bab377721582aafb6a5a1463fe Author: Jonathan Wakely Date: Tue Nov 9 10:31:18 2021 +0000 libstdc++: Make spurious std::random_device FAIL less likely It's possible that independent reads from /dev/random and /dev/urandom could produce the same value by chance. Retry if that happens. The chances of it happening twice are miniscule. libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/random_device/cons/token.cc: Retry if random devices produce the same value. (cherry picked from commit 8d2d0a6c4391e462555db6d33b2cc00f3da0932f) Diff: --- libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc index 42887703b75..5797571584b 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc @@ -41,7 +41,7 @@ test02() #ifdef _GLIBCXX_USE_DEV_RANDOM std::random_device x1("/dev/urandom"); std::random_device x2("/dev/random"); - VERIFY( x1() != x2() ); + VERIFY( x1() != x2() || x1() != x2() ); #endif }