From patchwork Fri Jan 22 14:58:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 8090921 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F9F79F96D for ; Fri, 22 Jan 2016 14:58:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 763B6202DD for ; Fri, 22 Jan 2016 14:58:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8ABAA2047C for ; Fri, 22 Jan 2016 14:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753713AbcAVO6u (ORCPT ); Fri, 22 Jan 2016 09:58:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59474 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753690AbcAVO6o (ORCPT ); Fri, 22 Jan 2016 09:58:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id E48C532D3D0 for ; Fri, 22 Jan 2016 14:58:44 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-158.brq.redhat.com [10.34.1.158]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MEwYui032063; Fri, 22 Jan 2016 09:58:43 -0500 From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com Subject: [kvm-unit-tests PATCH 6/6] runtime: make the MAX_SMP loop a function Date: Fri, 22 Jan 2016 15:58:29 +0100 Message-Id: <1453474709-10679-7-git-send-email-drjones@redhat.com> In-Reply-To: <1453474709-10679-1-git-send-email-drjones@redhat.com> References: <1453474709-10679-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can now source scripts/runtime.bash multiple times without always running the MAX_SMP loop. runtime.bash is now ready to be sourced by arch run scripts (when not running in standalone mode). Patches coming soon will add a couple of arch-neutral functions to the arch run scripts. Signed-off-by: Andrew Jones --- run_tests.sh | 2 ++ scripts/mkstandalone.sh | 1 + scripts/runtime.bash | 12 +++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 558b8e7431d8e..c0c5a72b1ceee 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -28,6 +28,8 @@ EOF RUNTIME_arch_run="./$TEST_DIR/run" source scripts/runtime.bash +probe_max_smp + while getopts "g:hv" opt; do case $opt in g) diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index b0f1e7c098afb..c31a5f10519a1 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -60,6 +60,7 @@ generate_test () cat scripts/runtime.bash + echo probe_max_smp echo "run ${args[@]}" } diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 63d1b9653007b..dd700f24cffa3 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -1,5 +1,9 @@ : "${RUNTIME_arch_run?}" +if [ -z "$MAX_SMP" ]; then + MAX_SMP=$(getconf _NPROCESSORS_CONF) +fi + qemu=${QEMU:-qemu-system-$ARCH} function run() @@ -57,7 +61,6 @@ function run() return $ret } -MAX_SMP=$(getconf _NPROCESSORS_CONF) # # Probe for MAX_SMP, in case it's less than the number of host cpus. # @@ -67,7 +70,10 @@ MAX_SMP=$(getconf _NPROCESSORS_CONF) # "arm/arm64: KVM: Remove 'config KVM_ARM_MAX_VCPUS'". So, at some # point when maintaining the while loop gets too tiresome, we can # just remove it... -while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \ +function probe_max_smp() +{ + while $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \ |& grep -qi 'exceeds max CPUs'; do ((--MAX_SMP)) -done + done +}