OSDN Git Service

Introduce stack_gatt_test
authorChris Manton <cmanton@google.com>
Fri, 7 May 2021 00:35:37 +0000 (17:35 -0700)
committerChris Manton <cmanton@google.com>
Sun, 9 May 2021 20:28:28 +0000 (13:28 -0700)
Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: I61ebf28260bdda015e8e826bd3fb9d91cef747ea

stack/Android.bp
stack/test/gatt/stack_gatt_test.cc [new file with mode: 0644]

index 1c70760..1df9515 100644 (file)
@@ -911,3 +911,74 @@ cc_test {
         },
     },
 }
+
+cc_test {
+    name: "net_test_stack_gatt",
+    test_suites: ["device-tests"],
+    host_supported: true,
+    defaults: ["fluoride_defaults"],
+    local_include_dirs: [
+        "include",
+        "test/common",
+    ],
+    include_dirs: [
+        "system/bt",
+        "system/bt/gd",
+        "system/bt/utils/include",
+    ],
+    generated_headers: [
+        "BluetoothGeneratedBundlerSchema_h_bfbs",
+        "BluetoothGeneratedDumpsysDataSchema_h",
+        "BluetoothGeneratedPackets_h",
+    ],
+    srcs: [
+        ":TestMockBta",
+        ":TestMockBtif",
+        ":TestMockHci",
+        ":TestMockLegacyHciCommands",
+        ":TestMockMainShim",
+        ":TestMockStackAcl",
+        ":TestMockStackCryptotoolbox",
+        ":TestMockStackSmp",
+        ":TestStackBtm",
+        ":TestStackL2cap",
+        ":TestStackSdp",
+        "eatt/eatt.cc",
+        "gatt/att_protocol.cc",
+        "gatt/connection_manager.cc",
+        "gatt/gatt_api.cc",
+        "gatt/gatt_attr.cc",
+        "gatt/gatt_auth.cc",
+        "gatt/gatt_cl.cc",
+        "gatt/gatt_db.cc",
+        "gatt/gatt_main.cc",
+        "gatt/gatt_sr.cc",
+        "gatt/gatt_sr_hash.cc",
+        "gatt/gatt_utils.cc",
+        "test/gatt/stack_gatt_test.cc",
+    ],
+    static_libs: [
+        "libbt-common",
+        "libbt-protos-lite",
+        "libbtdevice",
+        "libgmock",
+        "liblog",
+        "libosi",
+    ],
+    shared_libs: [
+        "libbinder_ndk",
+        "libcrypto",
+        "libflatbuffers-cpp",
+        "libprotobuf-cpp-lite",
+    ],
+    sanitize: {
+        address: true,
+        all_undefined: true,
+        cfi: true,
+        integer_overflow: true,
+        scs: true,
+        diag: {
+            undefined : true
+        },
+    },
+}
diff --git a/stack/test/gatt/stack_gatt_test.cc b/stack/test/gatt/stack_gatt_test.cc
new file mode 100644 (file)
index 0000000..7fca4cb
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <cstdint>
+#include <map>
+#include <string>
+
+#include "common/message_loop_thread.h"
+
+std::map<std::string, int> mock_function_count_map;
+
+void LogMsg(uint32_t trace_set_mask, const char* fmt_str, ...) {}
+
+bluetooth::common::MessageLoopThread* get_main_thread() { return nullptr; }
+
+class StackGattTest : public ::testing::Test {};
+
+TEST_F(StackGattTest, nop) {}