Merge "Create directories under /data/local/tests at boot"
diff --git a/adb/Android.bp b/adb/Android.bp
index 8addf95..5351b3f 100644
--- a/adb/Android.bp
+++ b/adb/Android.bp
@@ -270,6 +270,8 @@
     host_supported: true,
     compile_multilib: "both",
     min_sdk_version: "apex_inherit",
+    // This library doesn't use build::GetBuildNumber()
+    use_version_lib: false,
 
     srcs: [
         "sysdeps/env.cpp",
diff --git a/fastboot/Android.bp b/fastboot/Android.bp
index 6673543..81ebf43 100644
--- a/fastboot/Android.bp
+++ b/fastboot/Android.bp
@@ -251,7 +251,7 @@
         darwin: {
             srcs: ["usb_osx.cpp"],
         },
-        linux_glibc: {
+        linux: {
             srcs: ["usb_linux.cpp"],
         },
     },
diff --git a/fs_mgr/liblp/partition_opener.cpp b/fs_mgr/liblp/partition_opener.cpp
index 3d3dde6..4696ff1 100644
--- a/fs_mgr/liblp/partition_opener.cpp
+++ b/fs_mgr/liblp/partition_opener.cpp
@@ -38,6 +38,9 @@
 namespace {
 
 std::string GetPartitionAbsolutePath(const std::string& path) {
+#if !defined(__ANDROID__)
+    return path;
+#else
     if (android::base::StartsWith(path, "/")) {
         return path;
     }
@@ -56,6 +59,7 @@
         }
     }
     return by_name;
+#endif
 }
 
 bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device_info) {
diff --git a/fs_mgr/libsnapshot/Android.bp b/fs_mgr/libsnapshot/Android.bp
index 77d21b2..04d7e27 100644
--- a/fs_mgr/libsnapshot/Android.bp
+++ b/fs_mgr/libsnapshot/Android.bp
@@ -145,6 +145,7 @@
         "libsnapshot_cow_defaults",
     ],
     host_supported: true,
+    recovery_available: true,
     shared_libs: [
         "libbase",
         "libcrypto",
diff --git a/libunwindstack/tests/fuzz/UnwinderComponentCreator.cpp b/libunwindstack/tests/fuzz/UnwinderComponentCreator.cpp
index 0415ef6..9c5374a 100644
--- a/libunwindstack/tests/fuzz/UnwinderComponentCreator.cpp
+++ b/libunwindstack/tests/fuzz/UnwinderComponentCreator.cpp
@@ -127,6 +127,13 @@
   for (uint8_t i = 0; i < entry_count; i++) {
     uint64_t start = AlignToPage(data_provider->ConsumeIntegral<uint64_t>());
     uint64_t end = AlignToPage(data_provider->ConsumeIntegralInRange<uint64_t>(start, UINT64_MAX));
+    if (start == end) {
+      // It's impossible to see start == end in the real world, so
+      // make sure the map contains at least one page of data.
+      if (__builtin_add_overflow(end, 0x1000, &end)) {
+        continue;
+      }
+    }
     // Make sure not to add overlapping maps, that is not something that can
     // happen in the real world.
     auto entry = map_ends.upper_bound(start);
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index 0860000..735fd94 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -539,7 +539,6 @@
 static int get_groups(const char* cmd) {
     FILE* fp;
 
-    // NB: crash log only available in user space
     EXPECT_TRUE(NULL != (fp = popen(cmd, "r")));
 
     if (fp == NULL) {
@@ -551,17 +550,18 @@
     int count = 0;
 
     while (fgets(buffer, sizeof(buffer), fp)) {
-        int size, consumed, max, payload;
-        char size_mult[4], consumed_mult[4];
+        int size, consumed, readable, max, payload;
+        char size_mult[4], consumed_mult[4], readable_mult[4];
         long full_size, full_consumed;
 
         size = consumed = max = payload = 0;
         // NB: crash log can be very small, not hit a Kb of consumed space
         //     doubly lucky we are not including it.
-        EXPECT_EQ(6, sscanf(buffer,
-                            "%*s ring buffer is %d %3s (%d %3s consumed),"
+        EXPECT_EQ(8, sscanf(buffer,
+                            "%*s ring buffer is %d %3s (%d %3s consumed, %d %3s readable),"
                             " max entry is %d B, max payload is %d B",
-                            &size, size_mult, &consumed, consumed_mult, &max, &payload))
+                            &size, size_mult, &consumed, consumed_mult, &readable, readable_mult,
+                            &max, &payload))
                 << "Parse error on: " << buffer;
         full_size = size;
         switch (size_mult[0]) {
@@ -1224,13 +1224,14 @@
             break;
         }
 
-        int size, consumed, max, payload;
-        char size_mult[4], consumed_mult[4];
+        int size, consumed, readable, max, payload;
+        char size_mult[4], consumed_mult[4], readable_mult[4];
         size = consumed = max = payload = 0;
-        if (6 == sscanf(buffer,
-                        "events: ring buffer is %d %3s (%d %3s consumed),"
+        if (8 == sscanf(buffer,
+                        "events: ring buffer is %d %3s (%d %3s consumed, %d %3s readable),"
                         " max entry is %d B, max payload is %d B",
-                        &size, size_mult, &consumed, consumed_mult, &max, &payload)) {
+                        &size, size_mult, &consumed, consumed_mult, &readable, readable_mult, &max,
+                        &payload)) {
             long full_size = size, full_consumed = consumed;
 
             switch (size_mult[0]) {
@@ -1656,26 +1657,6 @@
     }
 }
 
-static bool reportedSecurity(const char* command) {
-    FILE* fp = popen(command, "r");
-    if (!fp) return true;
-
-    std::string ret;
-    bool val = android::base::ReadFdToString(fileno(fp), &ret);
-    pclose(fp);
-
-    if (!val) return true;
-    return std::string::npos != ret.find("'security'");
-}
-
-TEST(logcat, security) {
-    EXPECT_FALSE(reportedSecurity(logcat_executable " -b all -g 2>&1"));
-    EXPECT_TRUE(reportedSecurity(logcat_executable " -b security -g 2>&1"));
-    EXPECT_TRUE(reportedSecurity(logcat_executable " -b security -c 2>&1"));
-    EXPECT_TRUE(
-        reportedSecurity(logcat_executable " -b security -G 256K 2>&1"));
-}
-
 static size_t commandOutputSize(const char* command) {
     FILE* fp = popen(command, "r");
     if (!fp) return 0;
@@ -1707,7 +1688,7 @@
   ASSERT_TRUE(android::base::ReadFdToString(fileno(fp), &output));
   pclose(fp);
 
-  ASSERT_TRUE(android::base::StartsWith(output, "unknown buffer foo\n"));
+  EXPECT_NE(std::string::npos, output.find("Unknown buffer 'foo'"));
 }
 
 static void SniffUid(const std::string& line, uid_t& uid) {