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 895C7A0528 for ; Mon, 20 Jan 2020 13:25:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66E092C2B; Mon, 20 Jan 2020 13:25:29 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D8E4D11A4; Mon, 20 Jan 2020 13:25:25 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 04:25:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,342,1574150400"; d="scan'208";a="219638820" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by orsmga008.jf.intel.com with ESMTP; 20 Jan 2020 04:25:23 -0800 From: Bruce Richardson To: dev@dpdk.org, thomas@monjalon.net Cc: Bruce Richardson , aconole@redhat.com, stable@dpdk.org Date: Mon, 20 Jan 2020 12:22:18 +0000 Message-Id: <20200120122218.38703-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] app/test: fix dependency on file in /sys X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Meson versions 0.52 and 0.53 are being overly smart and detecting the path "/sys/devices/system/cpu/present" in the call to cat in app/test/meson.build and then adding it as a dependency to the build configuration. This causes issues on systems where the timestamp of that file always returns the current time, since it means that the build.ninja file is always out of date, and therefore needs to be rebuilt. We can fix this by just using a simple shell script to return the coremask appropriately for BSD and Linux, and removing that code logic from meson - thereby hiding the use of the /sys file. Fixes: c70622ac6f72 ("test: detect number of cores with meson") Cc: aconole@redhat.com Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- app/test/get-coremask.sh | 13 +++++++++++++ app/test/meson.build | 16 ++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100755 app/test/get-coremask.sh diff --git a/app/test/get-coremask.sh b/app/test/get-coremask.sh new file mode 100755 index 000000000..0bb61c858 --- /dev/null +++ b/app/test/get-coremask.sh @@ -0,0 +1,13 @@ +#! /bin/sh -e +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation + +if [ "$(uname)" = "Linux" ] ; then + cat /sys/devices/system/cpu/present +elif [ "$(uname)" = "FreeBSD" ] ; then + ncpus=$(/sbin/sysctl -n hw.ncpu) + echo 0-$(expr $ncpus - 1) +else +# fallback + echo 0-3 +fi diff --git a/app/test/meson.build b/app/test/meson.build index fb49d804b..22b0cefaa 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -398,20 +398,8 @@ dpdk_test = executable('dpdk-test', timeout_seconds = 600 timeout_seconds_fast = 10 -# Retrieve the number of CPU cores, defaulting to 4. -num_cores = '0-3' -if host_machine.system() == 'linux' - num_cores = run_command('cat', - '/sys/devices/system/cpu/present' - ).stdout().strip() -elif host_machine.system() == 'freebsd' - snum_cores = run_command('/sbin/sysctl', '-n', - 'hw.ncpu').stdout().strip() - inum_cores = snum_cores.to_int() - 1 - num_cores = '0-@0@'.format(inum_cores) -endif - -num_cores_arg = '-l ' + num_cores +get_coremask = find_program('get-coremask.sh') +num_cores_arg = '-l ' + run_command(get_coremask).stdout().strip() test_args = [num_cores_arg] foreach arg : fast_test_names -- 2.20.1