summaryrefslogtreecommitdiff
path: root/src/utilities_unittest.cc
diff options
context:
space:
mode:
author <shinichiro.hamaji@gmail.com>2008-11-17 07:58:10 +0000
committer <shinichiro.hamaji@gmail.com>2008-11-17 07:58:10 +0000
commitf9b58c51984c76ec4e6f0305926075716fc8c079 (patch)
tree883edf232904b312906754160537d0a90e4cfcf1 /src/utilities_unittest.cc
parent62a67b25167a56a723e2e420cc80168905e5e2cb (diff)
downloadglog-f9b58c51984c76ec4e6f0305926075716fc8c079.tar.gz
glog-f9b58c51984c76ec4e6f0305926075716fc8c079.tar.bz2
glog-f9b58c51984c76ec4e6f0305926075716fc8c079.zip
Re-organize the way to produce stacktrace.
Since we introduced the API to set signal handler and print a stacktrace, we should avoid glibc's backtrace, which may call malloc. Basically, we choose the way to produce a stacktrace as same as perftools. Also, I removed GetStackFrames, which is not used and not implemented with glibc. git-svn-id: https://google-glog.googlecode.com/svn/trunk@16 eb4d4688-79bd-11dd-afb4-1d65580434c0
Diffstat (limited to 'src/utilities_unittest.cc')
-rw-r--r--src/utilities_unittest.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/utilities_unittest.cc b/src/utilities_unittest.cc
new file mode 100644
index 0000000..cde2baa
--- /dev/null
+++ b/src/utilities_unittest.cc
@@ -0,0 +1,21 @@
+// Copyright 2008 Google Inc. All Rights Reserved.
+// Author: hamaji@google.com (Shinichiro Hamaji)
+
+#include "utilities.h"
+#include "googletest.h"
+#include "glog/logging.h"
+
+using namespace GOOGLE_NAMESPACE;
+
+TEST(sync_val_compare_and_swap, utilities) {
+ bool now_entering = false;
+ EXPECT_FALSE(sync_val_compare_and_swap(&now_entering, false, true));
+ EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
+ EXPECT_TRUE(sync_val_compare_and_swap(&now_entering, false, true));
+}
+
+int main(int argc, char **argv) {
+ InitGoogleLogging(argv[0]);
+
+ CHECK_EQ(RUN_ALL_TESTS(), 0);
+}