From: David Reiss Date: Thu, 4 Jun 2009 00:32:54 +0000 (+0000) Subject: THRIFT-466. cpp: Make the concurrency library test more thorough X-Git-Tag: 0.2.0~90 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=9fcacc8ff6e856bd55929763b5026181413806f1;p=common%2Fthrift.git THRIFT-466. cpp: Make the concurrency library test more thorough git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@781629 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/concurrency/test/ThreadManagerTests.h b/lib/cpp/src/concurrency/test/ThreadManagerTests.h index e7b51743..129a9a25 100644 --- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h +++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h @@ -282,7 +282,19 @@ public: try { threadManager->add(extraTask, 1); throw TException("Unexpected success adding task in excess of pending task count"); + } catch(TooManyPendingTasksException& e) { + throw TException("Should have timed out adding task in excess of pending task count"); } catch(TimedOutException& e) { + // Expected result + } + + try { + threadManager->add(extraTask, -1); + throw TException("Unexpected success adding task in excess of pending task count"); + } catch(TimedOutException& e) { + throw TException("Unexpected timeout adding task in excess of pending task count"); + } catch(TooManyPendingTasksException& e) { + // Expected result } std::cout << "\t\t\t" << "Pending tasks " << threadManager->pendingTaskCount() << std::endl; @@ -351,6 +363,7 @@ public: } } catch(TException& e) { + std::cout << "ERROR: " << e.what() << std::endl; } std::cout << "\t\t\t" << (success ? "Success" : "Failure") << std::endl;