Memtest. Added uint64_t test.
This commit is contained in:
parent
c457b4d7d1
commit
bf7d3ef855
|
@ -128,13 +128,19 @@ public:
|
|||
|
||||
T get(void) {
|
||||
T ret;
|
||||
T mask = -1;
|
||||
|
||||
if ((step & 1) == 0) {
|
||||
ret = rand() & mask;
|
||||
ret = 0;
|
||||
ret |= rand();
|
||||
if (8 == sizeof(T)) {
|
||||
// multiplication used instead of 32 bit shift for warning avoidance
|
||||
ret *= 0x100000000;
|
||||
ret |= rand();
|
||||
}
|
||||
prev = ret;
|
||||
}
|
||||
else {
|
||||
ret = ~prev & mask;
|
||||
ret = ~prev;
|
||||
}
|
||||
step++;
|
||||
|
||||
|
@ -226,7 +232,8 @@ static void moving_inversion_rand(memtest_t *testp) {
|
|||
static void memtest_wrapper(memtest_t *testp,
|
||||
void (*p_u8)(memtest_t *testp),
|
||||
void (*p_u16)(memtest_t *testp),
|
||||
void (*p_u32)(memtest_t *testp)) {
|
||||
void (*p_u32)(memtest_t *testp),
|
||||
void (*p_u64)(memtest_t *testp)) {
|
||||
|
||||
if (testp->width_mask & MEMTEST_WIDTH_8)
|
||||
p_u8(testp);
|
||||
|
@ -236,6 +243,9 @@ static void memtest_wrapper(memtest_t *testp,
|
|||
|
||||
if (testp->width_mask & MEMTEST_WIDTH_32)
|
||||
p_u32(testp);
|
||||
|
||||
if (testp->width_mask & MEMTEST_WIDTH_64)
|
||||
p_u64(testp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -247,42 +257,48 @@ void memtest_run(memtest_t *testp, uint32_t testmask) {
|
|||
memtest_wrapper(testp,
|
||||
walking_one<uint8_t>,
|
||||
walking_one<uint16_t>,
|
||||
walking_one<uint32_t>);
|
||||
walking_one<uint32_t>,
|
||||
walking_one<uint64_t>);
|
||||
}
|
||||
|
||||
if (testmask & MEMTEST_WALKING_ZERO) {
|
||||
memtest_wrapper(testp,
|
||||
walking_zero<uint8_t>,
|
||||
walking_zero<uint16_t>,
|
||||
walking_zero<uint32_t>);
|
||||
walking_zero<uint32_t>,
|
||||
walking_zero<uint64_t>);
|
||||
}
|
||||
|
||||
if (testmask & MEMTEST_OWN_ADDRESS) {
|
||||
memtest_wrapper(testp,
|
||||
own_address<uint8_t>,
|
||||
own_address<uint16_t>,
|
||||
own_address<uint32_t>);
|
||||
own_address<uint32_t>,
|
||||
own_address<uint64_t>);
|
||||
}
|
||||
|
||||
if (testmask & MEMTEST_MOVING_INVERSION_ZERO) {
|
||||
memtest_wrapper(testp,
|
||||
moving_inversion_zero<uint8_t>,
|
||||
moving_inversion_zero<uint16_t>,
|
||||
moving_inversion_zero<uint32_t>);
|
||||
moving_inversion_zero<uint32_t>,
|
||||
moving_inversion_zero<uint64_t>);
|
||||
}
|
||||
|
||||
if (testmask & MEMTEST_MOVING_INVERSION_55AA) {
|
||||
memtest_wrapper(testp,
|
||||
moving_inversion_55aa<uint8_t>,
|
||||
moving_inversion_55aa<uint16_t>,
|
||||
moving_inversion_55aa<uint32_t>);
|
||||
moving_inversion_55aa<uint32_t>,
|
||||
moving_inversion_55aa<uint64_t>);
|
||||
}
|
||||
|
||||
if (testmask & MEMTEST_MOVING_INVERSION_RAND) {
|
||||
memtest_wrapper(testp,
|
||||
moving_inversion_rand<uint8_t>,
|
||||
moving_inversion_rand<uint16_t>,
|
||||
moving_inversion_rand<uint32_t>);
|
||||
moving_inversion_rand<uint32_t>,
|
||||
moving_inversion_rand<uint64_t>);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#define MEMTEST_WIDTH_8 (1 << 0)
|
||||
#define MEMTEST_WIDTH_16 (1 << 1)
|
||||
#define MEMTEST_WIDTH_32 (1 << 2)
|
||||
#define MEMTEST_WIDTH_64 (1 << 3)
|
||||
|
||||
typedef struct memtest_t memtest_t;
|
||||
typedef uint32_t testtype;
|
||||
|
|
Loading…
Reference in New Issue