[MemTesterNX] Add multi-thread(3) support and option to stress DRAM
This commit is contained in:
15
README.md
15
README.md
@@ -30,8 +30,8 @@ This project will not be actively maintained by me and I'm looking for collabora
|
|||||||
- Game recording and SysDVR streaming @ 60fps with high video bitrate
|
- Game recording and SysDVR streaming @ 60fps with high video bitrate
|
||||||
- Option to change the threshold for chargers providing enough power
|
- Option to change the threshold for chargers providing enough power
|
||||||
- **TinyMemBenchNX**: DRAM throughput and latency test based on [tinymembench](https://github.com/ssvb/tinymembench)
|
- **TinyMemBenchNX**: DRAM throughput and latency test based on [tinymembench](https://github.com/ssvb/tinymembench)
|
||||||
- MemTesterNX: A userspace utility for testing DRAM faults based on [memtester](https://pyropus.ca/software/memtester/)
|
- **MemTesterNX**: A userspace utility for testing DRAM faults and stability based on [memtester](https://pyropus.ca/software/memtester/)
|
||||||
- For testing stability, GPU/DRAM-heavy games like BotW/MHR will do better jobs as it's easier to spot framebuffer corruption/freeze
|
- Now with multi-thread support and "stress DRAM" option, it should be able to test DRAM stability with adjusted timings.
|
||||||
|
|
||||||
#### Details
|
#### Details
|
||||||
|
|
||||||
@@ -104,21 +104,16 @@ This project will not be actively maintained by me and I'm looking for collabora
|
|||||||
|
|
||||||
- Modded `loader.kip` with embedded pcv, ptm, am-no-copyright, ValidateAcidSignature patches
|
- Modded `loader.kip` with embedded pcv, ptm, am-no-copyright, ValidateAcidSignature patches
|
||||||
- Prebuilt sys-clk-OC and ReverseNX-RT modified for OC
|
- Prebuilt sys-clk-OC and ReverseNX-RT modified for OC
|
||||||
- Hekate with DRAM overvolting patch
|
|
||||||
- `system-settings.ini` with some QoL improvements
|
- `system-settings.ini` with some QoL improvements
|
||||||
|
|
||||||
1. **Restoring pcv backup if you have patched pcv module manually:** Launch the `patcher.te` script via TegraExplorer to restore your backup. Separated **ptm patches should be removed** to avoid conflicts.
|
1. Copy all the files in `SdOut` to the root of SD card. `system_settings.ini` should be edited manually.
|
||||||
|
|
||||||
2. Copy all the files in `SdOut` to the root of SD card. `system_settings.ini` should be edited manually.
|
2. Grab `x.x.x_loader_xxxx.x.kip` for your Atmosphere version and desired RAM frequency, rename it to `loader.kip` and place it in `/atmosphere/kips/`.
|
||||||
|
|
||||||
3. Grab `x.x.x_loader_xxxx.x.kip` for your Atmosphere version and desired RAM frequency, rename it to `loader.kip` and place it in `/atmosphere/kips/`.
|
|
||||||
|
|
||||||
4. **Hekate-ipl bootloader:**
|
|
||||||
|
|
||||||
|
3. **Hekate-ipl bootloader**
|
||||||
- Rename the kip to `loader.kip` and add `kip1=atmosphere/kips/loader.kip` in `bootloader/hekate_ipl.ini`
|
- Rename the kip to `loader.kip` and add `kip1=atmosphere/kips/loader.kip` in `bootloader/hekate_ipl.ini`
|
||||||
|
|
||||||
**Atmosphere Fusee bootloader:**
|
**Atmosphere Fusee bootloader:**
|
||||||
|
|
||||||
- Fusee will load any kips in `/atmosphere/kips/` automatically.
|
- Fusee will load any kips in `/atmosphere/kips/` automatically.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* memtester version 4
|
* MemTesterNX
|
||||||
|
* based on memtester version 4
|
||||||
*
|
*
|
||||||
* Very simple but very effective user-space memory tester.
|
* Very simple but very effective user-space memory tester.
|
||||||
* Originally by Simon Kirby <sim@stormix.com> <sim@neato.org>
|
* Originally by Simon Kirby <sim@stormix.com> <sim@neato.org>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __version__ "4.5.1-full"
|
#define __version__ "4.5.1-multithread"
|
||||||
|
|
||||||
// Include the most common headers from the C standard library
|
// Include the most common headers from the C standard library
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
PadState pad;
|
PadState pad;
|
||||||
unsigned short dividend;
|
unsigned short dividend = 1;
|
||||||
|
|
||||||
void waitForAnyKey() {
|
void waitForAnyKey() {
|
||||||
while (appletMainLoop())
|
while (appletMainLoop())
|
||||||
@@ -73,6 +75,13 @@ void ShowErr(const char* err, const char* details, Result rc) {
|
|||||||
appletHolderRequestExit(¤tApplet);
|
appletHolderRequestExit(¤tApplet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double gettime(void)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
return (double)((int64_t)tv.tv_sec * 1000000 + tv.tv_usec) / 1000000.;
|
||||||
|
}
|
||||||
|
|
||||||
struct test tests[] = {
|
struct test tests[] = {
|
||||||
{ "Random Value", test_random_value },
|
{ "Random Value", test_random_value },
|
||||||
{ "Compare XOR", test_xor_comparison },
|
{ "Compare XOR", test_xor_comparison },
|
||||||
@@ -86,7 +95,7 @@ struct test tests[] = {
|
|||||||
{ "Block Sequential", test_blockseq_comparison },
|
{ "Block Sequential", test_blockseq_comparison },
|
||||||
{ "Checkerboard", test_checkerboard_comparison },
|
{ "Checkerboard", test_checkerboard_comparison },
|
||||||
{ "Bit Spread", test_bitspread_comparison },
|
{ "Bit Spread", test_bitspread_comparison },
|
||||||
{ "Bit Flip", test_bitflip_comparison },
|
{ "Bit Flip (Slow)", test_bitflip_comparison },
|
||||||
{ "Walking Ones", test_walkbits1_comparison },
|
{ "Walking Ones", test_walkbits1_comparison },
|
||||||
{ "Walking Zeroes", test_walkbits0_comparison },
|
{ "Walking Zeroes", test_walkbits0_comparison },
|
||||||
#ifdef TEST_NARROW_WRITES
|
#ifdef TEST_NARROW_WRITES
|
||||||
@@ -96,6 +105,13 @@ struct test tests[] = {
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct test stress_tests[] = {
|
||||||
|
{ "Stress memcpy x128", test_stress_memcpy },
|
||||||
|
{ "Stress memset x128", test_stress_memset },
|
||||||
|
{ "Stress memcmp x 32", test_stress_memcmp },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
int memtester_pagesize(void) {
|
int memtester_pagesize(void) {
|
||||||
printf("using pagesize of 4096\n");
|
printf("using pagesize of 4096\n");
|
||||||
return 4096;
|
return 4096;
|
||||||
@@ -104,6 +120,69 @@ int memtester_pagesize(void) {
|
|||||||
/* Global vars - so tests have access to this information */
|
/* Global vars - so tests have access to this information */
|
||||||
int use_phys = 0;
|
int use_phys = 0;
|
||||||
off_t physaddrbase = 0;
|
off_t physaddrbase = 0;
|
||||||
|
int testJobId[4] = {0};
|
||||||
|
int testWorkerReport[4] = {0};
|
||||||
|
size_t bufsize[4], wantbytes[4];
|
||||||
|
void volatile *aligned[4];
|
||||||
|
Thread threads[4];
|
||||||
|
struct test* test_select = tests;
|
||||||
|
|
||||||
|
void testWorker(int div)
|
||||||
|
{
|
||||||
|
// Get ready
|
||||||
|
while (testJobId[div] != -2)
|
||||||
|
svcSleepThread(10000000ULL);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
int currentJobId = -1;
|
||||||
|
|
||||||
|
// Stuck address
|
||||||
|
while (testJobId[div] != currentJobId)
|
||||||
|
svcSleepThread(10000000ULL);
|
||||||
|
|
||||||
|
if (!test_stuck_address(aligned[div], bufsize[div]/sizeof(ul)))
|
||||||
|
{
|
||||||
|
testWorkerReport[div] = 1;
|
||||||
|
currentJobId++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testWorkerReport[div] = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// tests[], currentJobId = 0 here
|
||||||
|
while (test_select[currentJobId].name)
|
||||||
|
{
|
||||||
|
while (testJobId[div] != currentJobId)
|
||||||
|
svcSleepThread(10000000ULL);
|
||||||
|
|
||||||
|
if (!test_select[currentJobId].fp(aligned[div], ((size_t)aligned[div] + bufsize[div]/2), bufsize[div]/sizeof(ul)/2))
|
||||||
|
{
|
||||||
|
testWorkerReport[div] = 1;
|
||||||
|
currentJobId++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
testWorkerReport[div] = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void testWorker0(void*) { testWorker(0); }
|
||||||
|
void testWorker1(void*) { testWorker(1); }
|
||||||
|
void testWorker2(void*) { testWorker(2); }
|
||||||
|
void testWorker3(void*) { testWorker(3); }
|
||||||
|
|
||||||
|
void* workers[] = {
|
||||||
|
testWorker0,
|
||||||
|
testWorker1,
|
||||||
|
testWorker2,
|
||||||
|
testWorker3,
|
||||||
|
};
|
||||||
|
|
||||||
// Main program entrypoint
|
// Main program entrypoint
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
@@ -121,22 +200,26 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
padInitializeDefault(&pad);
|
padInitializeDefault(&pad);
|
||||||
|
|
||||||
ul loop, i;
|
ull loop, i;
|
||||||
unsigned short div, maxdiv = 0;
|
unsigned short div, testThreads = 3;
|
||||||
size_t pagesize, wantraw, wantbytes[4], wantbytes_orig, bufsize[4], halflen, count;
|
size_t pagesize, wantraw, wantbytes_orig;
|
||||||
ptrdiff_t pagesizemask;
|
ptrdiff_t pagesizemask;
|
||||||
void volatile *buf[4], *aligned[4];
|
void volatile *buf[4];
|
||||||
ulv *bufa, *bufb;
|
|
||||||
int memshift;
|
int memshift;
|
||||||
ul testmask = 0;
|
|
||||||
ull totalmem = 0;
|
ull totalmem = 0;
|
||||||
|
int numOfMallocs = 0;
|
||||||
|
bool isDevKit8GB = false;
|
||||||
|
|
||||||
printf("MemTesterNX version " __version__ " (%d-bit)\n", UL_LEN);
|
printf("MemTesterNX version " __version__ " (%d-bit)\n"\
|
||||||
printf("Based on memtester. Copyright (C) 2001-2020 Charles Cazabon.\n");
|
"Based on memtester. Copyright (C) 2001-2020 Charles Cazabon, 2021 KazushiMe.\n"\
|
||||||
printf("Licensed under the GNU General Public License version 2 (only).\n\n");
|
"Licensed under the GNU General Public License version 2 (only).\n\n"\
|
||||||
printf("4.5.1-full supports full RAM test (up to 8GB for devkit).\n");
|
"Support full RAM test (up to 8GB) with 3-4 threads.\n"\
|
||||||
printf("It will looping forever until an error shows up or you manually exit to HOME screen.\n\n");
|
"It will be looping forever until error occurs or user exits to HOME screen.\n\n"\
|
||||||
printf("Press A: long test\nPress B: fast test\nPress any other key: exit\n\n");
|
"Press A: long test\n"\
|
||||||
|
"Press X: fast test\n"\
|
||||||
|
"Press Y: stress DRAM (memcpy, memset and memcmp)\n"\
|
||||||
|
"Press any other key: exit\n\n",
|
||||||
|
UL_LEN);
|
||||||
|
|
||||||
while (appletMainLoop())
|
while (appletMainLoop())
|
||||||
{
|
{
|
||||||
@@ -146,14 +229,19 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
if (kDown & HidNpadButton_A)
|
if (kDown & HidNpadButton_A)
|
||||||
{
|
{
|
||||||
dividend = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (kDown & HidNpadButton_B)
|
else if (kDown & HidNpadButton_X)
|
||||||
{
|
{
|
||||||
dividend = 4;
|
dividend = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (kDown & HidNpadButton_Y)
|
||||||
|
{
|
||||||
|
dividend = 16;
|
||||||
|
test_select = stress_tests;
|
||||||
|
break;
|
||||||
|
}
|
||||||
else if (kDown)
|
else if (kDown)
|
||||||
{
|
{
|
||||||
consoleExit(NULL);
|
consoleExit(NULL);
|
||||||
@@ -163,20 +251,23 @@ int main(int argc, char* argv[])
|
|||||||
consoleUpdate(NULL);
|
consoleUpdate(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable auto sleep and request CPU Boost mode
|
||||||
|
appletSetAutoSleepDisabled(true);
|
||||||
|
appletSetCpuBoostMode(ApmCpuBoostMode_FastLoad);
|
||||||
|
|
||||||
pagesize = memtester_pagesize();
|
pagesize = memtester_pagesize();
|
||||||
pagesizemask = (ptrdiff_t) ~(pagesize - 1);
|
pagesizemask = (ptrdiff_t) ~(pagesize - 1);
|
||||||
printf("pagesizemask is 0x%tx\n", pagesizemask);
|
printf("pagesizemask is 0x%tx\n", pagesizemask);
|
||||||
consoleUpdate(NULL);
|
consoleUpdate(NULL);
|
||||||
|
|
||||||
memshift = 20; /* megabytes */
|
memshift = 20; /* megabytes */
|
||||||
wantraw = 2048;
|
wantraw = 2048; // HOS limit
|
||||||
|
|
||||||
wantbytes_orig = ((size_t) wantraw << memshift);
|
wantbytes_orig = ((size_t) wantraw << memshift);
|
||||||
|
|
||||||
// Allocate as much RAM as possible.
|
// Allocate as much RAM as possible.
|
||||||
for(div = 0; div <= 3; div++)
|
for (div = 0; div <= 3; div++)
|
||||||
{
|
{
|
||||||
|
|
||||||
buf[div] = NULL;
|
buf[div] = NULL;
|
||||||
wantbytes[div] = wantbytes_orig;
|
wantbytes[div] = wantbytes_orig;
|
||||||
|
|
||||||
@@ -186,9 +277,69 @@ int main(int argc, char* argv[])
|
|||||||
wantbytes[div] -= pagesize;
|
wantbytes[div] -= pagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalmem += wantbytes[div];
|
||||||
|
|
||||||
|
if ((wantbytes[div] >> memshift) < 2047)
|
||||||
|
{
|
||||||
|
numOfMallocs = div + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (div = 0; div < numOfMallocs; div++)
|
||||||
|
{
|
||||||
|
free((void *)buf[div]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unknown: Not sure if devkit could use full 8GB in application space
|
||||||
|
if ((totalmem >> memshift) > 3 * 2047)
|
||||||
|
{
|
||||||
|
isDevKit8GB = true;
|
||||||
|
testThreads = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create workers
|
||||||
|
for (div = 0; div < testThreads; div++)
|
||||||
|
{
|
||||||
|
Result rc;
|
||||||
|
rc = threadCreate(&threads[div], workers[div], NULL, NULL, 0x1000, 0x2C, div == 3 ? -2 : div);
|
||||||
|
if (R_FAILED(rc))
|
||||||
|
{
|
||||||
|
printf("Fatal: threadCreate[%d] failed: 0x%X\n", div, rc);
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
totalmem -= 0x1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\nTotal RAM available: %lldMB\n\n", totalmem >> memshift);
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
|
||||||
|
// Redistribute RAM allocation equally to testThreads workers
|
||||||
|
for (div = 0; div < testThreads; div++)
|
||||||
|
{
|
||||||
|
buf[div] = NULL;
|
||||||
|
if (isDevKit8GB)
|
||||||
|
{
|
||||||
|
if (div != 3)
|
||||||
|
wantbytes[div] = totalmem / 3;
|
||||||
|
else
|
||||||
|
wantbytes[div] = 2047;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wantbytes[div] = totalmem / testThreads;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!buf[div] && wantbytes[div]) {
|
||||||
|
buf[div] = (void volatile *) malloc(wantbytes[div]);
|
||||||
|
if (!buf[div])
|
||||||
|
wantbytes[div] -= pagesize;
|
||||||
|
}
|
||||||
|
|
||||||
bufsize[div] = wantbytes[div];
|
bufsize[div] = wantbytes[div];
|
||||||
printf("Alloc %d: got %lluMB (%llu bytes)\n", div+1, (ull) wantbytes[div] >> 20, (ull) wantbytes[div]);
|
|
||||||
consoleUpdate(NULL);
|
|
||||||
|
|
||||||
/* Do alighnment here as well, as some cases won't trigger above if you
|
/* Do alighnment here as well, as some cases won't trigger above if you
|
||||||
define out the use of mlock() (cough HP/UX 10 cough). */
|
define out the use of mlock() (cough HP/UX 10 cough). */
|
||||||
@@ -203,68 +354,92 @@ int main(int argc, char* argv[])
|
|||||||
aligned[div] = buf[div];
|
aligned[div] = buf[div];
|
||||||
}
|
}
|
||||||
|
|
||||||
totalmem += wantbytes[div];
|
printf("Alloc %d: got %lluMB (%llu bytes)\n", div+1, (ull) wantbytes[div] >> memshift, (ull) wantbytes[div]);
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if((wantbytes[div] >> 20) < 2047)
|
// Start workers
|
||||||
|
for (div = 0; div < testThreads; div++)
|
||||||
|
{
|
||||||
|
Result rc;
|
||||||
|
rc = threadStart(&threads[div]);
|
||||||
|
if (R_FAILED(rc))
|
||||||
{
|
{
|
||||||
maxdiv = div;
|
printf("Fatal: threadStart[%d] failed: 0x%X\n", div, rc);
|
||||||
break;
|
consoleUpdate(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nTotal RAM allocated: %lldMB\n\n", totalmem >> 20);
|
|
||||||
consoleUpdate(NULL);
|
|
||||||
|
|
||||||
for(loop=1;;loop++)
|
for(loop=1;;loop++)
|
||||||
{
|
{
|
||||||
printf("Loop %lu:\n", loop);
|
// Set testJobId to -2(Ready)
|
||||||
|
for (int j = 0; j < testThreads; j++)
|
||||||
|
testJobId[j] = -2;
|
||||||
|
|
||||||
for(div=0; div<=maxdiv; div++)
|
printf("Loop %llu:\n", loop);
|
||||||
|
|
||||||
|
// Stuck address (-1)
|
||||||
|
printf(" %-20s: ", "Stuck Address");
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
for (int j = 0; j < testThreads; j++)
|
||||||
|
testJobId[j] = -1;
|
||||||
|
|
||||||
|
ull count = 0;
|
||||||
|
for (int j = 0; j < testThreads; )
|
||||||
{
|
{
|
||||||
printf("Alloc %d:\n", div+1);
|
count++;
|
||||||
printf(" %-20s: ", "Stuck Address");
|
switch (testWorkerReport[j])
|
||||||
consoleUpdate(NULL);
|
|
||||||
|
|
||||||
halflen = bufsize[div] / 2;
|
|
||||||
count = halflen / sizeof(ul);
|
|
||||||
bufa = (ulv *) aligned[div];
|
|
||||||
bufb = (ulv *) ((size_t) aligned[div] + halflen);
|
|
||||||
|
|
||||||
if (!test_stuck_address(aligned[div], bufsize[div] / sizeof(ul))) {
|
|
||||||
printf("ok\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
printf("Alloc %d: Error!\nPress any key to exit.\n", div+1);
|
case 0:
|
||||||
waitForAnyKey();
|
svcSleepThread(10000000ULL);
|
||||||
consoleExit(NULL);
|
break;
|
||||||
return 0;
|
case -1:
|
||||||
}
|
printf("Alloc %d/%d: Error detected!\nPress any key to exit.\n", j+1, testThreads+1);
|
||||||
consoleUpdate(NULL);
|
consoleUpdate(NULL);
|
||||||
for (i=0;;i++) {
|
|
||||||
if (!tests[i].name) break;
|
|
||||||
/* If using a custom testmask, only run this test if the
|
|
||||||
bit corresponding to this test was set by the user.
|
|
||||||
*/
|
|
||||||
if (testmask && (!((1 << i) & testmask))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
printf(" %-20s: ", tests[i].name);
|
|
||||||
if (!tests[i].fp(bufa, bufb, count)) {
|
|
||||||
printf("ok\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Alloc %d: Error!\nPress any key to exit.\n", div+1);
|
|
||||||
waitForAnyKey();
|
waitForAnyKey();
|
||||||
consoleExit(NULL);
|
consoleExit(NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
case 1:
|
||||||
consoleUpdate(NULL);
|
testWorkerReport[j] = 0;
|
||||||
/* clear buffer */
|
j++;
|
||||||
memset((void *) buf[div], 255, wantbytes[div]);
|
continue;
|
||||||
}
|
}
|
||||||
printf("\n");
|
}
|
||||||
|
printf("ok\n");
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
|
||||||
|
// tests[]
|
||||||
|
for (i = 0 ;; i++) {
|
||||||
|
if (!test_select[i].name)
|
||||||
|
break;
|
||||||
|
|
||||||
|
printf(" %-20s: ...", test_select[i].name);
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
for (int j = 0; j < testThreads; j++)
|
||||||
|
testJobId[j] = i;
|
||||||
|
|
||||||
|
double start_sec = gettime();
|
||||||
|
for (int j = 0; j < testThreads; )
|
||||||
|
{
|
||||||
|
switch (testWorkerReport[j])
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
svcSleepThread(10000000ULL);
|
||||||
|
continue;
|
||||||
|
case -1:
|
||||||
|
printf("Alloc %d/%d: Error detected!\nPress any key to exit.\n", j+1, testThreads+1);
|
||||||
|
consoleUpdate(NULL);
|
||||||
|
waitForAnyKey();
|
||||||
|
consoleExit(NULL);
|
||||||
|
return 0;
|
||||||
|
case 1:
|
||||||
|
testWorkerReport[j] = 0;
|
||||||
|
j++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double end_sec = gettime();
|
||||||
|
printf("\b\b\bok! finished in %.1fs\n", end_sec - start_sec);
|
||||||
consoleUpdate(NULL);
|
consoleUpdate(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
@@ -48,18 +49,17 @@ int compare_regions(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
size_t i;
|
size_t i;
|
||||||
ulv *p1 = bufa;
|
ulv *p1 = bufa;
|
||||||
ulv *p2 = bufb;
|
ulv *p2 = bufb;
|
||||||
off_t physaddr;
|
// off_t physaddr;
|
||||||
|
|
||||||
for (i = 0; i < count; i++, p1++, p2++) {
|
for (i = 0; i < count; i++, p1++, p2++) {
|
||||||
if (*p1 != *p2) {
|
if (*p1 != *p2) {
|
||||||
if (use_phys) {
|
// if (use_phys) {
|
||||||
physaddr = physaddrbase + (i * sizeof(ul));
|
// physaddr = physaddrbase + (i * sizeof(ul));
|
||||||
printf("FAILURE: 0x%08lx != 0x%08lx at physical address 0x%08lx.\n", (ul) *p1, (ul) *p2, physaddr);
|
// printf("FAILURE: 0x%08lx != 0x%08lx at physical address 0x%08lx.\n", (ul) *p1, (ul) *p2, physaddr);
|
||||||
} else {
|
// } else {
|
||||||
printf("FAILURE: 0x%08lx != 0x%08lx at offset 0x%08lx.\n", (ul) *p1, (ul) *p2, (ul) (i * sizeof(ul)));
|
// printf("FAILURE: 0x%08lx != 0x%08lx at offset 0x%08lx.\n", (ul) *p1, (ul) *p2, (ul) (i * sizeof(ul)));
|
||||||
}
|
// }
|
||||||
consoleUpdate(NULL);
|
/* // printf("Skipping to next test..."); */
|
||||||
/* printf("Skipping to next test..."); */
|
|
||||||
r = -1;
|
r = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,57 +70,97 @@ int test_stuck_address(ulv *bufa, size_t count) {
|
|||||||
ulv *p1 = bufa;
|
ulv *p1 = bufa;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
size_t i;
|
size_t i;
|
||||||
off_t physaddr;
|
// off_t physaddr;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (16 / dividend) ; j++) {
|
for (j = 0; j < (16 / dividend) ; j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1 = ((j + i) % 2) == 0 ? (ul) p1 : ~((ul) p1);
|
*p1 = ((j + i) % 2) == 0 ? (ul) p1 : ~((ul) p1);
|
||||||
*p1++;
|
*p1++;
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
for (i = 0; i < count; i++, p1++) {
|
for (i = 0; i < count; i++, p1++) {
|
||||||
if (*p1 != (((j + i) % 2) == 0 ? (ul) p1 : ~((ul) p1))) {
|
if (*p1 != (((j + i) % 2) == 0 ? (ul) p1 : ~((ul) p1))) {
|
||||||
if (use_phys) {
|
// if (use_phys) {
|
||||||
physaddr = physaddrbase + (i * sizeof(ul));
|
// physaddr = physaddrbase + (i * sizeof(ul));
|
||||||
printf("FAILURE: possible bad address line at physical address 0x%08lx.\n", physaddr);
|
// printf("FAILURE: possible bad address line at physical address 0x%08lx.\n", physaddr);
|
||||||
} else {
|
// } else {
|
||||||
printf("FAILURE: possible bad address line at offset 0x%08lx.\n", (ul) (i * sizeof(ul)));
|
// printf("FAILURE: possible bad address line at offset 0x%08lx.\n", (ul) (i * sizeof(ul)));
|
||||||
}
|
// }
|
||||||
printf("Skipping to next test...\n");
|
// printf("Skipping to next test...\n");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int test_stress_memcpy(ulv *bufa, ulv *bufb, size_t count) {
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
int q = rand_ul();
|
||||||
|
memset((void*)bufa, q, count*sizeof(ul));
|
||||||
|
memset((void*)bufb, q, count*sizeof(ul));
|
||||||
|
|
||||||
|
for (j = 0; j < 128; j++) {
|
||||||
|
memcpy((void*)bufa, (void*)bufb, count*sizeof(ul));
|
||||||
|
}
|
||||||
|
return memcmp((void*)bufa, (void*)bufb, count*sizeof(ul));
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_stress_memset(ulv *bufa, ulv *bufb, size_t count) {
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
for (j = 0; j < 128; j++) {
|
||||||
|
int q = rand_ul();
|
||||||
|
memset((void*)bufa, q, count*sizeof(ul));
|
||||||
|
memset((void*)bufb, q, count*sizeof(ul));
|
||||||
|
}
|
||||||
|
return memcmp((void*)bufa, (void*)bufb, count*sizeof(ul));
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_stress_memcmp(ulv *bufa, ulv *bufb, size_t count) {
|
||||||
|
ulv *p1 = bufa;
|
||||||
|
ulv *p2 = bufb;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
|
int q = rand_ul();
|
||||||
|
memset((void*)bufa, q, count*sizeof(ul));
|
||||||
|
memset((void*)bufb, q, count*sizeof(ul));
|
||||||
|
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
for (j = 0; j < 32; j++) {
|
||||||
|
// Trick compiler so that it won't skip memcmp
|
||||||
|
*p1++ = *p2++ = rand_ul();
|
||||||
|
rc = memcmp((void*)bufa, (void*)bufb, count*sizeof(ul));
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int test_random_value(ulv *bufa, ulv *bufb, size_t count) {
|
int test_random_value(ulv *bufa, ulv *bufb, size_t count) {
|
||||||
ulv *p1 = bufa;
|
ulv *p1 = bufa;
|
||||||
ulv *p2 = bufb;
|
ulv *p2 = bufb;
|
||||||
ul j = 0;
|
// ul j = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
putchar(' ');
|
// putchar(' ');
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1++ = *p2++ = rand_ul();
|
*p1++ = *p2++ = rand_ul();
|
||||||
if (!(i % PROGRESSOFTEN)) {
|
if (!(i % PROGRESSOFTEN)) {
|
||||||
putchar('\b');
|
// putchar('\b');
|
||||||
putchar(progress[++j % PROGRESSLEN]);
|
// putchar(progress[++j % PROGRESSLEN]);
|
||||||
consoleUpdate(NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b \b");
|
// printf("\b \b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return compare_regions(bufa, bufb, count);
|
return compare_regions(bufa, bufb, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,26 +264,23 @@ int test_solidbits_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
ul q;
|
ul q;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (64 / dividend / dividend); j++) {
|
for (j = 0; j < (64 / dividend / dividend); j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
q = (j % 2) == 0 ? UL_ONEBITS : 0;
|
q = (j % 2) == 0 ? UL_ONEBITS : 0;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,26 +291,23 @@ int test_checkerboard_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
ul q;
|
ul q;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (64 / dividend / dividend); j++) {
|
for (j = 0; j < (64 / dividend / dividend); j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
q = (j % 2) == 0 ? CHECKERBOARD1 : CHECKERBOARD2;
|
q = (j % 2) == 0 ? CHECKERBOARD1 : CHECKERBOARD2;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,25 +317,22 @@ int test_blockseq_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (64 / dividend / dividend) ; j++) {
|
for (j = 0; j < (64 / dividend / dividend) ; j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1++ = *p2++ = (ul) UL_BYTE(j);
|
*p1++ = *p2++ = (ul) UL_BYTE(j);
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,13 +342,12 @@ int test_walkbits0_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (j < UL_LEN) { /* Walk it up. */
|
if (j < UL_LEN) { /* Walk it up. */
|
||||||
*p1++ = *p2++ = ONE << j;
|
*p1++ = *p2++ = ONE << j;
|
||||||
@@ -325,14 +355,13 @@ int test_walkbits0_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
*p1++ = *p2++ = ONE << (UL_LEN * 2 - j - 1);
|
*p1++ = *p2++ = ONE << (UL_LEN * 2 - j - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,13 +371,12 @@ int test_walkbits1_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (j < UL_LEN) { /* Walk it up. */
|
if (j < UL_LEN) { /* Walk it up. */
|
||||||
*p1++ = *p2++ = UL_ONEBITS ^ (ONE << j);
|
*p1++ = *p2++ = UL_ONEBITS ^ (ONE << j);
|
||||||
@@ -356,14 +384,13 @@ int test_walkbits1_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
*p1++ = *p2++ = UL_ONEBITS ^ (ONE << (UL_LEN * 2 - j - 1));
|
*p1++ = *p2++ = UL_ONEBITS ^ (ONE << (UL_LEN * 2 - j - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,13 +400,12 @@ int test_bitspread_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
for (j = 0; j < (UL_LEN * 2 / dividend / dividend); j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
printf("setting %3u", j);
|
// printf("setting %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (j < UL_LEN) { /* Walk it up. */
|
if (j < UL_LEN) { /* Walk it up. */
|
||||||
*p1++ = *p2++ = (i % 2 == 0)
|
*p1++ = *p2++ = (i % 2 == 0)
|
||||||
@@ -393,14 +419,13 @@ int test_bitspread_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
| (ONE << (UL_LEN * 2 + 1 - j)));
|
| (ONE << (UL_LEN * 2 + 1 - j)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", j);
|
// printf("testing %3u", j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,28 +436,26 @@ int test_bitflip_comparison(ulv *bufa, ulv *bufb, size_t count) {
|
|||||||
ul q;
|
ul q;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf(" ");
|
// printf(" ");
|
||||||
for (k = 0; k < (UL_LEN / dividend / dividend); k++) {
|
for (k = 0; k < (UL_LEN / dividend / dividend); k++) {
|
||||||
q = ONE << k;
|
q = ONE << k;
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
q = ~q;
|
q = ~q;
|
||||||
printf("setting %3u", k * 8 + j);
|
// printf("setting %3u", k * 8 + j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
p1 = (ulv *) bufa;
|
p1 = (ulv *) bufa;
|
||||||
p2 = (ulv *) bufb;
|
p2 = (ulv *) bufb;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
*p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
printf("testing %3u", k * 8 + j);
|
// printf("testing %3u", k * 8 + j);
|
||||||
consoleUpdate(NULL);
|
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
// printf("\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +467,7 @@ int test_8bit_wide_random(ulv* bufa, ulv* bufb, size_t count) {
|
|||||||
unsigned int b, j = 0;
|
unsigned int b, j = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
putchar(' ');
|
// putchar(' ');
|
||||||
for (attempt = 0; attempt < 2; attempt++) {
|
for (attempt = 0; attempt < 2; attempt++) {
|
||||||
if (attempt & 1) {
|
if (attempt & 1) {
|
||||||
p1 = (u8v *) bufa;
|
p1 = (u8v *) bufa;
|
||||||
@@ -460,17 +483,15 @@ int test_8bit_wide_random(ulv* bufa, ulv* bufb, size_t count) {
|
|||||||
*p1++ = *t++;
|
*p1++ = *t++;
|
||||||
}
|
}
|
||||||
if (!(i % PROGRESSOFTEN)) {
|
if (!(i % PROGRESSOFTEN)) {
|
||||||
putchar('\b');
|
// putchar('\b');
|
||||||
putchar(progress[++j % PROGRESSLEN]);
|
// putchar(progress[++j % PROGRESSLEN]);
|
||||||
consoleUpdate(NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b \b");
|
// printf("\b \b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +502,7 @@ int test_16bit_wide_random(ulv* bufa, ulv* bufb, size_t count) {
|
|||||||
unsigned int b, j = 0;
|
unsigned int b, j = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
putchar( ' ' );
|
// putchar( ' ' );
|
||||||
for (attempt = 0; attempt < 2; attempt++) {
|
for (attempt = 0; attempt < 2; attempt++) {
|
||||||
if (attempt & 1) {
|
if (attempt & 1) {
|
||||||
p1 = (u16v *) bufa;
|
p1 = (u16v *) bufa;
|
||||||
@@ -497,17 +518,15 @@ int test_16bit_wide_random(ulv* bufa, ulv* bufb, size_t count) {
|
|||||||
*p1++ = *t++;
|
*p1++ = *t++;
|
||||||
}
|
}
|
||||||
if (!(i % PROGRESSOFTEN)) {
|
if (!(i % PROGRESSOFTEN)) {
|
||||||
putchar('\b');
|
// putchar('\b');
|
||||||
putchar(progress[++j % PROGRESSLEN]);
|
// putchar(progress[++j % PROGRESSLEN]);
|
||||||
consoleUpdate(NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compare_regions(bufa, bufb, count)) {
|
if (compare_regions(bufa, bufb, count)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\b \b");
|
// printf("\b \b");
|
||||||
consoleUpdate(NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,3 +37,6 @@ int test_8bit_wide_random(unsigned long volatile *bufa, unsigned long volatile *
|
|||||||
int test_16bit_wide_random(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count);
|
int test_16bit_wide_random(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int test_stress_memcpy(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count);
|
||||||
|
int test_stress_memset(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count);
|
||||||
|
int test_stress_memcmp(unsigned long volatile *bufa, unsigned long volatile *bufb, size_t count);
|
||||||
Reference in New Issue
Block a user