aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-12-22 12:43:57 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-12-22 21:59:38 -0500
commitc5dacb88f0a6410b3270f77e3d1e1b159afc4adc (patch)
treedaa9ade65b8b15881459c1637257728a8a9441f6 /tools/testing/ktest
parentcad9666980c1c1a76345f36a68e96fda3d78d857 (diff)
ktest: Allow overriding bisect test results
When running the ktest git bisect test, if the BISECT_TYPE is "test", the bisect is determined to be good or bad based off of the error code of the test that is run. Currently, if the test returns 0, it is considered a pass (good), a non-zero is considered a fail (bad). But it has been requested to add more options, and also change the meanings of the error codes of the test. For example, one may want the test to detect if the commit is not good or bad, (maybe the bisect came to a point where the code in question does not exist). The test could report an error code that should tell ktest to skip the commit. Also, a test could detect that something is horribly wrong and the biscet should just be aborted. The new options: BISECT_RET_GOOD BISECT_RET_BAD BISECT_RET_SKIP BISECT_RET_ABORT BISECT_RET_DEFAULT have been added. The first 4 take an integer value that will represent if the test should be considered a pass, fail, neither good nor bad, or abort respectively. The BISECT_RET_DEFAULT will bo whatever is not defined by the above codes. If only BISECT_RET_DEFAULT is defined, then all tests will do the default. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest')
-rwxr-xr-xtools/testing/ktest/ktest.pl47
-rw-r--r--tools/testing/ktest/sample.conf36
2 files changed, 83 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 04a7bb573daa..47c28146dfc2 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -105,6 +105,11 @@ my $reverse_bisect;
105my $bisect_manual; 105my $bisect_manual;
106my $bisect_skip; 106my $bisect_skip;
107my $config_bisect_good; 107my $config_bisect_good;
108my $bisect_ret_good;
109my $bisect_ret_bad;
110my $bisect_ret_skip;
111my $bisect_ret_abort;
112my $bisect_ret_default;
108my $in_patchcheck = 0; 113my $in_patchcheck = 0;
109my $run_test; 114my $run_test;
110my $redirect; 115my $redirect;
@@ -1854,6 +1859,43 @@ sub do_run_test {
1854 waitpid $child_pid, 0; 1859 waitpid $child_pid, 0;
1855 $child_exit = $?; 1860 $child_exit = $?;
1856 1861
1862 if (!$bug && $in_bisect) {
1863 if (defined($bisect_ret_good)) {
1864 if ($child_exit == $bisect_ret_good) {
1865 return 1;
1866 }
1867 }
1868 if (defined($bisect_ret_skip)) {
1869 if ($child_exit == $bisect_ret_skip) {
1870 return -1;
1871 }
1872 }
1873 if (defined($bisect_ret_abort)) {
1874 if ($child_exit == $bisect_ret_abort) {
1875 fail "test abort" and return -2;
1876 }
1877 }
1878 if (defined($bisect_ret_bad)) {
1879 if ($child_exit == $bisect_ret_skip) {
1880 return 0;
1881 }
1882 }
1883 if (defined($bisect_ret_default)) {
1884 if ($bisect_ret_default eq "good") {
1885 return 1;
1886 } elsif ($bisect_ret_default eq "bad") {
1887 return 0;
1888 } elsif ($bisect_ret_default eq "skip") {
1889 return -1;
1890 } elsif ($bisect_ret_default eq "abort") {
1891 return -2;
1892 } else {
1893 fail "unknown default action: $bisect_ret_default"
1894 and return -2;
1895 }
1896 }
1897 }
1898
1857 if ($bug || $child_exit) { 1899 if ($bug || $child_exit) {
1858 return 0 if $in_bisect; 1900 return 0 if $in_bisect;
1859 fail "test failed" and return 0; 1901 fail "test failed" and return 0;
@@ -3284,6 +3326,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
3284 $bisect_manual = set_test_option("BISECT_MANUAL", $i); 3326 $bisect_manual = set_test_option("BISECT_MANUAL", $i);
3285 $bisect_skip = set_test_option("BISECT_SKIP", $i); 3327 $bisect_skip = set_test_option("BISECT_SKIP", $i);
3286 $config_bisect_good = set_test_option("CONFIG_BISECT_GOOD", $i); 3328 $config_bisect_good = set_test_option("CONFIG_BISECT_GOOD", $i);
3329 $bisect_ret_good = set_test_option("BISECT_RET_GOOD", $i);
3330 $bisect_ret_bad = set_test_option("BISECT_RET_BAD", $i);
3331 $bisect_ret_skip = set_test_option("BISECT_RET_SKIP", $i);
3332 $bisect_ret_abort = set_test_option("BISECT_RET_ABORT", $i);
3333 $bisect_ret_default = set_test_option("BISECT_RET_DEFAULT", $i);
3287 $store_failures = set_test_option("STORE_FAILURES", $i); 3334 $store_failures = set_test_option("STORE_FAILURES", $i);
3288 $store_successes = set_test_option("STORE_SUCCESSES", $i); 3335 $store_successes = set_test_option("STORE_SUCCESSES", $i);
3289 $test_name = set_test_option("TEST_NAME", $i); 3336 $test_name = set_test_option("TEST_NAME", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 42e0eb9442e3..2ff0f8c483e9 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -868,6 +868,42 @@
868# BISECT_BAD with BISECT_CHECK = good or 868# BISECT_BAD with BISECT_CHECK = good or
869# BISECT_CHECK = bad, respectively. 869# BISECT_CHECK = bad, respectively.
870# 870#
871# BISECT_RET_GOOD = 0 (optional, default undefined)
872#
873# In case the specificed test returns something other than just
874# 0 for good, and non-zero for bad, you can override 0 being
875# good by defining BISECT_RET_GOOD.
876#
877# BISECT_RET_BAD = 1 (optional, default undefined)
878#
879# In case the specificed test returns something other than just
880# 0 for good, and non-zero for bad, you can override non-zero being
881# bad by defining BISECT_RET_BAD.
882#
883# BISECT_RET_ABORT = 255 (optional, default undefined)
884#
885# If you need to abort the bisect if the test discovers something
886# that was wrong, you can define BISECT_RET_ABORT to be the error
887# code returned by the test in order to abort the bisect.
888#
889# BISECT_RET_SKIP = 2 (optional, default undefined)
890#
891# If the test detects that the current commit is neither good
892# nor bad, but something else happened (another bug detected)
893# you can specify BISECT_RET_SKIP to an error code that the
894# test returns when it should skip the current commit.
895#
896# BISECT_RET_DEFAULT = good (optional, default undefined)
897#
898# You can override the default of what to do when the above
899# options are not hit. This may be one of, "good", "bad",
900# "abort" or "skip" (without the quotes).
901#
902# Note, if you do not define any of the previous BISECT_RET_*
903# and define BISECT_RET_DEFAULT, all bisects results will do
904# what the BISECT_RET_DEFAULT has.
905#
906#
871# Example: 907# Example:
872# TEST_START 908# TEST_START
873# TEST_TYPE = bisect 909# TEST_TYPE = bisect