From patchwork Tue Aug 16 07:18:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 9282729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F0FC960574 for ; Tue, 16 Aug 2016 07:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAF7F28682 for ; Tue, 16 Aug 2016 07:18:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFBA92868A; Tue, 16 Aug 2016 07:18:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A822A28682 for ; Tue, 16 Aug 2016 07:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751269AbcHPHSl (ORCPT ); Tue, 16 Aug 2016 03:18:41 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35444 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750785AbcHPHSk (ORCPT ); Tue, 16 Aug 2016 03:18:40 -0400 Received: by mail-pf0-f195.google.com with SMTP id h186so5016703pfg.2; Tue, 16 Aug 2016 00:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=g2sgsN04CdW9VFwVADsE37JujGdX46ecGJTrl3796M4=; b=iQEVdD+azMrA5XPBUkJg/mkYiiel/CXQ9nnZ1a8wsmOg03Od5t/KltSgxsOYQ6Kpx/ 93KJ20BuUdXKluZXQ36c84MJMn70sLBUvh6OY7223+x/2Hr6cfNkwZdxIr7m9FAJ4nMf x1V+UveOCNJsssHMJfB04idJ4f6oiFpKw/jyP/q/oKwaAFWNUjcipp0QnaoPDBAUAaj4 uXcYsWjYGZ4+osGc5F8veJtc6KeNeQaPOHbG4Gt66OfSvufplJYe3iKbWwtasEN5nblZ oBppksq+WVxd6y4/eE3x9mX8YdY/GC7srcpKb1YWrDEbnzZKr8/vyYygAmJSWMRU5Vrj p5Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g2sgsN04CdW9VFwVADsE37JujGdX46ecGJTrl3796M4=; b=Efu01itk/zB5ugZaSJUnVtiZlFCNA9K9FP7fvJQxPYUTWxZCgn1DoktXqsXU1Hgc92 yXKpNx7cWqPsAQOVcomQSDXLnLm1XAe3US5ugviQlQz4zJrQ3mgYh4dzQrkfrsvZvIr1 YqqEb0ugM0zBdBi1RUF4G3zVZaLvYrpLfgOuaVZoWpIvPJmrkYWsaA6NWY3GUyk2KRz0 K2iszLyfjm3ksRbhShzKrZmJmUZ88riYUKAiaahN7jzsbhsFmiHzCofPgT5BdHJ7pvvW EqPVdDMUUFqNGuD8ZYY10yHxDwx9DiejGFCqSjQoy1CQRcSCoBu5nnbp2qvBpI+B/X3A U97w== X-Gm-Message-State: AEkoousW6wI+zhKJRCfJHnn0pUE9TFlpBIi+HLfmpTXQ2fXOl7OMPUANbRh9kpzSTklGTw== X-Received: by 10.98.34.151 with SMTP id p23mr92142pfj.102.1471331919459; Tue, 16 Aug 2016 00:18:39 -0700 (PDT) Received: from dyn253.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id fj19sm36452252pab.37.2016.08.16.00.18.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 00:18:38 -0700 (PDT) From: Suraj Jitindar Singh To: kvm@vger.kernel.org Cc: sjitindarsingh@gmail.com, pbonzini@redhat.com, rkrcmar@redhat.com, kvm-ppc@vger.kernel.org, lvivier@redhat.com, thuth@redhat.com, drjones@redhat.com Subject: [kvm-unit-tests PATCH V3 1/5] scripts/runtime: Add ability to mark test as don't run by default Date: Tue, 16 Aug 2016 17:18:11 +1000 Message-Id: <1471331895-29887-1-git-send-email-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.5.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Invoking run_tests.sh without the -g parameter will by default run all of the tests for a given architecture. This patch series will add a test which has the ability to bring down the host and thus it might be nice if we double check that the user actually wants to run that test instead of them unknowingly bringing down a machine they might not want to. In order to do this add the option for a tests' group parameter in unittests.cfg to include "nodefault" on order to indicate that it shouldn't be run be default. When tests are invoked via run_tests.sh those with the nodefault group parameter will be skipped unless explicitly specified by the "-g" command line option. When tests with the nodefault group parameter are built and run standalone the user will be prompted on invocation to confirm that they actually want to run the test. This allows a developer to mark a test as having potentially adverse effects and thus requires an extra level of confirmation from the user before they are invoked. Existing functionality will be preserved and new tests can choose any group other than "nodefault" if they want to be run by default. Signed-off-by: Suraj Jitindar Singh --- Change Log: V2 -> V3: - Move checking on standalone invokation into a function "skip_nodefault" in scripts/runtime.bash Signed-off-by: Suraj Jitindar Singh --- arm/unittests.cfg | 3 +++ powerpc/unittests.cfg | 3 +++ scripts/mkstandalone.sh | 4 ++++ scripts/runtime.bash | 28 +++++++++++++++++++++++++++- x86/unittests.cfg | 3 +++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arm/unittests.cfg b/arm/unittests.cfg index ffd12e5..3f6fa45 100644 --- a/arm/unittests.cfg +++ b/arm/unittests.cfg @@ -12,6 +12,9 @@ # # specific to only one. # groups = ... # Used to identify test cases # # with run_tests -g ... +# # Specify group_name=nodefault +# # to have test not run by +# # default # accel = kvm|tcg # Optionally specify if test must run with # # kvm or tcg. If not specified, then kvm will # # be used when available. diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index ed4fdbe..0098cb6 100644 --- a/powerpc/unittests.cfg +++ b/powerpc/unittests.cfg @@ -12,6 +12,9 @@ # # specific to only one. # groups = ... # Used to identify test cases # # with run_tests -g ... +# # Specify group_name=nodefault +# # to have test not run by +# # default # accel = kvm|tcg # Optionally specify if test must run with # # kvm or tcg. If not specified, then kvm will # # be used when available. diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index d2bae19..b921416 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -74,6 +74,10 @@ generate_test () cat scripts/runtime.bash + if grep -qw "nodefault" <<<${args[1]}; then + echo "export STANDALONE=yes" + fi + echo "run ${args[@]}" } diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 0503cf0..383ebd4 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -32,6 +32,26 @@ get_cmdline() echo "TESTNAME=$testname TIMEOUT=$timeout ACCEL=$accel $RUNTIME_arch_run $kernel -smp $smp $opts" } +skip_nodefault() +{ + [ "$STANDALONE" != yes ] && return 0 + + while true; do + read -p "Test marked not to be run by default, are you sure (Y/N)? " yn + case $yn in + "Y" | "y" | "Yes" | "yes") + return 1 + ;; + "N" | "n" | "No" | "no" | "q" | "quit" | "exit") + exit + ;; + *) + echo Please select Y or N + ;; + esac + done +} + function run() { local testname="$1" @@ -48,10 +68,16 @@ function run() return fi - if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; then + if [ -n "$only_group" ] && ! grep -qw "$only_group" <<<$groups; then return fi + if [ -z "$only_group" ] && grep -qw "nodefault" <<<$groups && + skip_nodefault; then + echo -e "`SKIP` $testname (test marked as manual run only)" + return; + fi + if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then echo "`SKIP` $1 ($arch only)" return 2 diff --git a/x86/unittests.cfg b/x86/unittests.cfg index 60747cf..4a1f74e 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -12,6 +12,9 @@ # # specific to only one. # groups = ... # Used to identify test cases # # with run_tests -g ... +# # Specify group_name=nodefault +# # to have test not run by +# # default # accel = kvm|tcg # Optionally specify if test must run with # # kvm or tcg. If not specified, then kvm will # # be used when available.