From patchwork Fri Aug 5 07:33:10 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: 9264851 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 E99026048B for ; Fri, 5 Aug 2016 07:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DED3B2842D for ; Fri, 5 Aug 2016 07:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D17032842F; Fri, 5 Aug 2016 07:33:33 +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 5DC472842D for ; Fri, 5 Aug 2016 07:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688AbcHEHda (ORCPT ); Fri, 5 Aug 2016 03:33:30 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34228 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751930AbcHEHda (ORCPT ); Fri, 5 Aug 2016 03:33:30 -0400 Received: by mail-pa0-f68.google.com with SMTP id hh10so18933688pac.1 for ; Fri, 05 Aug 2016 00:33:29 -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=GM9VRHFw5kUm+S/Zp1gQoh4pc5cfRiMKi8JKhylTuug=; b=ClfdUizZVYDwkbda1mlCYV4EQdiWcZsADht9Tk4CA2lLmhxPEH48LZyyIX5IgMmPym qqLD+yP275nCwZKiWOXId8GFNLy+rTbGphlXeMebkIb8viYYTBc2BwHjg42Yqouh0FXW ttqzVgnlCBohx/KZ0mfzSN0rnfFdNg9l/i1GSzL2qq9fGK2EVkFBTDHyLpRgv94PM/Ja gxEEox6/lz1fcK6n3WQ7vwd81V0gtuaQ+mQlgfKMit0zza9xYgkFmOw+z8qUcI2m4TIt OWzjHdz7IV5QhKjaG4L+rFIXqAZmtJ1nsMQIatdAgudiAjwkfSBKNFXdJo/fyx2+T+Hc VOpA== 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=GM9VRHFw5kUm+S/Zp1gQoh4pc5cfRiMKi8JKhylTuug=; b=bQVuD/4lD9Fq6EwwY3RO4cpoovPE6DE5dJhzOhdHfd0gNOl80mJMJahN84O8jRfo07 FDHUy9yaP9P5pjae8Xv095X+HilZbnskSYntMBQj7poNohAmCW3BFfi3QBr5yQfVGp6d yY0VrHRjGianK1bXJrJaHHB99UefS8XuSu/TMy/aEryKL1NOfl0oaGu6QMcXG2au1UYY TMOtY1KEt3ZM+ak62GzTkztt/Vpmd0VRSeoCeWCyEu8a2vwehsUwcsYAFjdtBr8FODRs w5bdzpCX7LdoXOredHQHYanMUYRyQF4oIaR0pXTLMfJHX5otmx/XMlGDgWRCJ3BTbfEC QneQ== X-Gm-Message-State: AEkoouvvML8+AdGpaBNfVxOBzS2HZuVWHybZSMiD9shIUdMOjIm5JCp/gLHCPK0Zj2s28A== X-Received: by 10.66.49.67 with SMTP id s3mr22125009pan.100.1470382409086; Fri, 05 Aug 2016 00:33:29 -0700 (PDT) Received: from dyn253.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id y2sm25383787pan.31.2016.08.05.00.33.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 00:33:28 -0700 (PDT) From: Suraj Jitindar Singh To: kvm@vger.kernel.org Cc: sjitindarsingh@gmail.com, drjones@redhat.com, pbonzini@redhat.com Subject: [kvm-unit-tests PATCH 1/4] scripts/runtime: Add ability to mark test as don't run by default Date: Fri, 5 Aug 2016 17:33:10 +1000 Message-Id: <1470382393-24209-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 be set as "nodefault" on order to indicate that it shouldn't be run be default. Modify runtime.bash such that if one of these tests is encountered a message will be printed to the user to indicate that the task was skipped and with instructions on how to run the test on it's own. This allows a user to confirm that they want to run a test which has been marked as not to be run by default for whatever reason by the creator. 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/runtime.bash | 10 ++++++++++ x86/unittests.cfg | 3 +++ 4 files changed, 19 insertions(+) I was going to have the long error message gated behind [ $verbose == "yes" ] but this means that when that test is run standalone it will skip without any obvious indication as to why. Thus IMO it's better to have the message printed regardless. 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/runtime.bash b/scripts/runtime.bash index 0503cf0..6bf28fb 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -52,6 +52,16 @@ function run() return fi + if grep -q "nodefault" <<<$groups && ! grep -qw "$only_group" <<<$groups; then + echo -e "`SKIP` $testname\n" \ + "Test $testname marked as not to be run by default,\n" \ + "please ensure that you actually want to run this test\n" \ + "To run this using run_tests.sh append \"-g $groups\"\n" \ + "To run this standalone set the only_group parameter\n" \ + "\"only_group=$groups tests/$testname\"" + 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.