From patchwork Fri Jul 10 16:44:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 6767061 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 F37B79F40A for ; Fri, 10 Jul 2015 16:45:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 214F1204D6 for ; Fri, 10 Jul 2015 16:45:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 149EA204FC for ; Fri, 10 Jul 2015 16:45:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbbGJQpV (ORCPT ); Fri, 10 Jul 2015 12:45:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41354 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbbGJQpL (ORCPT ); Fri, 10 Jul 2015 12:45:11 -0400 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 B82D82D1569 for ; Fri, 10 Jul 2015 16:45:11 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-117.brq.redhat.com [10.34.1.117]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6AGj54Q006120; Fri, 10 Jul 2015 12:45:10 -0400 From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, mtosatti@redhat.com, jen@redhat.com Subject: [kvm-unit-tests PATCH 3/9] run_tests.sh: add '-d' for dry-run Date: Fri, 10 Jul 2015 18:44:57 +0200 Message-Id: <1436546703-12258-4-git-send-email-drjones@redhat.com> In-Reply-To: <1436546703-12258-1-git-send-email-drjones@redhat.com> References: <1436546703-12258-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=-7.5 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 Add an option that allows us to just get the qemu command line for each test. Running ./run_tests.sh -d will result in each test saying it passed, and test.log will contain a list of each qemu command line that would have been executed, had it not been a dry-run. Signed-off-by: Andrew Jones --- arm/run | 12 +++++++----- run_tests.sh | 41 +++++++++++++++++++++++++---------------- x86/run | 11 +++++++---- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/arm/run b/arm/run index e50709dcd12f4..3eacf3b77d625 100755 --- a/arm/run +++ b/arm/run @@ -48,9 +48,11 @@ fi command="$qemu $M -cpu $processor $chr_testdev" command+=" -display none -serial stdio -kernel" - echo $command "$@" -$command "$@" -ret=$? -echo Return value from qemu: $ret -exit $ret + +if [ "$DRYRUN" != "yes" ]; then + $command "$@" + ret=$? + echo Return value from qemu: $ret + exit $ret +fi diff --git a/run_tests.sh b/run_tests.sh index 6f00aa495744c..4246f1b60a733 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -28,22 +28,24 @@ function run() return fi - if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then - echo "skip $1 ($arch only)" - return - fi - - # check a file for a particular value before running a test - # the check line can contain multiple files to check separated by a space - # but each check parameter needs to be of the form = - for check_param in ${check[@]}; do - path=${check_param%%=*} - value=${check_param#*=} - if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then - echo "skip $1 ($path not equal to $value)" + if [ "$DRYRUN" != "yes" ]; then + if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then + echo "skip $1 ($arch only)" return fi - done + + # Check a file for a particular value before running a test. The + # check line can contain multiple files to check, separated by a space, + # but each check parameter needs to be of the form = + for check_param in ${check[@]}; do + path=${check_param%%=*} + value=${check_param#*=} + if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then + echo "skip $1 ($path not equal to $value)" + return + fi + done + fi cmdline="./$TEST_DIR-run $kernel -smp $smp $opts" if [ $verbose != 0 ]; then @@ -108,11 +110,13 @@ function usage() { cat <test.log -while getopts "g:hv" opt; do +while getopts "g:hvd" opt; do case $opt in g) only_group=$OPTARG @@ -133,10 +137,15 @@ while getopts "g:hv" opt; do v) verbose=1 ;; + d) + echo "DRYRUN=yes" >> config.mak + ;; *) exit ;; esac done +source config.mak # reload, parsing options may have changed it run_all $config +sed -i '/^DRYRUN=.*/d' config.mak diff --git a/x86/run b/x86/run index d00e8fece4b6d..38b56e9a6b531 100755 --- a/x86/run +++ b/x86/run @@ -54,7 +54,10 @@ fi command="${qemu} -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev -kernel" echo ${command} "$@" -${command} "$@" -ret=$? -echo Return value from qemu: $ret -exit $ret + +if [ "$DRYRUN" != "yes" ]; then + ${command} "$@" + ret=$? + echo Return value from qemu: $ret + exit $ret +fi