Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3602755pxk; Mon, 21 Sep 2020 19:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAsDQiY9SHebJxhqVqTVb5nfVOerPU8iTCKNncxS9mLk3GPfE+XK1KpSvHqVD6H3iXNmgM X-Received: by 2002:a17:906:4b4a:: with SMTP id j10mr2539638ejv.498.1600742129282; Mon, 21 Sep 2020 19:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600742129; cv=none; d=google.com; s=arc-20160816; b=EPK5s3MZHzx/rdi3YAYPol1L9uPinmrf0qV044JR/CUdIPYOBHwdvY5IyjE3NHiS6G HHcNRYDrr/zSVqtVwbPSrM/SXivHs2lzVJEzHNRmZiAr7QLfaFG38XQjfB3LHTplbfTK yj5LMN9Csbz6QK1naX+BeRhP2odc/NWiz9HYo0eD4TI+bhTFaUQ1c/rMOntqeMg9Je0z uhIhy1l6ztSbZjeXzC73amaAz+6Smk1Nhtv1OrJT5WUkG7vXfHL5TPt0QczFFf8M/iVN Kn64X4MFSY3lJGVdf3VSHvD6N1qLEOoUA3bZ29ffyVo2jvIap2EzCuSggox1bJXXvw9T g2VQ== 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=nnystwRGA77c1y/A1dFdil02soJNePvzvHddszLW6VU=; b=HpkL1Rv3qHbRebmCUrHvOc4aKptn71OI6naH1Oo1UGiLWUXId1hDkbZDIPXDcbXk19 MzF2SLDusrjBcI8JnVXfTa29q0dhfqzHXhaNOMsrs/cxoqOKIGZZj1NOS52qKPkdL+bR YGtboSmiLXR9nutSR8hpprM8AxHLKAQmgK1+FFvQNCim5vUzeWKohf12SG1iC8dmf0Us p+pveqktWVnyfpWXZRE6bwFYSQBSLv7FWCMxHTLCJSEbcHT6i5i+Z2uozqp/J4MEYRzQ C6xrbPn6X3yse2NO4XMpW1jbZo++HV+qzc5Bu/vIzQdWfdrQnuYnozG13pQC71RHjK4B VgRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qZfwSRRe; 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 d16si9396393ejc.620.2020.09.21.19.34.44; Mon, 21 Sep 2020 19:35:29 -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=qZfwSRRe; 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 S1728741AbgIVBoI (ORCPT + 99 others); Mon, 21 Sep 2020 21:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728497AbgIVBoI (ORCPT ); Mon, 21 Sep 2020 21:44:08 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8170C061755 for ; Mon, 21 Sep 2020 18:44:07 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id w16so19258283oia.2 for ; Mon, 21 Sep 2020 18:44:07 -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=nnystwRGA77c1y/A1dFdil02soJNePvzvHddszLW6VU=; b=qZfwSRReRvRujKpNbyaHCuMTuDJ0CNRzkDjPUUCYMpJWROixPiM1isCJg2VZqeJkkq cMZv2rPO02+QmRQWLos6dWj/y+UM5HaHLP8IWt2V+/TkC1UnSM9kfUUZDs+HGdY3CZs3 AAuAjgXALKT8GVlctFPF7pSYuZmougYQivuH/tAKfheA8Z/gMaOKvJzrmPN3BJ7f0FjK onTjZij6U3Q6M1ZB4p+/wcAVftAxDqnrTSxdiebCqAecGguDRoHFumyX7qKxePKxNFO3 6X1y0NKVlzkytJ9qulNFxGX2XCdgQgC9FkUjc8B+i9Ns6R7oLuQMYu8YP6Y7ZmdBgro7 LDBA== 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=nnystwRGA77c1y/A1dFdil02soJNePvzvHddszLW6VU=; b=iVETX2lP7aTH79OmCFZYbwiwnBZCX3iCdyWukvaAhaQRQ0VsAsv2rz9Zaz9aEEUNwA L7rhQrfSMlgP74VcPeQzon9f9uRzHGtGRu4btUPsDV0aJkJUPKUoWL2rXwdyVo5V4xZL w8QydNLkuYt/nfUHFa9Wskv5MEYZDOK8oa6JiBq2ZjR8UTkn2kf5SYc0tpNx4h48k1tk 0/XRCt4rvn6Q4yAgcQoCk/FHkMg3Jojg9TingvLXknUTllPmIo4UiG4JT3sauaD8H7kf Nh7FT2fo3zlahqx0I0SCdqM0kC8PrMDkCHmMtdxhqkk7ZEjl/3ColGbssX/NILcBfXgQ 8W4A== X-Gm-Message-State: AOAM532GJvHRKU2HI/k8XqTAAoCgcdHocLQjgxnSHzW2jDg76Fq6jTaL R85C8DybRsXRJ4J8PJwo5B9CXxPatn34/jx3Ai0= X-Received: by 2002:aca:3e08:: with SMTP id l8mr1242763oia.152.1600739046443; Mon, 21 Sep 2020 18:44:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Luiz Augusto von Dentz Date: Mon, 21 Sep 2020 18:43:53 -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 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. > Regards, > Miao -- Luiz Augusto von Dentz