Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp610071pxk; Thu, 24 Sep 2020 13:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB24q/0N8mwF9Yh5gv2BbvraK+p7/HFKbKKyQmUTaIg2h4MshMvT0b0B36kS+iavbNF3hj X-Received: by 2002:a05:6402:1503:: with SMTP id f3mr607156edw.307.1600980313658; Thu, 24 Sep 2020 13:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600980313; cv=none; d=google.com; s=arc-20160816; b=IEIDjWjyv5yv7Ja7gu1TYFVTMsI10p9PO7JQhnbZAx65/psPB48b8ELN7RNnuvRhK8 B3/SpPnaQ6Za2lg+ZrdX3Gu+0eSz4HEl3aWWQpAxrl7Dt63qq+37j+44J1EtmJbePk+y jnJq6ucfUHoxoFuylnLi/6E0Q2YQ4l6+46rG7SySJL5aUhPpS8AVqFxDZ7iST4MOYqGy UsniC5xylgDgNSL/jHeAjLcYqIdZshIUX0AKMUt2zBTIUY1tn1N0agUK1TZDi4kFrtjV 2/TosRasV988vZBLXewwD9rIYIXIMHwlogFHEVL8s/TSz3pa7afLsMEEsjZ6DXejJYI0 +fFQ== 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=tRUffZcz1ymJIu0yj0QfeyMywH5SuJucv80q+roHZUc=; b=C5zqz5oHBeqp7B5NKAQIkfiYPTPYkmuSGe9qqPAq6/S8uM7GXc4mZYgKtJq7lY2krY AF2OyJNaqH5bixSbZ7quVGFlz9wYFxC2G4pbftjpFwNBwURbxx2DqzJjEgT/Z81zJDbV OGRbnGEw3q9ieh8Ry5T2FCd3fCytjF8lGp2SuhPGukID+6Jf3YFKNUyTNBL71OGcTXEa f30faaOHW/IqqTrJVy7fBBsFfa9BRU4woOdHhZqULxylKSwvYiUue1Q65CBpReisccjV x3vM7bdjtIvMvMdj2ToTWixBXYVrRdAcf08QXRV751jOcRZ631uaQxkVs4ECWXXM3ByI OsMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I81ZMrzA; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si351148edt.105.2020.09.24.13.44.36; Thu, 24 Sep 2020 13:45:13 -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=@chromium.org header.s=google header.b=I81ZMrzA; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726183AbgIXUof (ORCPT + 99 others); Thu, 24 Sep 2020 16:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgIXUof (ORCPT ); Thu, 24 Sep 2020 16:44:35 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0475C0613CE for ; Thu, 24 Sep 2020 13:44:34 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id b12so329258lfp.9 for ; Thu, 24 Sep 2020 13:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tRUffZcz1ymJIu0yj0QfeyMywH5SuJucv80q+roHZUc=; b=I81ZMrzAOTM7pIH6QSEE5PisXquDQT+ffbuOqExjuH1XkVutiXGFohekp0dFAvVknQ LzaT1O59gXW8QxPQ3mIzofcud4pkkClpkuG4C7ORwzY/Nn9OHSZtCgJ1JbxCKxEtrS73 +L0bDJ4iGd4SJyyu4CxoGBF3I2QbZYGemlKPI= 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=tRUffZcz1ymJIu0yj0QfeyMywH5SuJucv80q+roHZUc=; b=rB4hidIry3+8DeycqzW6GUlw/d3gZfYBK4t9KIkKl28C6I9HJTZYVZ6ajfiiiB93zf Q+1gSZ5vpUGbiIs2RdnlyvZruk3N0K6F9ZZdH21keoVFQc4DfeMiRoK05EN0RMLnwES4 vPBYdpT0UHYSlEFjB70HdDRt9VgxBi8FERi/1nujWAo7KEUivzLOrBynZ/fnja6RS12b cvBDwWuGOiea2GlgCIsxPnt2+i/k1zn1KYgjXwno0xCXizm3ESp0qbq2DxqKQOGYrFKK 9AVRiYl9ES1qXVpnxBUsHNV80Dfg7OPzTevntKhlscv1rB0jZuvuQmnRxahm539zaquV hj9g== X-Gm-Message-State: AOAM530fy1yxyGXjKqIaqK6y+be140Bw//xu8XvtoS0TJpeE8nWbXnCX QlaVlDEqUgc8S8moHw6R/f0Iin1kcbEUgjb8udAI/A== X-Received: by 2002:a19:418b:: with SMTP id o133mr228431lfa.413.1600980273269; Thu, 24 Sep 2020 13:44:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Miao-chen Chou Date: Thu, 24 Sep 2020 13:44:22 -0700 Message-ID: Subject: Re: Modifying Makefile.am to facilitate test-adv-monitor and future unit tests. To: Luiz Augusto von Dentz 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 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. > > Regards, > > Miao > > > > -- > Luiz Augusto von Dentz