From: Suraj Jitindar Singh <sjitindarsingh@gmail.com> 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 [thread overview] Message-ID: <1471331895-29887-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 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 <sjitindarsingh@gmail.com> --- Change Log: V2 -> V3: - Move checking on standalone invokation into a function "skip_nodefault" in scripts/runtime.bash Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> --- 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 = <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/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 = <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
WARNING: multiple messages have this Message-ID (diff)
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com> 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 07:18:11 +0000 [thread overview] Message-ID: <1471331895-29887-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 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 <sjitindarsingh@gmail.com> --- Change Log: V2 -> V3: - Move checking on standalone invokation into a function "skip_nodefault" in scripts/runtime.bash Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> --- 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 = <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/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 = <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
next reply other threads:[~2016-08-16 7:18 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-08-16 7:18 Suraj Jitindar Singh [this message] 2016-08-16 7:18 ` [kvm-unit-tests PATCH V3 1/5] scripts/runtime: Add ability to mark test as don't run by default Suraj Jitindar Singh 2016-08-16 7:18 ` [kvm-unit-tests PATCH V3 2/5] lib/powerpc: Add generic decrementer exception handler Suraj Jitindar Singh 2016-08-16 7:18 ` Suraj Jitindar Singh 2016-08-16 12:05 ` Andrew Jones 2016-08-16 12:05 ` Andrew Jones 2016-08-16 7:18 ` [kvm-unit-tests PATCH V3 3/5] lib/powerpc: Add function to start secondary threads Suraj Jitindar Singh 2016-08-16 7:18 ` Suraj Jitindar Singh 2016-08-16 12:27 ` Andrew Jones 2016-08-16 12:27 ` Andrew Jones 2016-08-17 4:18 ` Suraj Jitindar Singh 2016-08-17 4:18 ` Suraj Jitindar Singh 2016-08-16 7:18 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit tests Suraj Jitindar Singh 2016-08-16 7:18 ` Suraj Jitindar Singh 2016-08-16 12:41 ` Andrew Jones 2016-08-16 12:41 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit test Andrew Jones 2016-08-17 4:57 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit tests Suraj Jitindar Singh 2016-08-17 4:57 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit test Suraj Jitindar Singh 2016-08-16 12:54 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit tests Thomas Huth 2016-08-16 12:54 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit test Thomas Huth 2016-08-17 5:02 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit tests Suraj Jitindar Singh 2016-08-17 5:02 ` [kvm-unit-tests PATCH V3 4/5] lib/powerpc: Implement generic sleep function for use in unit test Suraj Jitindar Singh 2016-08-16 7:18 ` [kvm-unit-tests PATCH V3 5/5] powerpc/tm: Add a test for H_CEDE while tm suspended Suraj Jitindar Singh 2016-08-16 7:18 ` Suraj Jitindar Singh 2016-08-16 12:57 ` Andrew Jones 2016-08-16 12:57 ` Andrew Jones 2016-08-17 6:07 ` Suraj Jitindar Singh 2016-08-17 6:07 ` Suraj Jitindar Singh 2016-08-16 12:00 ` [kvm-unit-tests PATCH V3 1/5] scripts/runtime: Add ability to mark test as don't run by default Andrew Jones 2016-08-16 12:00 ` Andrew Jones 2016-08-16 16:03 ` Radim Krčmář 2016-08-16 16:03 ` Radim Krčmář 2016-08-17 3:35 ` Suraj Jitindar Singh 2016-08-17 3:35 ` Suraj Jitindar Singh 2016-08-17 3:14 ` Suraj Jitindar Singh 2016-08-17 3:14 ` Suraj Jitindar Singh
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=1471331895-29887-1-git-send-email-sjitindarsingh@gmail.com \ --to=sjitindarsingh@gmail.com \ --cc=drjones@redhat.com \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.org \ --cc=lvivier@redhat.com \ --cc=pbonzini@redhat.com \ --cc=rkrcmar@redhat.com \ --cc=thuth@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: linkBe 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.