static void RunTests ( void ) { if (strcmp(TestType, "TestWaitingList") == 0) { testWaitingList(); } else if (strcmp(TestType, "TestRecursive") == 0) { testRecursive(); } else if (strcmp(TestType, "TestTraceableRecursive") == 0) { testTraceableRecursive(); } else if (strcmp(TestType, "1toN-1") == 0) { createAllMutexes(); queueFuncToAllThreads(DelMutex1toNMinus1PerThread); } else if (strcmp(TestType, "AllMutexes1stThread") == 0) { createAllMutexes(); queueFuncToAllThreads(DelAllMutexesFor1stThread); } else if (strcmp(TestType, "AllMutexesMidThread") == 0) { createAllMutexes(); queueFuncToAllThreads(DelAllMutexesForMidThread); } else if (strcmp(TestType, "1stThread") == 0) { createAllMutexes(); LE_INFO("Deleting the 1st thread"); le_thread_Cancel(ThreadRefArray[0]); } else if (strcmp(TestType, "MidThread") == 0) { createAllMutexes(); LE_INFO("Deleting the middle thread"); le_thread_Cancel(ThreadRefArray[ThreadNum / 2]); } else if (strcmp(TestType, "None") == 0) { createAllMutexes(); } else { // should never get here. PrintHelp(); } }
static void RunTests ( void ) { if (strcmp(TestType, "TestWaitingList") == 0) { testWaitingList(); } else if (strcmp(TestType, "1toN-1Threads") == 0) { createAllSemaphores(); int i = 0; while (i <= (ThreadNum - 2)) { LE_INFO("Cancelling the %dth thread", i); le_thread_Cancel(ThreadRefArray[i]); usleep(DelInv); i++; } } else if (strcmp(TestType, "Sem1toN-1Threads") == 0) { createAllSemaphores(); int i = 0; while (i <= (ThreadNum - 2)) { PostSemInThread(i); usleep(DelInv); i++; } } else if (strcmp(TestType, "Sem1stThread") == 0) { createAllSemaphores(); PostSemInThread(0); } else if (strcmp(TestType, "SemMidThread") == 0) { createAllSemaphores(); PostSemInThread(ThreadNum / 2); } else if (strcmp(TestType, "1stThread") == 0) { createAllSemaphores(); LE_INFO("Cancelling the 1st thread"); le_thread_Cancel(ThreadRefArray[0]); } else if (strcmp(TestType, "MidThread") == 0) { createAllSemaphores(); LE_INFO("Cancelling the middle thread"); le_thread_Cancel(ThreadRefArray[ThreadNum / 2]); } else if (strcmp(TestType, "None") == 0) { createAllSemaphores(); } else { // should never get here. PrintHelp(); } }