Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp628787pxk; Thu, 24 Sep 2020 14:19:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLr5IkVMhIyuYFMxTGZJDd+Okx3bsIJgem7LHYa8/PbnNsaw3CPEnrSukcOfFpnopNmsvl X-Received: by 2002:a17:906:9346:: with SMTP id p6mr532202ejw.305.1600982344331; Thu, 24 Sep 2020 14:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600982344; cv=none; d=google.com; s=arc-20160816; b=gPE5uKB5y22wJN1CigfENdyiUzG5RZtAfORKMy+fEnl7EUtAQvYFMGBsGYa7ahjlJV +yrJPdXbili9v+jjSE6fQsr5AS15z/jkyERPRDAczB5S6QMYaZPU1KZp253ZPcPzFXoG HrZuNREXJg8zRD5BXXV3j6iudGnmjnQAF57K5wFxVj/TMKCxsiGAKHBiqCURlkVpd/BJ au+hUA6+GXJi3GkrflqkSGPYZQyAL6h1o2oDrYTmbJl2861kiyRhLlqH1Ir43P3mKk+B tTbX4YijK8Un4Lw59pT362RF3O4XJ5S0dADD/VrXuTWbZDmgF9DVbECmR6DRoK4jlGNO kb2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hTUkOp4UAXVn9OxQMUD8QbmtlPiYE5qc3hVmASK3+WI=; b=syvuDpqvQQdnYT+cRqXcKLFJTAHrJqCFwWemr631ttRVWn3iRdHCuC0RivI4VOGFaO NOpU7awzn63cSaBDylFBNbzICCUfVWGRgXAX516TszZktZqfSYcL4DaH8cpLbmEM1yXK CpsG18E6GYHT2MO8Nky0LPBZnfrTAe0f7GdRqEJwqx0FDB/ysjWHTQ+tjfPj2WWdCr1Y g5AAuChK+LXN5F13VJrBrGu7jIBsPZo7NdRxJ8NpZhZSDlS+goum9u03pJE2yb4yr1Qg 8KNRyDWeygX4Al09BTS7Or9lEi2FNwxIQ91lgZp3kFaoAoOiCKticKgyW82tckvMdV4B fypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H7XVRX3Y; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o14si495816ejc.648.2020.09.24.14.18.29; Thu, 24 Sep 2020 14:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H7XVRX3Y; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726280AbgIXVSZ (ORCPT + 99 others); Thu, 24 Sep 2020 17:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725208AbgIXVSZ (ORCPT ); Thu, 24 Sep 2020 17:18:25 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3597BC0613CE for ; Thu, 24 Sep 2020 14:18:25 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id 60so322997otw.3 for ; Thu, 24 Sep 2020 14:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hTUkOp4UAXVn9OxQMUD8QbmtlPiYE5qc3hVmASK3+WI=; b=H7XVRX3YNgMT+Qdtj12HxTcqIaJcEwbU6HeBeQgiu27gmVQDNU0TltQ5Kgiicx63XW uYC3zM0+qj7Ez73ZWybPWgbtIVpYUNpUasK5BpTmhehKgAVJIRWMkf7wAeXSrABhFBH2 a7ynywOnIL+SNNWSD81meHFYHBnFeBzs2QAJL7U7yEeg82hbF/nLEM1wsDxUetjRH/CR U8U4eZW4y0dSMZRIkkQ42yq+4YyA87l+uW4d8qb4ysI1obTGub1PvlMZp2VAds0VgLFM kZccPm0pOVCU17+xA4bBImr3fLpQNtyzRE3M4n3WZsNOqiw4pMUr0r4tLUGACs/J6rlO 0lsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hTUkOp4UAXVn9OxQMUD8QbmtlPiYE5qc3hVmASK3+WI=; b=FrNG5A/FDlCapijIX5sNKfAWFPi8TmIuVnd7Rx2PYOeWqTcovi2/dbvVgOg+fdIinP cybBwkjJ8SpRIMIw2fYF//w7XQOPp6Pps3mCnYPwTWPcFuyFK6PYU3uSHoXzMsXE1uAf rWBXTgyuPD481zd0gM0c8VfdUQ+v2zoxM1iFXI0qqh8LKhob9OFAwLRFQEsoRJ9wZe7k H2gRJ++UJIC2g+PI1hirD/3MpXHJMAB4Itq8v8gpY//KBa7OPOHvoBQWmZoWLcWo4WZP njBw4f7khfzw4cSQW8K3c0WfBcN1ZmEZXZ7pVnb1ty3PELq9+TDm4TNLWAAIZlCTXe5j cWVg== X-Gm-Message-State: AOAM530jBIC9dL5y7HIQ8CCy5KA3a6DPdC7RAM0xJ87Eq5VzPQUHtHtm U53Y0qeLTHZqIuW9CZAwtXbssoknB6S2QlFiXpY= X-Received: by 2002:a05:6830:22e6:: with SMTP id t6mr752631otc.88.1600982304365; Thu, 24 Sep 2020 14:18:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Thu, 24 Sep 2020 14:18:12 -0700 Message-ID: Subject: Re: Modifying Makefile.am to facilitate test-adv-monitor and future unit tests. To: Miao-chen Chou Cc: Bluetooth Kernel Mailing List , Marcel Holtmann , Luiz Augusto von Dentz , Alain Michaud , Manish Mandlik , Howard Chung , Abhishek Pandit-Subedi Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Miao, On Thu, Sep 24, 2020 at 1:44 PM Miao-chen Chou wrote: > > Hi Luiz, > > > On Mon, Sep 21, 2020 at 6:44 PM Luiz Augusto von Dentz > wrote: > > > > Hi Miao, > > > > On Mon, Sep 21, 2020 at 12:21 PM Miao-chen Chou wrote: > > > > > > Hi Luiz, > > > > > > On Fri, Sep 18, 2020 at 3:12 PM Luiz Augusto von Dentz > > > wrote: > > > > > > > > Hi Miao, > > > > > > > > On Fri, Sep 18, 2020 at 12:44 PM Miao-chen Chou wrote: > > > > > > > > > > Hi Luiz and Marcel, > > > > > > > > > > Unlike the rest of the existing unit tests in BlueZ, the logic blocks > > > > > tested in test-adv-monitor require dependencies of not only > > > > > src/adv_monitor.c but also all the dependency tree of > > > > > src/adv_monitor.c. The current convention in Makefile.am is to add all > > > > > the extra dependencies one by one. However, the maintenance cost is > > > > > high and not suitable in the case of test-adv-monitor. Therefore, we'd > > > > > like to propose changes in Makefile.am to make the source of > > > > > bluetoothd as a static library and link it for bluetoothd target and > > > > > the unit test target. It would be great if you can provide feedback on > > > > > this idea before the implementation. Thanks in advance! > > > > > > > > Then we should have had the code move to src/shared for unit testing, > > > > but how exactly are you planning to do that? For testing the kernel > > > > interface it normally done via a dedicated tester, but that again can > > > > be done with shared library. > > > > > > > In series https://patchwork.kernel.org/project/bluetooth/list/?series=351021, > > > we introduced some helper functions in adv_monitor.h to perform unit > > > testing and test-adv-monitor to facilitate the unit tests of > > > adv_monitor. We are encountering an expected build check failure on > > > this series. > > > > > > There are two categories in test-adv-monitor, content filtering and > > > RSSI tracking, and content filter is easy to be moved to a standalone > > > shared component while RSSI tracking involves the use of timer, D-Bus > > > method calls and adv_monitor's internal structures, and that makes it > > > strongly coupled with the adv_monitor implementation which require a > > > tree of dependencies apart from adv_monitor. > > > > > > There are two options to resolve the build failures in our case. > > > (1) Reorganize Makefile.am > > > This option is to make the sources (except src/main.c) into a static > > > lib and link this lib in bluetoothd executable target and whichever > > > unit test the sources are required. > > > (2) Create src/shared/am to facilitate helpers and core logic > > > This option is to create a new source under src/shared/ to facilitate > > > helper functions and core logic for src/adv_monitor. The interface of > > > src/shared/am may have the following functions. > > > - Create/destroy functions of struct adv_monitor > > > - Create/destroy functions of struct adv_monitor_device > > > - Helper function for monitor content matching. > > > - Helper function for RSSI tracking > > > However, the logic of RSSI tracking is hard to be ripped off and moved > > > to src/shared/am. One example would be the use of timer in RSSI > > > tracking, and there is currently no previous example of the timer use > > > in the shared library. > > > > Not really following regarding the dependency on D-Bus, usually shared > > don't have dependency on that because the code would be part of the > > deamon and in that case you would be better of testing that direct > > via a tester that does exercise its D-Bus API. Lets be clear here, > > except for gbus itself all our tests under unit directory are for C > > function testing, if you want to test a D-Bus interface then we need a > > tester that would do that over D-Bus. > > > > > Series https://patchwork.kernel.org/project/bluetooth/list/?series=351021 > > > is up for review. Our next step here would be ripped off the unit test > > > for now and submit v5 of the series. Once we reach an conclusion on > > > advmon unit test, we can submit a separate series including the > > > refactoring and unit tests. Looking forward to any feedbacks. Thanks! > > > > I'd strip the testing for now since it doesn't seem we are on sync to > > how we test things apparently. > > > Thanks for your reply. We need to rethink how to perform the testing. > And agree, we do plan to strip the testing for now from our series. Btw, I do recall seeing D-Bus level tests in chromium, have you guys stopped developing them? > > > Regards, > > > Miao > > > > > > > > -- > > Luiz Augusto von Dentz -- Luiz Augusto von Dentz