summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2017-05-09 08:05:55 (GMT)
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2017-05-09 08:14:15 (GMT)
commit0d78884a22802cffc96d3779e953e764cb4fdaa4 (patch)
treeb08419b05351bb61f340575818f513f2fa95ad43 /src
parent7314fa3f8682c9ebff6dc820bd40c490d9ec1bec (diff)
downloadglog-0d78884a22802cffc96d3779e953e764cb4fdaa4.zip
glog-0d78884a22802cffc96d3779e953e764cb4fdaa4.tar.gz
glog-0d78884a22802cffc96d3779e953e764cb4fdaa4.tar.bz2
Relax test for symbolize
Don't rely on an internal-linkage extern "C" function having an unmangled name. This isn't required by the ABI, and in fact is not valid for a conforming compiler(!). Instead, allow symbolization to produce either a mangled or an unmangled name here.
Diffstat (limited to 'src')
-rw-r--r--src/symbolize_unittest.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/symbolize_unittest.cc b/src/symbolize_unittest.cc
index 05cb8a1..26616e6 100644
--- a/src/symbolize_unittest.cc
+++ b/src/symbolize_unittest.cc
@@ -99,7 +99,13 @@ TEST(Symbolize, Symbolize) {
// Compilers should give us pointers to them.
EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func)));
- EXPECT_STREQ("static_func", TrySymbolize((void *)(&static_func)));
+
+ // The name of an internal linkage symbol is not specified; allow either a
+ // mangled or an unmangled name here.
+ const char *static_func_symbol = TrySymbolize((void *)(&static_func));
+ CHECK(NULL != static_func_symbol);
+ EXPECT_TRUE(strcmp("static_func", static_func_symbol) == 0 ||
+ strcmp("static_func()", static_func_symbol) == 0);
EXPECT_TRUE(NULL == TrySymbolize(NULL));
}
@@ -267,9 +273,13 @@ TEST(Symbolize, SymbolizeStackConsumption) {
EXPECT_GT(stack_consumed, 0);
EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
+ // The name of an internal linkage symbol is not specified; allow either a
+ // mangled or an unmangled name here.
symbol = SymbolizeStackConsumption((void *)(&static_func),
&stack_consumed);
- EXPECT_STREQ("static_func", symbol);
+ CHECK(NULL != symbol);
+ EXPECT_TRUE(strcmp("static_func", symbol) == 0 ||
+ strcmp("static_func()", symbol) == 0);
EXPECT_GT(stack_consumed, 0);
EXPECT_LT(stack_consumed, kStackConsumptionUpperLimit);
}