diff options
-rw-r--r-- | tools/testing/ktest/ktest.pl | 206 | ||||
-rw-r--r-- | tools/testing/ktest/sample.conf | 345 |
2 files changed, 433 insertions, 118 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index ef978171ecb7..a7e86e391172 100644 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -11,21 +11,23 @@ use File::Path qw(mkpath); | |||
11 | use File::Copy qw(cp); | 11 | use File::Copy qw(cp); |
12 | use FileHandle; | 12 | use FileHandle; |
13 | 13 | ||
14 | $#ARGV >= 0 || die "usage: autotest.pl config-file\n"; | 14 | $#ARGV >= 0 || die "usage: ktest.pl config-file\n"; |
15 | 15 | ||
16 | $| = 1; | 16 | $| = 1; |
17 | 17 | ||
18 | my %opt; | 18 | my %opt; |
19 | my %repeat_tests; | ||
20 | my %repeats; | ||
19 | my %default; | 21 | my %default; |
20 | 22 | ||
21 | #default opts | 23 | #default opts |
22 | $default{"NUM_TESTS"} = 5; | 24 | $default{"NUM_TESTS"} = 1; |
23 | $default{"REBOOT_TYPE"} = "grub"; | 25 | $default{"REBOOT_TYPE"} = "grub"; |
24 | $default{"TEST_TYPE"} = "test"; | 26 | $default{"TEST_TYPE"} = "test"; |
25 | $default{"BUILD_TYPE"} = "randconfig"; | 27 | $default{"BUILD_TYPE"} = "randconfig"; |
26 | $default{"MAKE_CMD"} = "make"; | 28 | $default{"MAKE_CMD"} = "make"; |
27 | $default{"TIMEOUT"} = 120; | 29 | $default{"TIMEOUT"} = 120; |
28 | $default{"TMP_DIR"} = "/tmp/autotest"; | 30 | $default{"TMP_DIR"} = "/tmp/ktest"; |
29 | $default{"SLEEP_TIME"} = 60; # sleep time between tests | 31 | $default{"SLEEP_TIME"} = 60; # sleep time between tests |
30 | $default{"BUILD_NOCLEAN"} = 0; | 32 | $default{"BUILD_NOCLEAN"} = 0; |
31 | $default{"REBOOT_ON_ERROR"} = 0; | 33 | $default{"REBOOT_ON_ERROR"} = 0; |
@@ -87,29 +89,138 @@ my $target_image; | |||
87 | my $localversion; | 89 | my $localversion; |
88 | my $iteration = 0; | 90 | my $iteration = 0; |
89 | 91 | ||
92 | sub set_value { | ||
93 | my ($lvalue, $rvalue) = @_; | ||
94 | |||
95 | if (defined($opt{$lvalue})) { | ||
96 | die "Error: Option $lvalue defined more than once!\n"; | ||
97 | } | ||
98 | $opt{$lvalue} = $rvalue; | ||
99 | } | ||
100 | |||
90 | sub read_config { | 101 | sub read_config { |
91 | my ($config) = @_; | 102 | my ($config) = @_; |
92 | 103 | ||
93 | open(IN, $config) || die "can't read file $config"; | 104 | open(IN, $config) || die "can't read file $config"; |
94 | 105 | ||
106 | my $name = $config; | ||
107 | $name =~ s,.*/(.*),$1,; | ||
108 | |||
109 | my $test_num = 0; | ||
110 | my $default = 1; | ||
111 | my $repeat = 1; | ||
112 | my $num_tests_set = 0; | ||
113 | my $skip = 0; | ||
114 | my $rest; | ||
115 | |||
95 | while (<IN>) { | 116 | while (<IN>) { |
96 | 117 | ||
97 | # ignore blank lines and comments | 118 | # ignore blank lines and comments |
98 | next if (/^\s*$/ || /\s*\#/); | 119 | next if (/^\s*$/ || /\s*\#/); |
99 | 120 | ||
100 | if (/^\s*(\S+)\s*=\s*(.*?)\s*$/) { | 121 | if (/^\s*TEST_START(.*)/) { |
122 | |||
123 | $rest = $1; | ||
124 | |||
125 | if ($num_tests_set) { | ||
126 | die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n"; | ||
127 | } | ||
128 | |||
129 | my $old_test_num = $test_num; | ||
130 | |||
131 | $test_num += $repeat; | ||
132 | $default = 0; | ||
133 | $repeat = 1; | ||
134 | |||
135 | if ($rest =~ /\s+SKIP(.*)/) { | ||
136 | $rest = $1; | ||
137 | $skip = 1; | ||
138 | } else { | ||
139 | $skip = 0; | ||
140 | } | ||
141 | |||
142 | if ($rest =~ /\s+ITERATE\s+(\d+)(.*)$/) { | ||
143 | $repeat = $1; | ||
144 | $rest = $2; | ||
145 | $repeat_tests{"$test_num"} = $repeat; | ||
146 | } | ||
147 | |||
148 | if ($rest =~ /\s+SKIP(.*)/) { | ||
149 | $rest = $1; | ||
150 | $skip = 1; | ||
151 | } | ||
152 | |||
153 | if ($rest !~ /^\s*$/) { | ||
154 | die "$name: $.: Gargbage found after TEST_START\n$_"; | ||
155 | } | ||
156 | |||
157 | if ($skip) { | ||
158 | $test_num = $old_test_num; | ||
159 | $repeat = 1; | ||
160 | } | ||
161 | |||
162 | } elsif (/^\s*DEFAULTS(.*)$/) { | ||
163 | $default = 1; | ||
164 | |||
165 | $rest = $1; | ||
166 | |||
167 | if ($rest =~ /\s+SKIP(.*)/) { | ||
168 | $rest = $1; | ||
169 | $skip = 1; | ||
170 | } else { | ||
171 | $skip = 0; | ||
172 | } | ||
173 | |||
174 | if ($rest !~ /^\s*$/) { | ||
175 | die "$name: $.: Gargbage found after DEFAULTS\n$_"; | ||
176 | } | ||
177 | |||
178 | } elsif (/^\s*([A-Z_\[\]\d]+)\s*=\s*(.*?)\s*$/) { | ||
179 | |||
180 | next if ($skip); | ||
181 | |||
101 | my $lvalue = $1; | 182 | my $lvalue = $1; |
102 | my $rvalue = $2; | 183 | my $rvalue = $2; |
103 | 184 | ||
104 | if (defined($opt{$lvalue})) { | 185 | if (!$default && |
105 | die "Error: Option $lvalue defined more than once!\n"; | 186 | ($lvalue eq "NUM_TESTS" || |
187 | $lvalue eq "LOG_FILE" || | ||
188 | $lvalue eq "CLEAR_LOG")) { | ||
189 | die "$name: $.: $lvalue must be set in DEFAULTS section\n"; | ||
190 | } | ||
191 | |||
192 | if ($lvalue eq "NUM_TESTS") { | ||
193 | if ($test_num) { | ||
194 | die "$name: $.: Can not specify both NUM_TESTS and TEST_START\n"; | ||
195 | } | ||
196 | if (!$default) { | ||
197 | die "$name: $.: NUM_TESTS must be set in default section\n"; | ||
198 | } | ||
199 | $num_tests_set = 1; | ||
200 | } | ||
201 | |||
202 | if ($default || $lvalue =~ /\[\d+\]$/) { | ||
203 | set_value($lvalue, $rvalue); | ||
204 | } else { | ||
205 | my $val = "$lvalue\[$test_num\]"; | ||
206 | set_value($val, $rvalue); | ||
207 | |||
208 | if ($repeat > 1) { | ||
209 | $repeats{$val} = $repeat; | ||
210 | } | ||
106 | } | 211 | } |
107 | $opt{$lvalue} = $rvalue; | 212 | } else { |
213 | die "$name: $.: Garbage found in config\n$_"; | ||
108 | } | 214 | } |
109 | } | 215 | } |
110 | 216 | ||
111 | close(IN); | 217 | close(IN); |
112 | 218 | ||
219 | if ($test_num) { | ||
220 | $test_num += $repeat - 1; | ||
221 | $opt{"NUM_TESTS"} = $test_num; | ||
222 | } | ||
223 | |||
113 | # set any defaults | 224 | # set any defaults |
114 | 225 | ||
115 | foreach my $default (keys %default) { | 226 | foreach my $default (keys %default) { |
@@ -398,6 +509,27 @@ sub reboot_to { | |||
398 | run_command "$reboot_script"; | 509 | run_command "$reboot_script"; |
399 | } | 510 | } |
400 | 511 | ||
512 | sub get_sha1 { | ||
513 | my ($commit) = @_; | ||
514 | |||
515 | doprint "git rev-list --max-count=1 $commit ... "; | ||
516 | my $sha1 = `git rev-list --max-count=1 $commit`; | ||
517 | my $ret = $?; | ||
518 | |||
519 | logit $sha1; | ||
520 | |||
521 | if ($ret) { | ||
522 | doprint "FAILED\n"; | ||
523 | dodie "Failed to get git $commit"; | ||
524 | } | ||
525 | |||
526 | print "SUCCESS\n"; | ||
527 | |||
528 | chomp $sha1; | ||
529 | |||
530 | return $sha1; | ||
531 | } | ||
532 | |||
401 | sub monitor { | 533 | sub monitor { |
402 | my $booted = 0; | 534 | my $booted = 0; |
403 | my $bug = 0; | 535 | my $bug = 0; |
@@ -497,7 +629,7 @@ sub install { | |||
497 | dodie "Failed to install modules"; | 629 | dodie "Failed to install modules"; |
498 | 630 | ||
499 | my $modlib = "/lib/modules/$version"; | 631 | my $modlib = "/lib/modules/$version"; |
500 | my $modtar = "autotest-mods.tar.bz2"; | 632 | my $modtar = "ktest-mods.tar.bz2"; |
501 | 633 | ||
502 | run_command "ssh $target rm -rf $modlib" or | 634 | run_command "ssh $target rm -rf $modlib" or |
503 | dodie "failed to remove old mods: $modlib"; | 635 | dodie "failed to remove old mods: $modlib"; |
@@ -840,6 +972,10 @@ sub bisect { | |||
840 | my $start = $opt{"BISECT_START[$i]"}; | 972 | my $start = $opt{"BISECT_START[$i]"}; |
841 | my $replay = $opt{"BISECT_REPLAY[$i]"}; | 973 | my $replay = $opt{"BISECT_REPLAY[$i]"}; |
842 | 974 | ||
975 | # convert to true sha1's | ||
976 | $good = get_sha1($good); | ||
977 | $bad = get_sha1($bad); | ||
978 | |||
843 | if (defined($opt{"BISECT_REVERSE[$i]"}) && | 979 | if (defined($opt{"BISECT_REVERSE[$i]"}) && |
844 | $opt{"BISECT_REVERSE[$i]"} == 1) { | 980 | $opt{"BISECT_REVERSE[$i]"} == 1) { |
845 | doprint "Performing a reverse bisect (bad is good, good is bad!)\n"; | 981 | doprint "Performing a reverse bisect (bad is good, good is bad!)\n"; |
@@ -859,20 +995,7 @@ sub bisect { | |||
859 | if (defined($check) && $check ne "0") { | 995 | if (defined($check) && $check ne "0") { |
860 | 996 | ||
861 | # get current HEAD | 997 | # get current HEAD |
862 | doprint "git rev-list HEAD --max-count=1 ... "; | 998 | my $head = get_sha1("HEAD"); |
863 | my $head = `git rev-list HEAD --max-count=1`; | ||
864 | my $ret = $?; | ||
865 | |||
866 | logit $head; | ||
867 | |||
868 | if ($ret) { | ||
869 | doprint "FAILED\n"; | ||
870 | dodie "Failed to get git HEAD"; | ||
871 | } | ||
872 | |||
873 | print "SUCCESS\n"; | ||
874 | |||
875 | chomp $head; | ||
876 | 999 | ||
877 | if ($check ne "good") { | 1000 | if ($check ne "good") { |
878 | doprint "TESTING BISECT BAD [$bad]\n"; | 1001 | doprint "TESTING BISECT BAD [$bad]\n"; |
@@ -956,6 +1079,10 @@ sub patchcheck { | |||
956 | $end = $opt{"PATCHCHECK_END[$i]"}; | 1079 | $end = $opt{"PATCHCHECK_END[$i]"}; |
957 | } | 1080 | } |
958 | 1081 | ||
1082 | # Get the true sha1's since we can use things like HEAD~3 | ||
1083 | $start = get_sha1($start); | ||
1084 | $end = get_sha1($end); | ||
1085 | |||
959 | my $type = $opt{"PATCHCHECK_TYPE[$i]"}; | 1086 | my $type = $opt{"PATCHCHECK_TYPE[$i]"}; |
960 | 1087 | ||
961 | # Can't have a test without having a test to run | 1088 | # Can't have a test without having a test to run |
@@ -1054,8 +1181,29 @@ if ($opt{"CLEAR_LOG"} && defined($opt{"LOG_FILE"})) { | |||
1054 | 1181 | ||
1055 | doprint "\n\nSTARTING AUTOMATED TESTS\n\n"; | 1182 | doprint "\n\nSTARTING AUTOMATED TESTS\n\n"; |
1056 | 1183 | ||
1057 | foreach my $option (sort keys %opt) { | 1184 | for (my $i = 0, my $repeat = 1; $i <= $opt{"NUM_TESTS"}; $i += $repeat) { |
1058 | doprint "$option = $opt{$option}\n"; | 1185 | |
1186 | if (!$i) { | ||
1187 | doprint "DEFAULT OPTIONS:\n"; | ||
1188 | } else { | ||
1189 | doprint "\nTEST $i OPTIONS"; | ||
1190 | if (defined($repeat_tests{$i})) { | ||
1191 | $repeat = $repeat_tests{$i}; | ||
1192 | doprint " ITERATE $repeat"; | ||
1193 | } | ||
1194 | doprint "\n"; | ||
1195 | } | ||
1196 | |||
1197 | foreach my $option (sort keys %opt) { | ||
1198 | |||
1199 | if ($option =~ /\[(\d+)\]$/) { | ||
1200 | next if ($i != $1); | ||
1201 | } else { | ||
1202 | next if ($i); | ||
1203 | } | ||
1204 | |||
1205 | doprint "$option = $opt{$option}\n"; | ||
1206 | } | ||
1059 | } | 1207 | } |
1060 | 1208 | ||
1061 | sub set_test_option { | 1209 | sub set_test_option { |
@@ -1067,6 +1215,16 @@ sub set_test_option { | |||
1067 | return $opt{$option}; | 1215 | return $opt{$option}; |
1068 | } | 1216 | } |
1069 | 1217 | ||
1218 | foreach my $test (keys %repeat_tests) { | ||
1219 | if ($i >= $test && | ||
1220 | $i < $test + $repeat_tests{$test}) { | ||
1221 | $option = "$name\[$test\]"; | ||
1222 | if (defined($opt{$option})) { | ||
1223 | return $opt{$option}; | ||
1224 | } | ||
1225 | } | ||
1226 | } | ||
1227 | |||
1070 | if (defined($opt{$name})) { | 1228 | if (defined($opt{$name})) { |
1071 | return $opt{$name}; | 1229 | return $opt{$name}; |
1072 | } | 1230 | } |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 546014a6bb03..9236fe977fa2 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -1,25 +1,83 @@ | |||
1 | # | 1 | # |
2 | # Config file for autotest.pl | 2 | # Config file for ktest.pl |
3 | # | 3 | # |
4 | # Note, all paths must be absolute | 4 | # Note, all paths must be absolute |
5 | # | 5 | # |
6 | 6 | ||
7 | # Almost all options may be overwritten per test run, by appending | 7 | # Options set in the beginning of the file are considered to be |
8 | # a [x] to the config. For example, to change the test type for | 8 | # default options. These options can be overriden by test specific |
9 | # the third iteration of tests, you can specify: | 9 | # options, with the following exceptions: |
10 | # (1 is for the first test, 2 for the second, and so on) | ||
11 | # | 10 | # |
12 | # TEST_TYPE[3] = build | ||
13 | # | ||
14 | # The options that can not be changed like this are: | ||
15 | # NUM_TESTS | ||
16 | # LOG_FILE | 11 | # LOG_FILE |
17 | # CLEAR_LOG | 12 | # CLEAR_LOG |
18 | # POWEROFF_ON_SUCCESS | 13 | # POWEROFF_ON_SUCCESS |
19 | # REBOOT_ON_SUCCESS | 14 | # REBOOT_ON_SUCCESS |
20 | # | 15 | # |
16 | # Test specific options are set after the label: | ||
17 | # | ||
18 | # TEST_START | ||
19 | # | ||
20 | # The options after a TEST_START label are specific to that test. | ||
21 | # Each TEST_START label will set up a new test. If you want to | ||
22 | # perform a test more than once, you can add the ITERATE label | ||
23 | # to it followed by the number of times you want that test | ||
24 | # to iterate. If the ITERATE is left off, the test will only | ||
25 | # be performed once. | ||
26 | # | ||
27 | # TEST_START ITERATE 10 | ||
28 | # | ||
29 | # You can skip a test by adding SKIP (before or after the ITERATE | ||
30 | # and number) | ||
31 | # | ||
32 | # TEST_START SKIP | ||
33 | # | ||
34 | # TEST_START SKIP ITERATE 10 | ||
35 | # | ||
36 | # TEST_START ITERATE 10 SKIP | ||
37 | # | ||
38 | # The SKIP label causes the options and the test itself to be ignored. | ||
39 | # This is useful to set up several different tests in one config file, and | ||
40 | # only enabling the ones you want to use for a current test run. | ||
41 | # | ||
42 | # You can add default options anywhere in the file as well | ||
43 | # with the DEFAULTS tag. This allows you to have default options | ||
44 | # after the test options to keep the test options at the top | ||
45 | # of the file. You can even place the DEFAULTS tag between | ||
46 | # test cases (but not in the middle of a single test case) | ||
47 | # | ||
48 | # TEST_START | ||
49 | # MIN_CONFIG = /home/test/config-test1 | ||
50 | # | ||
51 | # DEFAULTS | ||
52 | # MIN_CONFIG = /home/test/config-default | ||
53 | # | ||
54 | # TEST_START ITERATE 10 | ||
55 | # | ||
56 | # The above will run the first test with MIN_CONFIG set to | ||
57 | # /home/test/config-test-1. Then 10 tests will be executed | ||
58 | # with MIN_CONFIG with /home/test/config-default. | ||
59 | # | ||
60 | # You can also disable defaults with the SKIP option | ||
61 | # | ||
62 | # DEFAULTS SKIP | ||
63 | # MIN_CONFIG = /home/test/config-use-sometimes | ||
64 | # | ||
65 | # DEFAULTS | ||
66 | # MIN_CONFIG = /home/test/config-most-times | ||
67 | # | ||
68 | # The above will ignore the first MIN_CONFIG. If you want to | ||
69 | # use the first MIN_CONFIG, remove the SKIP from the first | ||
70 | # DEFAULTS tag and add it to the second. Be careful, options | ||
71 | # may only be declared once per test or default. If you have | ||
72 | # the same option name under the same test or as default | ||
73 | # ktest will fail to execute, and no tests will run. | ||
74 | # | ||
75 | |||
76 | |||
77 | #### Mandatory Default Options #### | ||
21 | 78 | ||
22 | #### Mandatory Config Options #### | 79 | # These options must be in the default section, although most |
80 | # may be overridden by test options. | ||
23 | 81 | ||
24 | # The machine hostname that you will test | 82 | # The machine hostname that you will test |
25 | #MACHINE = target | 83 | #MACHINE = target |
@@ -43,17 +101,21 @@ | |||
43 | #TARGET_IMAGE = /boot/vmlinuz-test | 101 | #TARGET_IMAGE = /boot/vmlinuz-test |
44 | 102 | ||
45 | # A script or command to reboot the box | 103 | # A script or command to reboot the box |
104 | # | ||
46 | # Here is a digital loggers power switch example | 105 | # Here is a digital loggers power switch example |
47 | #POWER_CYCLE = wget --no-proxy -O /dev/null -q --auth-no-challenge 'http://admin:admin@power/outlet?5=CCL' | 106 | #POWER_CYCLE = wget --no-proxy -O /dev/null -q --auth-no-challenge 'http://admin:admin@power/outlet?5=CCL' |
107 | # | ||
48 | # Here is an example to reboot a virtual box on the current host | 108 | # Here is an example to reboot a virtual box on the current host |
49 | # with the name "Guest". | 109 | # with the name "Guest". |
50 | #POWER_CYCLE = virsh list | grep '\<Guest\>' | awk '{printf ("%d", $1)}' | xargs virsh destroy; sleep 5; virsh start Guest | 110 | #POWER_CYCLE = virsh destroy Guest; sleep 5; virsh start Guest |
51 | 111 | ||
52 | # The script or command that reads the console | 112 | # The script or command that reads the console |
113 | # | ||
53 | # If you use ttywatch server, something like the following would work. | 114 | # If you use ttywatch server, something like the following would work. |
54 | #CONSOLE = nc -d localhost 3001 | 115 | #CONSOLE = nc -d localhost 3001 |
116 | # | ||
55 | # For a virtual machine with guest name "Guest". | 117 | # For a virtual machine with guest name "Guest". |
56 | #CONSOLE = virsh console `virsh list | grep '\<Guest\>' | awk '{printf ("%d", $1)}'` | 118 | #CONSOLE = virsh console Guest |
57 | 119 | ||
58 | # Required version ending to differentiate the test | 120 | # Required version ending to differentiate the test |
59 | # from other linux builds on the system. | 121 | # from other linux builds on the system. |
@@ -62,8 +124,14 @@ | |||
62 | # The grub title name for the test kernel to boot | 124 | # The grub title name for the test kernel to boot |
63 | # (Only mandatory if REBOOT_TYPE = grub) | 125 | # (Only mandatory if REBOOT_TYPE = grub) |
64 | # | 126 | # |
127 | # Note, ktest.pl will not update the grub menu.lst, you need to | ||
128 | # manually add an option for the test. ktest.pl will search | ||
129 | # the grub menu.lst for this option to find what kernel to | ||
130 | # reboot into. | ||
131 | # | ||
65 | # For example, if in the /boot/grub/menu.lst the test kernel title has: | 132 | # For example, if in the /boot/grub/menu.lst the test kernel title has: |
66 | # title Test Kernel | 133 | # title Test Kernel |
134 | # kernel vmlinuz-test | ||
67 | #GRUB_MENU = Test Kernel | 135 | #GRUB_MENU = Test Kernel |
68 | 136 | ||
69 | # A script to reboot the target into the test kernel | 137 | # A script to reboot the target into the test kernel |
@@ -72,21 +140,37 @@ | |||
72 | 140 | ||
73 | #### Optional Config Options (all have defaults) #### | 141 | #### Optional Config Options (all have defaults) #### |
74 | 142 | ||
75 | # The number of tests to run (default 5) | 143 | # Start a test setup. If you leave this off, all options |
76 | #NUM_TESTS = 5 | 144 | # will be default and the test will run once. |
145 | # This is a label and not really an option (it takes no value). | ||
146 | # You can append ITERATE and a number after it to iterate the | ||
147 | # test a number of times, or SKIP to ignore this test. | ||
148 | # | ||
149 | #TEST_START | ||
150 | #TEST_START ITERATE 5 | ||
151 | #TEST_START SKIP | ||
77 | 152 | ||
78 | # The default test type (default test) | 153 | # The default test type (default test) |
79 | # The test types may be: | 154 | # The test types may be: |
80 | # build - only build the kernel, do nothing else | 155 | # build - only build the kernel, do nothing else |
81 | # boot - build and boot the kernel | 156 | # boot - build and boot the kernel |
82 | # test - build, boot and if TEST is set, run the test script | 157 | # test - build, boot and if TEST is set, run the test script |
158 | # (If TEST is not set, it defaults back to boot) | ||
83 | # bisect - Perform a bisect on the kernel (see BISECT_TYPE below) | 159 | # bisect - Perform a bisect on the kernel (see BISECT_TYPE below) |
84 | # patchcheck - Do a test on a series of commits in git (see PATCHCHECK below) | 160 | # patchcheck - Do a test on a series of commits in git (see PATCHCHECK below) |
85 | #TEST_TYPE = test | 161 | #TEST_TYPE = test |
86 | 162 | ||
87 | # The build type is any make config type or a command. | 163 | # Test to run if there is a successful boot and TEST_TYPE is test. |
164 | # Must exit with 0 on success and non zero on error | ||
165 | # default (undefined) | ||
166 | #TEST = ssh user@machine /root/run_test | ||
167 | |||
168 | # The build type is any make config type or special command | ||
88 | # (default randconfig) | 169 | # (default randconfig) |
89 | # nobuild - skip the clean and build step | 170 | # nobuild - skip the clean and build step |
171 | # useconfig:/path/to/config - use the given config and run | ||
172 | # oldconfig on it. | ||
173 | # This option is ignored if TEST_TYPE is patchcheck or bisect | ||
90 | #BUILD_TYPE = randconfig | 174 | #BUILD_TYPE = randconfig |
91 | 175 | ||
92 | # The make command (default make) | 176 | # The make command (default make) |
@@ -95,8 +179,14 @@ | |||
95 | 179 | ||
96 | # If you need an initrd, you can add a script or code here to install | 180 | # If you need an initrd, you can add a script or code here to install |
97 | # it. The environment variable KERNEL_VERSION will be set to the | 181 | # it. The environment variable KERNEL_VERSION will be set to the |
98 | # kernel version that is used. | 182 | # kernel version that is used. Remember to add the initrd line |
183 | # to your grub menu.lst file. | ||
184 | # | ||
185 | # Here's a couple of examples to use: | ||
99 | #POST_INSTALL = ssh user@target /sbin/mkinitrd --allow-missing -f /boot/initramfs-test.img $KERNEL_VERSION | 186 | #POST_INSTALL = ssh user@target /sbin/mkinitrd --allow-missing -f /boot/initramfs-test.img $KERNEL_VERSION |
187 | # | ||
188 | # or on some systems: | ||
189 | #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION | ||
100 | 190 | ||
101 | # Way to reboot the box to the test kernel. | 191 | # Way to reboot the box to the test kernel. |
102 | # Only valid options so far are "grub" and "script" | 192 | # Only valid options so far are "grub" and "script" |
@@ -106,12 +196,19 @@ | |||
106 | # and select that target to reboot to the kernel. If this is not | 196 | # and select that target to reboot to the kernel. If this is not |
107 | # your setup, then specify "script" and have a command or script | 197 | # your setup, then specify "script" and have a command or script |
108 | # specified in REBOOT_SCRIPT to boot to the target. | 198 | # specified in REBOOT_SCRIPT to boot to the target. |
199 | # | ||
200 | # The entry in /boot/grub/menu.lst must be entered in manually. | ||
201 | # The test will not modify that file. | ||
109 | #REBOOT_TYPE = grub | 202 | #REBOOT_TYPE = grub |
110 | 203 | ||
111 | # Line to define success in output. (default "login:") | 204 | # Line to define a successful boot up in console output. |
112 | # This is what the line contains, not the entire line. If you need | 205 | # This is what the line contains, not the entire line. If you need |
113 | # the entire line to match, then use regural expression syntax like | 206 | # the entire line to match, then use regural expression syntax like: |
114 | # ^MyBox Login:$ | 207 | # (do not add any quotes around it) |
208 | # | ||
209 | # SUCCESS_LINE = ^MyBox Login:$ | ||
210 | # | ||
211 | # (default "login:") | ||
115 | #SUCCESS_LINE = login: | 212 | #SUCCESS_LINE = login: |
116 | 213 | ||
117 | # As the test reads the console, after it hits the SUCCESS_LINE | 214 | # As the test reads the console, after it hits the SUCCESS_LINE |
@@ -121,24 +218,33 @@ | |||
121 | #BOOTED_TIMEOUT = 1 | 218 | #BOOTED_TIMEOUT = 1 |
122 | 219 | ||
123 | # The timeout in seconds when we consider the box hung after | 220 | # The timeout in seconds when we consider the box hung after |
124 | # the console stop producing output. | 221 | # the console stop producing output. Be sure to leave enough |
222 | # time here to get pass a reboot. Some machines may not produce | ||
223 | # any console output for a long time during a reboot. You do | ||
224 | # not want the test to fail just because the system was in | ||
225 | # the process of rebooting to the test kernel. | ||
125 | # (default 120) | 226 | # (default 120) |
126 | #TIMEOUT = 120 | 227 | #TIMEOUT = 120 |
127 | 228 | ||
128 | # The location on the host where to write temp files | 229 | # The location on the host where to write temp files |
129 | # (default /tmp/autotest) | 230 | # (default /tmp/ktest) |
130 | #TMP_DIR = /tmp/autotest | 231 | #TMP_DIR = /tmp/ktest |
131 | 232 | ||
132 | # In between tests, a reboot of the box may occur, and this | 233 | # In between tests, a reboot of the box may occur, and this |
133 | # is the time to wait for the console after it stops producing | 234 | # is the time to wait for the console after it stops producing |
134 | # output. Some machines may not produce a large lag on reboot | 235 | # output. Some machines may not produce a large lag on reboot |
135 | # so this should accommodate it. | 236 | # so this should accommodate it. |
237 | # The difference between this and TIMEOUT, is that TIMEOUT happens | ||
238 | # when rebooting to the test kernel. This sleep time happens | ||
239 | # after a test has completed and we are about to start running | ||
240 | # another test. If a reboot to the reliable kernel happens, | ||
241 | # we wait SLEEP_TIME for the console to stop producing output | ||
242 | # before starting the next test. | ||
136 | # (default 60) | 243 | # (default 60) |
137 | #SLEEP_TIME = 60 | 244 | #SLEEP_TIME = 60 |
138 | 245 | ||
139 | # The time in between bisects to sleep (in seconds) | 246 | # The time in between bisects to sleep (in seconds) |
140 | # Can be less than SLEEP_TIME since bisects do more work | 247 | # (default 60) |
141 | # in between boots. (default 60) | ||
142 | #BISECT_SLEEP_TIME = 60 | 248 | #BISECT_SLEEP_TIME = 60 |
143 | 249 | ||
144 | # Build without doing a make mrproper, or removing .config | 250 | # Build without doing a make mrproper, or removing .config |
@@ -149,10 +255,12 @@ | |||
149 | #REBOOT_ON_ERROR = 0 | 255 | #REBOOT_ON_ERROR = 0 |
150 | 256 | ||
151 | # Power off the target on error (ignored if REBOOT_ON_ERROR is set) | 257 | # Power off the target on error (ignored if REBOOT_ON_ERROR is set) |
258 | # Note, this is a DEFAULT section only option. | ||
152 | # (default 0) | 259 | # (default 0) |
153 | #POWEROFF_ON_ERROR = 0 | 260 | #POWEROFF_ON_ERROR = 0 |
154 | 261 | ||
155 | # Power off the target after all tests have completed successfully | 262 | # Power off the target after all tests have completed successfully |
263 | # Note, this is a DEFAULT section only option. | ||
156 | # (default 0) | 264 | # (default 0) |
157 | #POWEROFF_ON_SUCCESS = 0 | 265 | #POWEROFF_ON_SUCCESS = 0 |
158 | 266 | ||
@@ -160,7 +268,7 @@ | |||
160 | # (ignored if POWEROFF_ON_SUCCESS is set) | 268 | # (ignored if POWEROFF_ON_SUCCESS is set) |
161 | #REBOOT_ON_SUCCESS = 1 | 269 | #REBOOT_ON_SUCCESS = 1 |
162 | 270 | ||
163 | # In case there's isses with rebooting, you can specify this | 271 | # In case there are isses with rebooting, you can specify this |
164 | # to always powercycle after this amount of time after calling | 272 | # to always powercycle after this amount of time after calling |
165 | # reboot. | 273 | # reboot. |
166 | # Note, POWERCYCLE_AFTER_REBOOT = 0 does NOT disable it. It just | 274 | # Note, POWERCYCLE_AFTER_REBOOT = 0 does NOT disable it. It just |
@@ -190,43 +298,68 @@ | |||
190 | 298 | ||
191 | # Directory to store failure directories on failure. If this is not | 299 | # Directory to store failure directories on failure. If this is not |
192 | # set, DIE_ON_FAILURE=0 will not save off the .config, dmesg and | 300 | # set, DIE_ON_FAILURE=0 will not save off the .config, dmesg and |
193 | # bootlog. | 301 | # bootlog. This option is ignored if DIE_ON_FAILURE is not set. |
302 | # (default undefined) | ||
194 | #STORE_FAILURES = /home/test/failures | 303 | #STORE_FAILURES = /home/test/failures |
195 | 304 | ||
196 | # A script or command to power off the box (default undef) | 305 | # A script or command to power off the box (default undefined) |
197 | # Needed for POWEROFF_ON_ERROR and SUCCESS | 306 | # Needed for POWEROFF_ON_ERROR and SUCCESS |
307 | # | ||
198 | # Example for digital loggers power switch: | 308 | # Example for digital loggers power switch: |
199 | #POWER_OFF = wget --no-proxy -O /dev/null -q --auth-no-challenge 'http://admin:admin@power/outlet?5=OFF' | 309 | #POWER_OFF = wget --no-proxy -O /dev/null -q --auth-no-challenge 'http://admin:admin@power/outlet?5=OFF' |
310 | # | ||
200 | # Example for a virtual guest call "Guest". | 311 | # Example for a virtual guest call "Guest". |
201 | #POWER_OFF = virsh list | grep '\<GuestF12\>' | awk '{printf ("%d", $1)}' | xargs virsh destroy | 312 | #POWER_OFF = virsh destroy Guest |
202 | 313 | ||
203 | # Any build options for the make (default "") | 314 | # Any build options for the make of the kernel (not for other makes, like configs) |
315 | # (default "") | ||
204 | #BUILD_OPTIONS = -j20 | 316 | #BUILD_OPTIONS = -j20 |
205 | 317 | ||
206 | # Optional log file to write the status (recommended) | 318 | # Optional log file to write the status (recommended) |
207 | # (default undef) | 319 | # Note, this is a DEFAULT section only option. |
320 | # (default undefined) | ||
208 | #LOG_FILE = /home/test/logfiles/target.log | 321 | #LOG_FILE = /home/test/logfiles/target.log |
209 | 322 | ||
210 | # Remove old logfile if it exists before starting all tests. | 323 | # Remove old logfile if it exists before starting all tests. |
324 | # Note, this is a DEFAULT section only option. | ||
211 | # (default 0) | 325 | # (default 0) |
212 | #CLEAR_LOG = 0 | 326 | #CLEAR_LOG = 0 |
213 | 327 | ||
214 | # Test to run if there is a successful boot and TEST_TYPE is test. | ||
215 | # Must exit with 0 on success and non zero on error | ||
216 | # default (undef) | ||
217 | #TEST = ssh user@machine /root/run_test | ||
218 | #TEST[1] = ssh root@mxtest /root/run_test | ||
219 | |||
220 | # The min config that is needed to build for the machine | 328 | # The min config that is needed to build for the machine |
221 | # A nice way to get this to work, is to do a "lsmod > mymods" on the target | 329 | # A nice way to create this is with the following: |
222 | # copy it to the build server, and then run "make LSMOD=mymods localyesconfig". | 330 | # |
223 | # Then copy all the options that are set: "grep '^CONFIG' > /home/test/config-min" | 331 | # $ ssh target |
332 | # $ lsmod > mymods | ||
333 | # $ scp mymods host:/tmp | ||
334 | # $ exit | ||
335 | # $ cd linux.git | ||
336 | # $ rm .config | ||
337 | # $ make LSMOD=mymods localyesconfig | ||
338 | # $ grep '^CONFIG' .config > /home/test/config-min | ||
339 | # | ||
340 | # If you want even less configs: | ||
341 | # | ||
342 | # log in directly to target (do not ssh) | ||
343 | # | ||
344 | # $ su | ||
345 | # # lsmod | cut -d' ' -f1 | xargs rmmod | ||
346 | # | ||
347 | # repeat the above several times | ||
224 | # | 348 | # |
225 | # You might want to set: | 349 | # # lsmod > mymods |
350 | # # reboot | ||
351 | # | ||
352 | # May need to reboot to get your network back to copy the mymods | ||
353 | # to the host, and then remove the previous .config and run the | ||
354 | # localyesconfig again. The CONFIG_MIN generated like this will | ||
355 | # not guarantee network activity to the box so the TEST_TYPE of | ||
356 | # test may fail. | ||
357 | # | ||
358 | # You might also want to set: | ||
226 | # CONFIG_CMDLINE="<your options here>" | 359 | # CONFIG_CMDLINE="<your options here>" |
227 | # randconfig may set the above and override your real command | 360 | # randconfig may set the above and override your real command |
228 | # line options. | 361 | # line options. |
229 | # (default undef) | 362 | # (default undefined) |
230 | #MIN_CONFIG = /home/test/config-min | 363 | #MIN_CONFIG = /home/test/config-min |
231 | 364 | ||
232 | # Sometimes there's options that just break the boot and | 365 | # Sometimes there's options that just break the boot and |
@@ -239,34 +372,47 @@ | |||
239 | # KGDB may cause oops waiting for a connection that's not there. | 372 | # KGDB may cause oops waiting for a connection that's not there. |
240 | # This option points to the file containing config options that will be prepended | 373 | # This option points to the file containing config options that will be prepended |
241 | # to the MIN_CONFIG (or be the MIN_CONFIG if it is not set) | 374 | # to the MIN_CONFIG (or be the MIN_CONFIG if it is not set) |
242 | # before running it through randconfig | 375 | # |
243 | # (default undef) | 376 | # Note, config options in MIN_CONFIG will override these options. |
377 | # | ||
378 | # (default undefined) | ||
244 | #ADD_CONFIG = /home/test/config-broken | 379 | #ADD_CONFIG = /home/test/config-broken |
245 | 380 | ||
246 | #### Per test run options #### | 381 | #### Per test run options #### |
247 | # These are options are per build only. The only exist with the [x] | 382 | # The following options are only allowed in TEST_START sections. |
248 | # syntax, and there is no general option. | 383 | # They are ignored in the DEFAULTS sections. |
249 | # | 384 | # |
250 | # All are optional and undef by default | 385 | # All of these are optional and undefined by default, although |
386 | # some of these options are required for TEST_TYPE of patchcheck | ||
387 | # and bisect. | ||
251 | # | 388 | # |
252 | # CHECKOUT[x] = branch | 389 | # |
390 | # CHECKOUT = branch | ||
253 | # | 391 | # |
254 | # If the BUILD_DIR is a git repository, then you can set this option | 392 | # If the BUILD_DIR is a git repository, then you can set this option |
255 | # to checkout the given branch before running the TEST. If you | 393 | # to checkout the given branch before running the TEST. If you |
256 | # specify this for the first run, that branch will be used for | 394 | # specify this for the first run, that branch will be used for |
257 | # all preceding tests until a new CHECKOUT[x] is set. | 395 | # all preceding tests until a new CHECKOUT is set. |
396 | # | ||
258 | # | 397 | # |
259 | # For TEST_TYPE[x] = patchcheck | 398 | # |
399 | # For TEST_TYPE = patchcheck | ||
260 | # | 400 | # |
261 | # This expects the BUILD_DIR to be a git repository, and | 401 | # This expects the BUILD_DIR to be a git repository, and |
262 | # will checkout the PATCHCHECK_START[x]. | 402 | # will checkout the PATCHCHECK_START commit. |
403 | # | ||
404 | # The option BUILD_TYPE will be ignored. | ||
263 | # | 405 | # |
264 | # PATCHCHECK_START[x] is required and is the first patch to | 406 | # The MIN_CONFIG will be used for all builds of the patchcheck. The build type |
265 | # test (the SHA1 of the commit). | 407 | # used for patchcheck is oldconfig. |
266 | # | 408 | # |
267 | # PATCHCHECK_END[x] is the last patch to check (default HEAD) | 409 | # PATCHCHECK_START is required and is the first patch to |
410 | # test (the SHA1 of the commit). You may also specify anything | ||
411 | # that git checkout allows (branch name, tage, HEAD~3). | ||
268 | # | 412 | # |
269 | # PATCHCHECK_TYPE[x] is required and is the type of test to run: | 413 | # PATCHCHECK_END is the last patch to check (default HEAD) |
414 | # | ||
415 | # PATCHCHECK_TYPE is required and is the type of test to run: | ||
270 | # build, boot, test. | 416 | # build, boot, test. |
271 | # | 417 | # |
272 | # Note, the build test will look for warnings, if a warning occurred | 418 | # Note, the build test will look for warnings, if a warning occurred |
@@ -279,75 +425,86 @@ | |||
279 | # make mrproper. This helps speed up the test. | 425 | # make mrproper. This helps speed up the test. |
280 | # | 426 | # |
281 | # Example: | 427 | # Example: |
282 | # TEST_TYPE[1] = patchcheck | 428 | # TEST_START |
283 | # CHECKOUT[1] = mybranch | 429 | # TEST_TYPE = patchcheck |
284 | # PATCHCHECK_TYPE[1] = boot | 430 | # CHECKOUT = mybranch |
285 | # PATCHCHECK_START[1] = 747e94ae3d1b4c9bf5380e569f614eb9040b79e7 | 431 | # PATCHCHECK_TYPE = boot |
286 | # PATCHCHEKC_END[1] = b8b2663bd7c9da04ac804659b9f617c199d0252c | 432 | # PATCHCHECK_START = 747e94ae3d1b4c9bf5380e569f614eb9040b79e7 |
433 | # PATCHCHEKC_END = HEAD~2 | ||
434 | # | ||
287 | # | 435 | # |
288 | # | 436 | # |
289 | # For TEST_TYPE[x] = bisect | 437 | # For TEST_TYPE = bisect |
290 | # | 438 | # |
291 | # You can specify a git bisect if the BUILD_DIR is a git repository. | 439 | # You can specify a git bisect if the BUILD_DIR is a git repository. |
292 | # The MIN_CONFIG will be used for all builds of the bisect. The build type | 440 | # The MIN_CONFIG will be used for all builds of the bisect. The build type |
293 | # used for bisecting is oldconfig. | 441 | # used for bisecting is oldconfig. |
294 | # | 442 | # |
295 | # BISECT_TYPE[x] is the type of test to perform: | 443 | # The option BUILD_TYPE will be ignored. |
444 | # | ||
445 | # BISECT_TYPE is the type of test to perform: | ||
296 | # build - bad fails to build | 446 | # build - bad fails to build |
297 | # boot - bad builds but fails to boot | 447 | # boot - bad builds but fails to boot |
298 | # test - bad boots but fails a test | 448 | # test - bad boots but fails a test |
299 | # | 449 | # |
300 | # BISECT_GOOD[x] is the commit (SHA1) to label as good | 450 | # BISECT_GOOD is the commit (SHA1) to label as good (accepts all git good commit types) |
301 | # BISECT_BAD[x] is the commit to label as bad | 451 | # BISECT_BAD is the commit to label as bad (accepts all git bad commit types) |
302 | # | 452 | # |
303 | # The above three options are required for a bisect operation. | 453 | # The above three options are required for a bisect operation. |
304 | # | 454 | # |
305 | # BISECT_REPLAY[x] = /path/to/replay/file (optional, default undefined) | 455 | # BISECT_REPLAY = /path/to/replay/file (optional, default undefined) |
306 | # | 456 | # |
307 | # If an operation failed in the bisect that was not expected to | 457 | # If an operation failed in the bisect that was not expected to |
308 | # fail. Then the test ends. The state of the BUILD_DIR will be | 458 | # fail. Then the test ends. The state of the BUILD_DIR will be |
309 | # left off at where the failur occurred. You can examine the | 459 | # left off at where the failure occurred. You can examine the |
310 | # reason for the failure, and perhaps even find a git commit | 460 | # reason for the failure, and perhaps even find a git commit |
311 | # that would work to continue with. You can run: | 461 | # that would work to continue with. You can run: |
312 | # | 462 | # |
313 | # git bisect log > /path/to/replay/file | 463 | # git bisect log > /path/to/replay/file |
314 | # | 464 | # |
315 | # and if BISECT_REPLAY[x] is set, the test will run git bisect replay | 465 | # The adding: |
316 | # before continuing with the bisect. | ||
317 | # | 466 | # |
318 | # BISECT_START[x] = commit (optional, default undefined) | 467 | # BISECT_REPLAY= /path/to/replay/file |
319 | # | 468 | # |
320 | # As with BISECT_REPLAY[x], if the test failed on a commit that | 469 | # And running the test again. The test will perform the initial |
321 | # just happen to have a bad commit in the middle of the bisect, | 470 | # git bisect start, git bisect good, and git bisect bad, and |
322 | # and you need to skip it. If BISECT_START[x] is defined, it | 471 | # then it will run git bisect replay on this file, before |
323 | # will checkout that commit before continuing with the bisect. | 472 | # continuing with the bisect. |
324 | # | 473 | # |
325 | # Note, BISECT_REPLAY[x] is executed before BISECT_START[x]. | 474 | # BISECT_START = commit (optional, default undefined) |
475 | # | ||
476 | # As with BISECT_REPLAY, if the test failed on a commit that | ||
477 | # just happen to have a bad commit in the middle of the bisect, | ||
478 | # and you need to skip it. If BISECT_START is defined, it | ||
479 | # will checkout that commit after doing the initial git bisect start, | ||
480 | # git bisect good, git bisect bad, and running the git bisect replay | ||
481 | # if the BISECT_REPLAY is set. | ||
326 | # | 482 | # |
327 | # BISECT_REVERSE[x] = 1 (optional, default 0) | 483 | # BISECT_REVERSE = 1 (optional, default 0) |
328 | # | 484 | # |
329 | # In those strange instances where it was broken forever | 485 | # In those strange instances where it was broken forever |
330 | # and you are trying to find where it started to work! | 486 | # and you are trying to find where it started to work! |
331 | # Set BISECT_GOOD[x] to the commit that was last known to fail | 487 | # Set BISECT_GOOD to the commit that was last known to fail |
332 | # Set BISECT_BAD[x] to the commit that is known where it started | 488 | # Set BISECT_BAD to the commit that is known to start working. |
333 | # to work. With BISECT_REVERSE[x] = 1, The test will consider | 489 | # With BISECT_REVERSE = 1, The test will consider failures as |
334 | # failures as good, and success as bad. | 490 | # good, and success as bad. |
335 | # | 491 | # |
336 | # BISECT_CHECK[x] = 1 (optional, default 0) | 492 | # BISECT_CHECK = 1 (optional, default 0) |
337 | # | 493 | # |
338 | # Just to be sure the good is good and bad is bad, setting | 494 | # Just to be sure the good is good and bad is bad, setting |
339 | # BISECT_CHECK[x] to 1 will start the bisect by first checking | 495 | # BISECT_CHECK to 1 will start the bisect by first checking |
340 | # out BISECT_BAD[x] and makes sure it fails, then it will check | 496 | # out BISECT_BAD and makes sure it fails, then it will check |
341 | # out BISECT_GOOD[x] and makes sure it succeeds before starting | 497 | # out BISECT_GOOD and makes sure it succeeds before starting |
342 | # the bisect (it works for BISECT_REVERSE[x] too). | 498 | # the bisect (it works for BISECT_REVERSE too). |
343 | # | 499 | # |
344 | # You can limit the test to just check BISECT_GOOD[x] or | 500 | # You can limit the test to just check BISECT_GOOD or |
345 | # BISECT_BAD[x] with BISECT_CHECK[x] = good or | 501 | # BISECT_BAD with BISECT_CHECK = good or |
346 | # BISECT_CHECK[x] = bad, respectively. | 502 | # BISECT_CHECK = bad, respectively. |
347 | # | 503 | # |
348 | # Example: | 504 | # Example: |
349 | # TEST_TYPE[1] = bisect | 505 | # TEST_START |
350 | # BISECT_GOOD[1] = v2.6.36 | 506 | # TEST_TYPE = bisect |
351 | # BISECT_BAD[1] = b5153163ed580e00c67bdfecb02b2e3843817b3e | 507 | # BISECT_GOOD = v2.6.36 |
352 | # BISECT_TYPE[1] = build | 508 | # BISECT_BAD = b5153163ed580e00c67bdfecb02b2e3843817b3e |
353 | # MIN_CONFIG[1] = /home/test/config-bisect | 509 | # BISECT_TYPE = build |
510 | # MIN_CONFIG = /home/test/config-bisect | ||