Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: base/debug/stack_trace_unittest.cc

Issue 2673273002: Disable TruncatedTrace unit test in official builds. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <limits> 7 #include <limits>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // Expect to find this function as well. 116 // Expect to find this function as well.
117 // Note: This will fail if not linked with -rdynamic (aka -export_dynamic) 117 // Note: This will fail if not linked with -rdynamic (aka -export_dynamic)
118 EXPECT_TRUE(backtrace_message.find(__func__) != std::string::npos) 118 EXPECT_TRUE(backtrace_message.find(__func__) != std::string::npos)
119 << "Expected to find " << __func__ << " in backtrace:\n" 119 << "Expected to find " << __func__ << " in backtrace:\n"
120 << backtrace_message; 120 << backtrace_message;
121 121
122 #endif // define(OS_MACOSX) 122 #endif // define(OS_MACOSX)
123 } 123 }
124 124
125 #if !defined(OFFICIAL_BUILD)
126 // Disabled in Official builds, where Link-Time Optimization can result in two
127 // or fewer stack frames being available, causing the test to fail.
125 TEST_F(StackTraceTest, TruncatedTrace) { 128 TEST_F(StackTraceTest, TruncatedTrace) {
126 StackTrace trace; 129 StackTrace trace;
127 130
128 size_t count = 0; 131 size_t count = 0;
129 trace.Addresses(&count); 132 trace.Addresses(&count);
130 ASSERT_LT(2u, count); 133 ASSERT_LT(2u, count);
131 134
132 StackTrace truncated(2); 135 StackTrace truncated(2);
133 truncated.Addresses(&count); 136 truncated.Addresses(&count);
134 EXPECT_EQ(2u, count); 137 EXPECT_EQ(2u, count);
135 } 138 }
139 #endif // !defined(OFFICIAL_BUILD)
136 140
137 // The test is used for manual testing, e.g., to see the raw output. 141 // The test is used for manual testing, e.g., to see the raw output.
138 TEST_F(StackTraceTest, DebugOutputToStream) { 142 TEST_F(StackTraceTest, DebugOutputToStream) {
139 StackTrace trace; 143 StackTrace trace;
140 std::ostringstream os; 144 std::ostringstream os;
141 trace.OutputToStream(&os); 145 trace.OutputToStream(&os);
142 VLOG(1) << os.str(); 146 VLOG(1) << os.str();
143 } 147 }
144 148
145 // The test is used for manual testing, e.g., to see the raw output. 149 // The test is used for manual testing, e.g., to see the raw output.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 TEST_F(StackTraceTest, MAYBE_TraceStackFramePointers) { 300 TEST_F(StackTraceTest, MAYBE_TraceStackFramePointers) {
297 constexpr size_t kDepth = 5; 301 constexpr size_t kDepth = 5;
298 const void* frames[kDepth]; 302 const void* frames[kDepth];
299 ExpectStackFramePointers<kDepth>(frames, kDepth); 303 ExpectStackFramePointers<kDepth>(frames, kDepth);
300 } 304 }
301 305
302 #endif // HAVE_TRACE_STACK_FRAME_POINTERS 306 #endif // HAVE_TRACE_STACK_FRAME_POINTERS
303 307
304 } // namespace debug 308 } // namespace debug
305 } // namespace base 309 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698