Skip to content

Commit 32aff54

Browse files
committed
Use a memcmp for the expected symbol name.
I believe that g++ does not guarantee what a particular symbol name will be. Thus, in g++ 11.4.0 (what is in Ubuntu 22.04), the symbol name here ended with "#2", while in g++ 13.2.0 (what is in Ubuntu 24.04), the symbol name ends with "#1". Given that we can't guarantee this, just search for the first part of the name up to the number, which should be good enough for this test. Signed-off-by: Chris Lalancette <[email protected]>
1 parent 115034b commit 32aff54

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test_tracetools/test/test_utils.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ TEST(TestUtils, valid_symbol_lambda_capture) {
8484

8585
auto m = [&](int other_num) {return num + other_num;};
8686
symbol = tracetools::get_symbol(m);
87-
EXPECT_STREQ(
88-
symbol,
89-
"TestUtils_valid_symbol_lambda_capture_Test::TestBody()::{lambda(int)#2}") <<
90-
"invalid symbol";
87+
const std::string expected_symbol_name =
88+
"TestUtils_valid_symbol_lambda_capture_Test::TestBody()::{lambda(int)#";
89+
EXPECT_EQ(memcmp(symbol, expected_symbol_name.c_str(), expected_symbol_name.length()), 0);
9190
std::free(symbol);
9291
}
9392

0 commit comments

Comments
 (0)