From 51a4f5a7a72c8c5d7ac5f0389b08a58e4909b9a2 Mon Sep 17 00:00:00 2001 From: Jacek Galowicz Date: Mon, 17 Sep 2012 14:51:10 +0200 Subject: [PATCH] Added more apps to the test case application. --- apps/jacobi.c | 9 ++++++--- apps/netio.c | 2 +- apps/tests.c | 46 ++++++++++++++++++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/apps/jacobi.c b/apps/jacobi.c index c111c495..cbd7888d 100644 --- a/apps/jacobi.c +++ b/apps/jacobi.c @@ -28,7 +28,7 @@ #include "tests.h" -#ifdef START_KERNEL_JACOBI +#if defined(START_KERNEL_JACOBI) || defined(START_CHIEFTEST) #define MATRIX_SIZE 256 #define MAXVALUE 1337 @@ -353,14 +353,17 @@ int jacobi(void* argv) * check the result * X[i] have to be 1 */ + int err=0; for(i=0; i 0.01) + if (error > 0.01) { kprintf("Result is on position %d wrong (%d/10000 != 1.0, error %d/10000)\n", i, (int) (10000.0*X[i]), (int) (10000.0*error)); + err = 1; + } } kprintf("maximal error is %d/10000\n", (int) (10000.0*max)); @@ -368,7 +371,7 @@ int jacobi(void* argv) kprintf("number of iterations: %d\n", iterations); kprintf("Calculation time: %llu ms (%llu ticks)\n", (stop-start)/(1000ULL*get_cpu_frequency()), stop-start); - return 0; + return err; } #endif diff --git a/apps/netio.c b/apps/netio.c index 8f51589c..3d57cb32 100644 --- a/apps/netio.c +++ b/apps/netio.c @@ -48,7 +48,7 @@ /* See http://www.nwlab.net/art/netio/netio.html to get the netio tool */ -#if defined(START_NETIO) && defined(CONFIG_LWIP) +#if (defined(START_NETIO) || defined(START_CHIEFTEST)) && defined(CONFIG_LWIP) #ifdef CONFIG_ROCKCREEK #if USE_SOCKET_BYPASSING // for socket bypassing #include diff --git a/apps/tests.c b/apps/tests.c index 575fd670..e3874886 100644 --- a/apps/tests.c +++ b/apps/tests.c @@ -127,7 +127,7 @@ static int foo(void* arg) } #endif -#ifdef START_MAIL_PING +#if defined(START_MAIL_PING) || defined(START_CHIEFTEST) static int mail_ping(void* arg) { int i; @@ -151,7 +151,7 @@ static int mail_noise(void*arg) { } #endif -#ifdef START_SVM_TEST +#if defined(START_SVM_TEST) || defined(START_CHIEFTEST) /* N has to be multiple of UEs */ @@ -192,6 +192,8 @@ static int svm_test(void *arg) if (!my_ue) { // allocate and initialize SVM region A[0] = (int*) kmalloc(3*N*N*sizeof(int)); + if (!A[0]) + return 1; // Let the others hang in the barrier. People will notice that things went wrong. memset((void*) A[0], 0x00, 3*N*N*sizeof(int)); // initialize matrices @@ -222,7 +224,6 @@ static int svm_test(void *arg) } } - end = rdtsc(); kprintf("Calculation time (seq): %llu ms (%llu ticks)\n", (end-start)/(1000ULL*get_cpu_frequency()), end-start); @@ -241,6 +242,8 @@ static int svm_test(void *arg) kputs("Use Strong Release consistency!\n"); A[0] = (int*) svm_malloc(3*N*N*sizeof(int), svm_flags); + if (!A[0]) + return 1; #if 1 if (!my_ue) @@ -300,9 +303,8 @@ static int svm_test(void *arg) kputs("Check results...\n"); + uint32_t err = 0; // Be paranoid for a test case. return != 0 if calculation was not correct. if (!my_ue) { - uint32_t err = 0; - svm_invalidate(); for(i=0; (i 1) { + int i; + for (i=0; i < 6; i++) + // Need as many barriers for the other cores as they occur in the benchmark. + svm_barrier(SVM_TYPE); + return 0; + } + return svm_bench(NULL); +} #endif #if defined(START_JOIN_TEST) || defined(START_CHIEFTEST) @@ -534,7 +550,14 @@ struct testcase_t testcases[] = { USERSPACE_TC("/bin/tests", "Tests user space app"), USERSPACE_TC("/bin/hello", "Hello userspace app"), KERNELSPACE_TC(producer_consumer, "Producer consumer kernel space test"), - KERNELSPACE_TC(join_test, "Join kernel space test") + KERNELSPACE_TC(join_test, "Join kernel space test"), +#ifdef CONFIG_ROCKCREEK + KERNELSPACE_TC(svm_test, "SVM Test kernel space test"), + KERNELSPACE_TC(testcase_svm_bench, "SVM Bench kernel space test"), + KERNELSPACE_TC(mail_ping, "Mail Ping kernel space test"), +// KERNELSPACE_TC(jacobi, "Jacobi kernel space test"), + KERNELSPACE_TC(netio_init, "NetIO kernel space test") +#endif }; static int chiefmastertest(void) @@ -545,11 +568,14 @@ static int chiefmastertest(void) tid_t id, ret; struct testcase_t* current; - kprintf("Starting Chiefmaster test: %d test cases.\n", tests); + kprintf("Starting chief master test: %d test cases.\n", tests); for (i = 0; i < tests; i++) { current = &testcases[i]; +#ifdef CONFIG_ROCKCREEK + RCCE_barrier(&RCCE_COMM_WORLD); +#endif kprintf("Starting testcase: %s\n", current->testcase_name); if (current->kernelspace_ep == NULL && @@ -569,7 +595,7 @@ static int chiefmastertest(void) ret = wait(&result); } while(ret != current->tid); - kprintf("Testcase %s returned %d\n", current->testcase_name, result); + kprintf("Testcase %s returned %d %s\n", current->testcase_name, result, result ? ":(" : ":)"); current->retval = result; }