adbd: improve coverage by compiling less code.

Test: ./coverage/gen_coverage.sh && ./coverage/report.sh
Change-Id: I26f823e2587435b7ec2c6ca05955adef5cfc23a0
This commit is contained in:
Josh Gao 2020-04-20 19:22:05 -07:00
parent f099105f07
commit 073c8d2394
3 changed files with 19 additions and 14 deletions

View File

@ -165,7 +165,6 @@ libadb_srcs = [
"adb_unique_fd.cpp",
"adb_utils.cpp",
"fdevent/fdevent.cpp",
"fdevent/fdevent_poll.cpp",
"services.cpp",
"sockets.cpp",
"socket_spec.cpp",
@ -176,6 +175,17 @@ libadb_srcs = [
"types.cpp",
]
libadb_darwin_srcs = [
"fdevent/fdevent_poll.cpp",
]
libadb_windows_srcs = [
"fdevent/fdevent_poll.cpp",
"sysdeps_win32.cpp",
"sysdeps/win32/errno.cpp",
"sysdeps/win32/stat.cpp",
]
libadb_posix_srcs = [
"sysdeps_unix.cpp",
"sysdeps/posix/network.cpp",
@ -219,7 +229,7 @@ cc_library_host_static {
srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
},
darwin: {
srcs: ["client/usb_osx.cpp"],
srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
},
not_windows: {
srcs: libadb_posix_srcs,
@ -228,10 +238,7 @@ cc_library_host_static {
enabled: true,
srcs: [
"client/usb_windows.cpp",
"sysdeps_win32.cpp",
"sysdeps/win32/errno.cpp",
"sysdeps/win32/stat.cpp",
],
] + libadb_windows_srcs,
shared_libs: ["AdbWinApi"],
},
},

View File

@ -89,18 +89,13 @@ void start_device_log(void) {
int adb_trace_mask;
std::string get_trace_setting_from_env() {
std::string get_trace_setting() {
#if ADB_HOST
const char* setting = getenv("ADB_TRACE");
if (setting == nullptr) {
setting = "";
}
return std::string(setting);
}
std::string get_trace_setting() {
#if ADB_HOST
return get_trace_setting_from_env();
return setting;
#else
return android::base::GetProperty("persist.adb.trace_mask", "");
#endif

View File

@ -27,7 +27,10 @@
#include "adb_utils.h"
#include "fdevent.h"
#include "fdevent_epoll.h"
#if !defined(__linux__)
#include "fdevent_poll.h"
#endif
using namespace std::chrono_literals;
using std::chrono::duration_cast;