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 e7b5174..129a9a2 100644
--- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
@@ -282,7 +282,19 @@
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 @@
}
} catch(TException& e) {
+ std::cout << "ERROR: " << e.what() << std::endl;
}
std::cout << "\t\t\t" << (success ? "Success" : "Failure") << std::endl;