|
@@ -29,7 +29,38 @@ int
|
|
|
run_all() {
|
|
|
int ret = 0;
|
|
|
|
|
|
- if (getenv("B10TEST_CATCH_EXCEPTION") != NULL) {
|
|
|
+ // The catching of exceptions generated in tests is controlled by the
|
|
|
+ // B10TEST_CATCH_EXCEPTIONS environment variable. Setting this to
|
|
|
+ // 1 enables the cacthing of exceptions; setting it to 0 disables it.
|
|
|
+ // Anything else causes a message to be printed to stderr and the default
|
|
|
+ // taken. (The default is to catch exceptions if compiling with clang
|
|
|
+ // and false if not.)
|
|
|
+#ifdef __clang__
|
|
|
+ bool catch_exception = true;
|
|
|
+#else
|
|
|
+ bool catch_exception = false;
|
|
|
+#endif
|
|
|
+
|
|
|
+ const char* b10test_catch_exception = getenv("B10TEST_CATCH_EXCEPTION");
|
|
|
+ if (b10test_catch_exception != NULL) {
|
|
|
+ if (strcmp(b10test_catch_exception, "1") == 0) {
|
|
|
+ catch_exception = true;
|
|
|
+ } else if (strcmp(b10test_catch_exception, "0") == 0) {
|
|
|
+ catch_exception = false;
|
|
|
+ } else {
|
|
|
+ std::cerr << "***ERROR: B10TEST_CATCH_EXCEPTION is '"
|
|
|
+ << b10test_catch_exception
|
|
|
+ << "': allowed values are '1' or '0'.\n"
|
|
|
+ << " The default value of "
|
|
|
+ << (catch_exception ?
|
|
|
+ "1 (exception catching enabled)":
|
|
|
+ "0 (exception catching disabled)")
|
|
|
+ << " will be used.\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Actually run the code
|
|
|
+ if (catch_exception) {
|
|
|
try {
|
|
|
ret = RUN_ALL_TESTS();
|
|
|
} catch (const isc::Exception& ex) {
|