Test android.system.Os instead of libcore.io.Libcore.os
libcore.libcore.io.OsTest was testing libcore.io.Libcore.os, which is the
implementation of android.system.Os. This CL moves all applicable parts
into libcore.android.system.OsTest and makes them test android.system.Os
instead, since that is the public API.
Notes:
- android.system.OsTest still covers both versions of sendfile()
(via enum SendFileImpl) like the old test did. In a future CL,
we could optionally drop coverage for the libcore.io version
since it's not part of any API surface.
- libcore.io.Os has a method accept(FileDescriptor, SocketAddress) but
android.system.Os has accept(FileDescriptor, InetSocketAddress).
OsTest calls accept() both with InetSocketAddress and
UnixSocketAddress compile-time types. This CL adds a @hide method
android.system.Os.accept(FileDescriptor, SocketAddress) and delegates
to it from the InetSocketAddress method; this way, the existing
tests can be reused for android.system.Os.
- Even though android/system/OsTest.java did not exist before this
CL, I've kept the existing file header from the existing OsTest.java
from which the contents of the file are derived.
- One test is known to be failing; this CL updates the expectations
file to the new name.
Fixes: 129523169
Test: atest CtsLibcoreTestCases:libcore.android.system.OsTest
Test: atest CtsLibcoreTestCases:libcore.libcore.io.OsTest
Test: Used meld to compare libcore/io/OsTest.java from before this CL
vs. android/system/OsTest.java after this CL to confirm that
the only differences are (a) Libcore.{os,rawOs}. -> Os.,
(b) removal of the logic that remained in libcore/io/OsTest.java
Change-Id: Ic6d7ef683a26ae8a7198a30638bfaa87012f3b11
4 files changed