All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
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	[thread overview]
Message-ID: <1470382393-24209-1-git-send-email-sjitindarsingh@gmail.com> (raw)

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 <sjitindarsingh@gmail.com>
---
 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 = <group_name1> <group_name2> ...	# 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 = <group_name1> <group_name2> ...	# 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 = <group_name1> <group_name2> ...	# 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.
-- 
2.5.5


             reply	other threads:[~2016-08-05  7:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05  7:33 Suraj Jitindar Singh [this message]
2016-08-05  7:33 ` [kvm-unit-tests PATCH 2/4] lib/powerpc: Add generic decrementer exception handler Suraj Jitindar Singh
2016-08-05  8:23   ` Andrew Jones
2016-08-08  3:51     ` Suraj Jitindar Singh
2016-08-05  7:33 ` [kvm-unit-tests PATCH 3/4] lib/powerpc: Add function to start secondary threads Suraj Jitindar Singh
2016-08-05  8:54   ` Andrew Jones
2016-08-08  5:16     ` Suraj Jitindar Singh
2016-08-05  7:33 ` [kvm-unit-tests PATCH 4/4] powerpc/tm: Add a test for H_CEDE while tm suspended Suraj Jitindar Singh
2016-08-05  9:15   ` Andrew Jones
2016-08-08  5:24     ` Suraj Jitindar Singh
2016-08-05  8:18 ` [kvm-unit-tests PATCH 1/4] scripts/runtime: Add ability to mark test as don't run by default Andrew Jones
2016-08-08  3:47   ` Suraj Jitindar Singh
2016-08-12  9:25     ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470382393-24209-1-git-send-email-sjitindarsingh@gmail.com \
    --to=sjitindarsingh@gmail.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.