From patchwork Wed Aug 10 01:59:34 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: 9272507 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 89335601C2 for ; Wed, 10 Aug 2016 02:14:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 476892833F for ; Wed, 10 Aug 2016 02:14:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3542928407; Wed, 10 Aug 2016 02:14:07 +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 9B4DF2833F for ; Wed, 10 Aug 2016 02:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932669AbcHJCOD (ORCPT ); Tue, 9 Aug 2016 22:14:03 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33360 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932540AbcHJCOB (ORCPT ); Tue, 9 Aug 2016 22:14:01 -0400 Received: by mail-pa0-f67.google.com with SMTP id vy10so1897800pac.0; Tue, 09 Aug 2016 19:14:01 -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=99doR2xPAa3Mo6yflnmyvyaukkK/G0lDqF2avi1DamI=; b=0/lGd5sAtgPk8GzHXbagoDb+EKCbIha0B0q//C8OY9c8mzS+1A2m41XinaHf/Oka5b TjtmWRiScK5upbBA/qp/j114N5t9ml/xTNewy0iO+N9QMz+XnpmV537A1VzyqHDu+lft g3wH4KtWzdpNsiPg7NDul5FYvipVw5Wewuvp01fQKLrBXBAfADGUfoQ/VlhFVEYY7bTq tROA97ICEk2uXYHZlF6FUSEDfkDSqFxH/ITIZz6m+nBCWyS0TR2tesVBfpBrEkUwKsWX FWTbu0tN7Shjw71CdS9iKM2ZsxxjIy3tXa9uNgH7XGb7VSyrHdHr5eoU/PnfSbydO0O0 w3xw== 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=99doR2xPAa3Mo6yflnmyvyaukkK/G0lDqF2avi1DamI=; b=U86usRqx3iGlIvqVQhGmTa+q0noUchEpbGcM2eYIZosiImp4mLx33LRaTWN+/sj0Rp nmt+U3/i/ZXDvxh/ngiN31ycLKzOg4+EZyIA8/BHF+oPY2rPI9YnsXmI/YpmkeF0FCKn IaSdqBvNn82veHKkzWPAiPJKtNw0IjJ757SLB2yuQQ2G+LZGPfUgI4DlQNKYFcBGxzzq KYyJua29SNMk1yszyP121C5HuSu2OCj4Xvr08cLJ66z6ht0cF0Z8d2oHgHlFgjwUqX0r 75zNBZx/Yxs5mhbdFq6SspupdfBOEEmkhDSRcE51y9VcgYiDEt/RRWeytQpsMe1JUkGS yMyQ== X-Gm-Message-State: AEkoouv4p1j6qnaXsr4oXD5IWkEPsMHNSdQSR6UheapCe//peTyP+WmzZLATAWoIVz1wrQ== X-Received: by 10.66.17.138 with SMTP id o10mr2548044pad.112.1470794392578; Tue, 09 Aug 2016 18:59:52 -0700 (PDT) Received: from dyn253.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id n69sm58888633pfa.77.2016.08.09.18.59.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 18:59:51 -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 V2 1/4] scripts/runtime: Add ability to mark test as don't run by default Date: Wed, 10 Aug 2016 11:59:34 +1000 Message-Id: <1470794377-14427-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 --- arm/unittests.cfg | 3 +++ powerpc/unittests.cfg | 3 +++ scripts/mkstandalone.sh | 21 +++++++++++++++++++++ scripts/runtime.bash | 8 +++++++- x86/unittests.cfg | 3 +++ 5 files changed, 37 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..64e85c9 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -74,6 +74,27 @@ generate_test () cat scripts/runtime.bash + if grep -qw "nodefault" <<<${args[1]}; then + echo -e "while true; do\n"\ + "\tread -p \"Test marked as not to be run by default,"\ + "are you sure (Y/N)? \" response\n"\ + "\tcase \$response in\n"\ + "\t\t\"Y\" | \"y\" | \"Yes\" | \"yes\")\n"\ + "\t\t\tbreak\n"\ + "\t\t\t;;\n"\ + "\t\t\"N\" | \"n\" | \"No\" | \"no\")\n"\ + "\t\t\t;&\n"\ + "\t\t\"q\" | \"quit\" | \"exit\")\n"\ + "\t\t\texit\n"\ + "\t\t\t;;\n"\ + "\t\t*)\n"\ + "\t\t\techo Please select Y or N\n"\ + "\t\t\t;;\n"\ + "\tesac\n"\ + "done" + echo "standalone=\"true\"" + fi + echo "run ${args[@]}" } diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 0503cf0..a7a2250 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -48,10 +48,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 && + ([ -z $standalone ] || [ $standalone != "true" ]); 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.