From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E4D5A05A1; Fri, 10 Apr 2020 12:42:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 458101C2EB; Fri, 10 Apr 2020 12:42:27 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id D651D1C1CB for ; Fri, 10 Apr 2020 12:42:25 +0200 (CEST) IronPort-SDR: XGBkGI+q3/QOsSSCBA30mQSxSCfJv9kNH+ZbEbtegpFJcHkBUfBbOa+5VPxTRS8ufCkEGJGu1Q z5vFeG2ezNQA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 03:42:24 -0700 IronPort-SDR: uNAY7tQpcvfZnMQNuM+qP9MU8kCWsTyImRmNCN6oKtwXzs5HlYnXqoMt2iQShyQvZT351VCW+a QaINlVSa0nsw== X-IronPort-AV: E=Sophos;i="5.72,366,1580803200"; d="scan'208";a="425851132" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.50.46]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 10 Apr 2020 03:42:22 -0700 Date: Fri, 10 Apr 2020 11:42:19 +0100 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, Lukasz Wojciechowski , Aaron Conole , Ruifeng Wang , David Marchand , Gavin Hu Message-ID: <20200410104219.GE625@bricha3-MOBL.ger.corp.intel.com> References: <20200409180332.592074-1-thomas@monjalon.net> <20200410102951.1398001-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200410102951.1398001-1-thomas@monjalon.net> Subject: Re: [dpdk-dev] [PATCH v3] test: remove meson dependency on /proc file X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Apr 10, 2020 at 12:29:50PM +0200, Thomas Monjalon wrote: > Meson is detecting the path /proc/sys/vm/nr_hugepages in the call to cat > in app/test/meson.build and then adding it as a build dependency. > This causes build loop if the timestamp of this file keeps changing. > > It is fixed by hiding hugepage check in a shell script. > > Fixes: 77784ef0fba8 ("test: allow no-huge mode for fast-tests") > > Signed-off-by: Thomas Monjalon > Tested-by: Lukasz Wojciechowski > Reviewed-by: Lukasz Wojciechowski > Acked-by: Aaron Conole > Reviewed-by: Ruifeng Wang > --- > > v2: use variable as pointed by Lukasz > v3: avoid TOCTOU issue as suggested by David > I'm afraid it requires to re-confirm every reviews above. > > --- > MAINTAINERS | 1 + > app/test/has-hugepage.sh | 9 +++++++++ > app/test/meson.build | 8 ++------ > 3 files changed, 12 insertions(+), 6 deletions(-) > create mode 100755 app/test/has-hugepage.sh > > diff --git a/MAINTAINERS b/MAINTAINERS > index 4800f6884a..aa619b6762 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1471,6 +1471,7 @@ F: app/test/Makefile > F: app/test/autotest* > F: app/test/commands.c > F: app/test/get-coremask.sh > +F: app/test/has-hugepage.sh > F: app/test/packet_burst_generator.c > F: app/test/packet_burst_generator.h > F: app/test/process.h > diff --git a/app/test/has-hugepage.sh b/app/test/has-hugepage.sh > new file mode 100755 > index 0000000000..865e66cddd > --- /dev/null > +++ b/app/test/has-hugepage.sh > @@ -0,0 +1,9 @@ > +#! /bin/sh > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright 2020 Mellanox Technologies, Ltd > + > +if [ "$(uname)" = "Linux" ] ; then > + cat /proc/sys/vm/nr_hugepages || echo 0 > +else > + echo 0 > +fi > diff --git a/app/test/meson.build b/app/test/meson.build > index 351d29cb65..542408d614 100644 > --- a/app/test/meson.build > +++ b/app/test/meson.build > @@ -399,12 +399,8 @@ dpdk_test = executable('dpdk-test', > > has_hugepage = true > if is_linux Since you check for linux in the script, you can drop these two lines, and then just replace the whole branch with: has_hugepages = run_command('has-hugepage.sh').stdout().strip() != '0' > - check_hugepage = run_command('cat', > - '/proc/sys/vm/nr_hugepages') > - if (check_hugepage.returncode() != 0 or > - check_hugepage.stdout().strip() == '0') > - has_hugepage = false > - endif > + check_hugepage = find_program('has-hugepage.sh') > + has_hugepage = run_command(check_hugepage).stdout().strip() != '0' > endif > message('hugepage availability: @0@'.format(has_hugepage)) > > -- > 2.26.0 >