mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
tests/tcg/multiarch: Improve mutator randomness
Currently mutators perform the same actions, because the RNG seed is derived from the current time in seconds. Mix in thread ID. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260706165445.57418-3-iii@linux.ibm.com>
This commit is contained in:
committed by
Richard Henderson
parent
e03b7dac65
commit
39678e16e8
@@ -11,6 +11,7 @@
|
||||
* pages, which are guaranteed to have the respective protection bit set.
|
||||
* Two mutator threads change the non-fixed protection bits randomly.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
@@ -121,7 +122,7 @@ static void *thread_mutate(void *arg)
|
||||
unsigned int seed;
|
||||
int prot, ret;
|
||||
|
||||
seed = (unsigned int)time(NULL);
|
||||
seed = (unsigned int)time(NULL) + (unsigned int)gettid();
|
||||
for (i = 0; i < 10000; i++) {
|
||||
start_idx = rand_r(&seed) & PAGE_IDX_MASK;
|
||||
end_idx = rand_r(&seed) & PAGE_IDX_MASK;
|
||||
|
||||
Reference in New Issue
Block a user