diff options
author | <hlsyounes@gmail.com> | 2011-12-29 12:36:09 +0000 |
---|---|---|
committer | <hlsyounes@gmail.com> | 2011-12-29 12:36:09 +0000 |
commit | d8944b174301b21073ad26b500009d8368505f45 (patch) | |
tree | 3cc5a7817c1a40a43f5abc3141cd6ad7d7605d1c /src | |
parent | 5a05c30365d2464b9abbb6b9675070bba8223126 (diff) | |
download | glog-d8944b174301b21073ad26b500009d8368505f45.tar.gz glog-d8944b174301b21073ad26b500009d8368505f45.tar.bz2 glog-d8944b174301b21073ad26b500009d8368505f45.zip |
Fix logging_striplog_test.sh in debug mode. Fixes issue 108.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@99 eb4d4688-79bd-11dd-afb4-1d65580434c0
Diffstat (limited to 'src')
-rwxr-xr-x | src/logging_striplog_test.sh | 13 | ||||
-rw-r--r-- | src/logging_striptest_main.cc | 5 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/logging_striplog_test.sh b/src/logging_striplog_test.sh index b9033b2..73492bd 100755 --- a/src/logging_striplog_test.sh +++ b/src/logging_striplog_test.sh @@ -60,9 +60,16 @@ die () { # Check that the string literals are appropriately stripped. This will # not be the case in debug mode. -check_eq "`get_strings logging_striptest0`" "COND ERROR FATAL INFO WARNING " -check_eq "`get_strings logging_striptest2`" "COND ERROR FATAL " -check_eq "`get_strings logging_striptest10`" "" +mode=`GLOG_check_mode=1 ./logging_striptest0 2> /dev/null` +if [ "$mode" = "opt" ]; +then + echo "In OPT mode" + check_eq "`get_strings logging_striptest0`" "COND ERROR FATAL INFO USAGE WARNING " + check_eq "`get_strings logging_striptest2`" "COND ERROR FATAL USAGE " + check_eq "`get_strings logging_striptest10`" "" +else + echo "In DBG mode; not checking strings" +fi # Check that LOG(FATAL) aborts even for large STRIP_LOG diff --git a/src/logging_striptest_main.cc b/src/logging_striptest_main.cc index 17a582f..2e5d3b1 100644 --- a/src/logging_striptest_main.cc +++ b/src/logging_striptest_main.cc @@ -39,6 +39,7 @@ #include "config.h" DECLARE_bool(logtostderr); +GLOG_DEFINE_bool(check_mode, false, "Prints 'opt' or 'dbg'"); using std::string; using namespace GOOGLE_NAMESPACE; @@ -58,6 +59,10 @@ std::ostream &operator<<(std::ostream &str, const A&) {return str;} int main(int argc, char* argv[]) { FLAGS_logtostderr = true; InitGoogleLogging(argv[0]); + if (FLAGS_check_mode) { + printf("%s\n", DEBUG_MODE ? "dbg" : "opt"); + return 0; + } LOG(INFO) << "TESTMESSAGE INFO"; LOG(WARNING) << 2 << "something" << "TESTMESSAGE WARNING" << 1 << 'c' << A() << std::endl; |