BIND 10 trac542, updated. 6a9f0125c633e6203e5fda37e6220ea862038df6 [trac542] Set default for cacthing exceptions based on compiler
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon May 23 10:13:13 UTC 2011
The branch, trac542 has been updated
via 6a9f0125c633e6203e5fda37e6220ea862038df6 (commit)
from e66cc9c2e0eca69c62a3a61133fc4ba220274bc7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6a9f0125c633e6203e5fda37e6220ea862038df6
Author: Stephen Morris <stephen at isc.org>
Date: Mon May 23 11:11:48 2011 +0100
[trac542] Set default for cacthing exceptions based on compiler
The default is to catch exceptions if compiling using clang, and not
to catch them for everything else.
-----------------------------------------------------------------------
Summary of changes:
src/lib/util/unittests/run_all.cc | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/util/unittests/run_all.cc b/src/lib/util/unittests/run_all.cc
index 966de79..49861e4 100644
--- a/src/lib/util/unittests/run_all.cc
+++ b/src/lib/util/unittests/run_all.cc
@@ -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) {
More information about the bind10-changes
mailing list