platform_system_core/liblog/tests
Tom Cherry 9156c534e0 liblog: simplify logd 'command' functions and struct logger
There are a set of functions, such as android_logger_get_log_size()
and android_logger_get_prune_list() that talk to the logd command
socket to perform their activities.  There's a transport abstraction
layer that handles these symbols to optionally route them to other
transports, originally designed for pstore or local logger; however
these functions fundamentally only make sense for logd.

Ideally, these functions would be removed and new functions would be
added that do not depend on struct logger_list or struct logger and
more clearly indicate that they only work with logd.  For example:

android_logger_get_size(struct logger*) could be
logd_get_buffer_size(log_id_t log_id).  We would remove the need to
'open' the struct logger and make it clear that it only operates on
logd.

Since liblog is an llndk library however, we cannot change or remove
these symbols.  Since these symbols are not frequently used, it seems
acceptable to keep them as is and not introduce improved versions.
We, however, do want to simplify the code that handles them and this
change removes the transport abstraction layer that handles them.
They retain the behavior that unless the struct logger_list was opened
for logd, that the functions return -EINVAL.

The one exception to this is android_logger_clear().  If the struct
logger provided to this function was opened from a struct logger_list
that used pstore for its mode argument, this function will clear the
entire pstore log.  This function does not respect the 'logId'
parameter of the struct logger, since that would not be possible.

This change removes this android_logger_clear() behavior and makes it
strictly for logd, for symmetry with the rest of the functions and due
to the lack of clarity regarding the 'logId' parameter of its input.
The only caller of this function, logcat, will clear pstore directly.

struct logger was built to encapsulate the information needed to
connect to a logger device from the old kernel logger.  Now that we
only support reading from pstore and from logd, there is much less
information needed to be captured.  Specifically, we only need to know
the log_id and whether or not it was opened as part of a pstore or
logd 'list'.

Test: liblog-unit-test
Test: logcat -c/-g/-G/-p/-P/-S work
Test: logcat -c works with -L
Test: logcat -g/-G/-p/-P/-S continue to fail with -L
Change-Id: I2c549b6f8539de94510e223949ab209ecc40e2d0
2019-11-18 07:16:40 -08:00
..
Android.bp liblog: run in isolated mode, disable flaky tests 2019-10-04 13:05:50 -07:00
AndroidTest.xml Actually add right instant app boilerplate. 2019-01-29 17:12:35 -08:00
libc_test.cpp liblog: simplify socket_local_client() and always use CLOEXEC 2019-02-12 12:53:19 -08:00
liblog_benchmark.cpp liblog: simplify logd 'command' functions and struct logger 2019-11-18 07:16:40 -08:00
liblog_test.cpp Remove old logger_entry_v* formats 2019-10-24 10:53:14 -07:00
log_id_test.cpp Small liblog test fixes & readability improvements. 2017-08-25 14:53:21 +01:00
log_radio_test.cpp liblog: simplify socket_local_client() and always use CLOEXEC 2019-02-12 12:53:19 -08:00
log_read_test.cpp liblog: use RunLogTests() for more tests 2019-10-14 13:11:26 -07:00
log_system_test.cpp liblog: simplify socket_local_client() and always use CLOEXEC 2019-02-12 12:53:19 -08:00
log_time_test.cpp Use #pragma one for all liblog includes 2019-01-16 10:49:45 -08:00
log_wrap_test.cpp liblog: remove alarm in logd_reader.cpp 2019-10-08 13:05:55 -07:00
logprint_test.cpp liblog: display valid utf8 characters with 'printable' log format 2019-04-29 09:14:37 -07:00