Unverified Commit 86a3e712 authored by Dennis Jenkins's avatar Dennis Jenkins Committed by GitHub

Merge pull request #535 from FredericLeroy/bugfix/fixes-for-musl-libc

fix tests/listener_test for musl c library
parents f0f68361 abe5f0ee
...@@ -175,7 +175,16 @@ TEST(listener_test, listener_bind_port_not_free_throw_runtime) { ...@@ -175,7 +175,16 @@ TEST(listener_test, listener_bind_port_not_free_throw_runtime) {
FAIL() << "Expected std::runtime_error while binding, got nothing"; FAIL() << "Expected std::runtime_error while binding, got nothing";
} catch (std::runtime_error const & err) { } catch (std::runtime_error const & err) {
std::cout << err.what() << std::endl; std::cout << err.what() << std::endl;
ASSERT_STREQ("Address already in use", err.what()); int flag = 0 ;
// GNU libc
if ( strncmp(err.what(), "Address already in use", sizeof("Address already in use")) == 0 ) {
flag = 1;
}
// Musl libc
if ( strncmp(err.what(), "Address in use", sizeof("Address in use")) == 0 ) {
flag = 1;
}
ASSERT_EQ(flag, 1);
} catch ( ... ) { } catch ( ... ) {
FAIL() << "Expected std::runtime_error"; FAIL() << "Expected std::runtime_error";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment