Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3176215pxk; Mon, 28 Sep 2020 10:08:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHf3TsrHlJg5n2JH/XLpKVKlcTNEi9ab9nKtgxSkHDnK9a9IgUZSX0SJq7KcdTBWtSqbdM X-Received: by 2002:a17:906:a1d4:: with SMTP id bx20mr2582386ejb.262.1601312931629; Mon, 28 Sep 2020 10:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601312931; cv=none; d=google.com; s=arc-20160816; b=DVhARSzyjAgfnrTTwixxGZMER0aYEw/25doJTGciOLOGvIWho1IatwSvTNVKqbHP6F EC4V0vGYxtft6IY13tmqSy+XoHMP3ppiXIq+jJgwXQDlvyHDldpfqIUBNhXR2g1vojDh 11qHEzQF+gSqy5n5VyiOnrVaEbjzIVkJ6MC5RzXQB+YuNuti3CGXhyZ4JGWN+wNNRVeK W2uZK+5MDZ0gn4FEuaWOHxrn/HyW+I5Of7Ua1lFAXqd4VF6IyCN+HOJjPn1XgHPDb+p4 x+N/2ekyv2cYFFp+kmoeHOS+1lwylKwHLjKslUFhfsXC4F0x+RjoLLJfsMna2HCEeiJC iJ6Q== 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=Q8/YdhaIdAo3kchrfIRQ8XEH/f7S63RDPlb5o4bfxy8=; b=sq+dzUWX1PuUAm2AtPriNkx9YEiOPTlTabz0MmlaMi6ApcsV7Fw/druweLqewBWcS3 GGZ5q6h1EBAFxRLUXbpLf9Pl901LU3FwV9wp1iimrx0lsFqilJx0VcqINvb97B/Jihva K3zbPlolmYi8Uy8w3YfUqMQWL2sbQVjBhGNq4tpQRj2+yeZqevvuEMCoZUANPdiNXmaL RQXwH137zGbU4FzjF6y9WfCz09iFm2o/lxzARPSQ4bxNOrE6p6gz79U7tvMmmQHFvwJH CWLexenPgsPzD3pzVA5lBDfdN9dzoM0DitWPI7IDeMPjj+CgKqVASo6IJRrhD5WaJvoH imlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mOEk03zb; 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 bf4si1108774edb.290.2020.09.28.10.08.10; Mon, 28 Sep 2020 10:08:51 -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=mOEk03zb; 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 S1726420AbgI1RIF (ORCPT + 99 others); Mon, 28 Sep 2020 13:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726348AbgI1RIF (ORCPT ); Mon, 28 Sep 2020 13:08:05 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0980C061755 for ; Mon, 28 Sep 2020 10:08:02 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id n25so1656400ljj.4 for ; Mon, 28 Sep 2020 10:08:02 -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=Q8/YdhaIdAo3kchrfIRQ8XEH/f7S63RDPlb5o4bfxy8=; b=mOEk03zbdKCwpMwknciu86S0IV0zq5k3EWEdjSMh8yOgleYbkcEoRDIl+ng8bjbTrV ZYjgPQ6pLwYzQlIcQOFseECKPsSEpo+Ea5hsSEjI78/2DcPjwdWNJWLHe6tR0XulxzL2 Sie7qmqQ3X/DTrIbP7C7MMTqNUM4jMRnfGBpU= 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=Q8/YdhaIdAo3kchrfIRQ8XEH/f7S63RDPlb5o4bfxy8=; b=Kts22OGmxi2Nkfl5MiTP100R+uCdIG+8y6FHjJakt4IKtpjM9rzH14ItYqPG3QTjWN gSDQqG9CEPV1yIbgqzpPZl3Z81GIKB/X8WBHQMJETAIHN4AllUjAW1GtE9WgMQVi4nWP azULKQrSFCzUuI8i/pmNplDGuU8FMETdj1T2EsqdH1r+A42t6I3jB0wyBFPdeLaW9Qht cr0F/oBvUAG6uY54XY29feIbfnKf1D2CO6kmmSOqOzXNRzV0MM1KERoQiERwoqMOTHW8 v8Bcx+RpT97MKf4weUp0DIrZjTUu8p8vUHtTF+HzhOJZSBfx9JvWODmHpZxIW86PXluP bvSQ== X-Gm-Message-State: AOAM532Ivk7YylTrKPnb527E6FcrfhTYtHoKaDkkueCdwzwMJUkxZJdQ yhA55RyUBTox5y+F08H/Bpv2KBap4CfnWJvTXceKaM5dQ/B89W9M X-Received: by 2002:a2e:9cd5:: with SMTP id g21mr741119ljj.27.1601312880829; Mon, 28 Sep 2020 10:08:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Miao-chen Chou Date: Mon, 28 Sep 2020 10:07:50 -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 Thu, Sep 24, 2020 at 2:18 PM Luiz Augusto von Dentz wrote: > > 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? > If you are referring to autotest, we are actively introducing new test cases for both existing D-Bus interfaces and the newly-added interfaces. In case of Adv monitor API, http://crrev.com/c/2384793 is currently under review, and we have a test plan which includes combination tests with suspend/resume, crashes, reconnection, foreground scanning and functionalities. > > > > Regards, > > > > Miao > > > > > > > > > > > > -- > > > Luiz Augusto von Dentz > > > > -- > Luiz Augusto von Dentz Regards, Miao