Commit graph

14 commits

Author SHA1 Message Date
Colin Cross
4c5595c968 Replace local MUSL define with global ANDROID_HOST_MUSL
Bug: 190084016
Test: m USE_HOST_MUSL=true bionic-unit-tests-glibc
Change-Id: I56b23576cb24912112d2ae56d8ecc2e3716982fe
2021-08-16 16:44:24 -07:00
Colin Cross
14d1507619 Fix some clang-format issues
Fix some formatting issues that clang-format wanted to fix in the next
CL.

Test: builds
Change-Id: I37ede84672a2ae7c262da00319d7dbc132d7f4d8
2021-08-16 16:37:33 -07:00
Colin Cross
7da20341e9 Build bionic unit tests for musl
Modify bionic unit tests that are built for glibc so that they also
build against musl.  They don't all pass though:

With glibc:
 2 SLOW TESTS
 4 TIMEOUT TESTS
313 FAILED TESTS
  YOU HAVE 2 DISABLED TESTS

With musl:
11 SLOW TESTS
11 TIMEOUT TESTS
363 FAILED TESTS
  YOU HAVE 2 DISABLED TESTS

Bug: 190084016
Test: m bionic-unit-tests-glibc with musl
Test: atest bionic-unit-tests-static
Test: atest --host bionic-unit-tests-glibc with glibc
Change-Id: I79b6eab04fed3cc4392450df5eef2579412edfe1
2021-08-12 11:13:11 -07:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Elliott Hughes
bb7d9fb5d4 Improve glibc compatibility of gethostby*_r functions.
And add more tests.

Bug: N/A (but I'm here because a recent test broke existing tests)
Test: ran tests
Change-Id: Ib78430f179b43484a49bb50ff447ea6870c1ee3a
2017-10-23 17:38:35 -07:00
Elliott Hughes
5033918092 Complete <netdb.h>.
Add all the missing <netdb.h> functions.

Also fix getservbyport to handle a null protocol correctly.

Also fix getservbyname/getservbyport to not interfere with getservent.

Also fix endservent to reset getservent iteration.

Also reduce unnecessary differences from upstream NetBSD sethostent.c.

The servent implementation is still horrific, and we should
probably support protoent too so that debugging tools can use
getprotobyname/getprotobynumber.

Bug: N/A
Test: ran tests
Change-Id: I639108c46df0a768af297cf3bbce857cb1bef9d9
2017-10-15 10:37:51 -07:00
Yabin Cui
a35cd8cdc2 Test that ip6-localhost exists in etc/hosts.
Addition change: make netdb_test pass on host.

Bug: 18791191
Change-Id: I7a9e29aa559ff6557288b47323d8a436379201a2
2015-01-13 17:30:51 -08:00
Elliott Hughes
c62a4b5a7a Fix freeaddrinfo(NULL).
Bug: https://code.google.com/p/android/issues/detail?id=13228
Change-Id: I5e3b126d90d750a93ac0b8872198e50ba047e603
2015-01-08 17:28:46 -08:00
Yabin Cui
58d33a51f3 Sync with upstream for gethnamaddr.c.
Bug: 18566967
Change-Id: I37e7410226b49eec67614e20b2c1d5e3e47817a5
2014-12-17 16:19:27 -08:00
Elliott Hughes
32fea147ea Add getaddrinfo(3) tests for NULL arguments.
According to https://github.com/ukanth/afwall/pull/213 some OEMs have
shipped a getaddrinfo(3) that crashes given NULL hostnames.

Change-Id: I9cea5fdd68546b7c64cf47e10e2b2b4d672b69d0
2014-11-16 12:14:04 -08:00
Derek Xue
ba811120ae Migrate system/extra getaddrinfo test, and fix a bug in getservbyname(3).
This change is to migrate the getaddrinfo tests defined in the old file
system/extras/tests/bionic/libc/common/test_getaddrinfo.c
to the new place bionic/tests/netdb_test.cpp.

The test here is more thorough, and catches a bug in getservbyname(3)
that was breaking getaddrinfo(3)'s ability to look up services by name
without a hint that would cause it to ask for a specific protocol.

Change-Id: Ief5ebd0869496d1bc6a97861dfefa04bdf24bab1
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-22 22:23:10 -07:00
Derek Xue
4912fc7d15 bionic/tests: migrate gethostbyname bionic test from system/extra to bionic/tests
this change migrate the gethostbyname test defined in the old file
system/extras/tests/bionic/libc/common/test_gethostbyname.c
to the new place bionic/tests/netdb_test.cpp

Change-Id: I342171090f681581fb54d68ea4a09adf61f52081
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
2014-10-22 14:30:01 -07:00
Elliott Hughes
d8213bb573 Update getnameinfo.c, remove dead code, and fix error reporting.
Also add a unit test for the salen size checking.

Bug: 1889275
Change-Id: I8ec4107df9e2e9a8571e8915525249c6e44b98ad
2013-02-13 13:11:11 -08:00
Elliott Hughes
d3b9d11369 Add a test that getaddrinfo works when hints are NULL.
Bug: 1827911
Change-Id: I9e1b774c44c10a8c5391bcf3baf1607f50eaf214
2013-02-13 08:22:07 -08:00