ktest.pl (c4261d0f62ccbb42184d13b43807b36b100e8fb5) ktest.pl (bb8474b181a715182a110c8ed2b3786ea7487f2b)
1#!/usr/bin/perl -w
2#
3# Copyright 2010 - Steven Rostedt <srostedt@redhat.com>, Red Hat Inc.
4# Licensed under the terms of the GNU GPL License version 2
5#
6
7use strict;
8use IPC::Open2;

--- 8 unchanged lines hidden (view full) ---

17
18my %opt;
19my %repeat_tests;
20my %repeats;
21my %default;
22
23#default opts
24$default{"NUM_TESTS"} = 1;
1#!/usr/bin/perl -w
2#
3# Copyright 2010 - Steven Rostedt <srostedt@redhat.com>, Red Hat Inc.
4# Licensed under the terms of the GNU GPL License version 2
5#
6
7use strict;
8use IPC::Open2;

--- 8 unchanged lines hidden (view full) ---

17
18my %opt;
19my %repeat_tests;
20my %repeats;
21my %default;
22
23#default opts
24$default{"NUM_TESTS"} = 1;
25$default{"TEST_TYPE"} = "test";
25$default{"TEST_TYPE"} = "build";
26$default{"BUILD_TYPE"} = "randconfig";
27$default{"MAKE_CMD"} = "make";
28$default{"TIMEOUT"} = 120;
29$default{"TMP_DIR"} = "/tmp/ktest/\${MACHINE}";
30$default{"SLEEP_TIME"} = 60; # sleep time between tests
31$default{"BUILD_NOCLEAN"} = 0;
32$default{"REBOOT_ON_ERROR"} = 0;
33$default{"POWEROFF_ON_ERROR"} = 0;

--- 97 unchanged lines hidden (view full) ---

131my $stop_after_failure;
132my $stop_test_after;
133my $build_target;
134my $target_image;
135my $localversion;
136my $iteration = 0;
137my $successes = 0;
138
26$default{"BUILD_TYPE"} = "randconfig";
27$default{"MAKE_CMD"} = "make";
28$default{"TIMEOUT"} = 120;
29$default{"TMP_DIR"} = "/tmp/ktest/\${MACHINE}";
30$default{"SLEEP_TIME"} = 60; # sleep time between tests
31$default{"BUILD_NOCLEAN"} = 0;
32$default{"REBOOT_ON_ERROR"} = 0;
33$default{"POWEROFF_ON_ERROR"} = 0;

--- 97 unchanged lines hidden (view full) ---

131my $stop_after_failure;
132my $stop_test_after;
133my $build_target;
134my $target_image;
135my $localversion;
136my $iteration = 0;
137my $successes = 0;
138
139# set when a test is something other that just building
140# which would require more options.
141my $buildonly = 1;
142
139my %entered_configs;
140my %config_help;
141my %variable;
142my %force_config;
143
144# do not force reboots on config problems
145my $no_reboot = 1;
146
147# default variables that can be used
148chomp ($variable{"PWD"} = `pwd`);
149
150$config_help{"MACHINE"} = << "EOF"
151 The machine hostname that you will test.
143my %entered_configs;
144my %config_help;
145my %variable;
146my %force_config;
147
148# do not force reboots on config problems
149my $no_reboot = 1;
150
151# default variables that can be used
152chomp ($variable{"PWD"} = `pwd`);
153
154$config_help{"MACHINE"} = << "EOF"
155 The machine hostname that you will test.
156 For build only tests, it is still needed to differentiate log files.
152EOF
153 ;
154$config_help{"SSH_USER"} = << "EOF"
155 The box is expected to have ssh on normal bootup, provide the user
156 (most likely root, since you need privileged operations)
157EOF
158 ;
159$config_help{"BUILD_DIR"} = << "EOF"

--- 156 unchanged lines hidden (view full) ---

316 }
317 $entered_configs{$config} = ${ans};
318 last;
319 }
320}
321
322sub get_ktest_configs {
323 get_ktest_config("MACHINE");
157EOF
158 ;
159$config_help{"SSH_USER"} = << "EOF"
160 The box is expected to have ssh on normal bootup, provide the user
161 (most likely root, since you need privileged operations)
162EOF
163 ;
164$config_help{"BUILD_DIR"} = << "EOF"

--- 156 unchanged lines hidden (view full) ---

321 }
322 $entered_configs{$config} = ${ans};
323 last;
324 }
325}
326
327sub get_ktest_configs {
328 get_ktest_config("MACHINE");
324 get_ktest_config("SSH_USER");
325 get_ktest_config("BUILD_DIR");
326 get_ktest_config("OUTPUT_DIR");
329 get_ktest_config("BUILD_DIR");
330 get_ktest_config("OUTPUT_DIR");
327 get_ktest_config("BUILD_TARGET");
328 get_ktest_config("TARGET_IMAGE");
329 get_ktest_config("POWER_CYCLE");
330 get_ktest_config("CONSOLE");
331
332 # options required for other than just building a kernel
333 if (!$buildonly) {
334 get_ktest_config("SSH_USER");
335 get_ktest_config("BUILD_TARGET");
336 get_ktest_config("TARGET_IMAGE");
337 get_ktest_config("POWER_CYCLE");
338 get_ktest_config("CONSOLE");
339 }
340
331 get_ktest_config("LOCALVERSION");
332
341 get_ktest_config("LOCALVERSION");
342
343 return if ($buildonly);
344
333 my $rtype = $opt{"REBOOT_TYPE"};
334
335 if (!defined($rtype)) {
336 if (!defined($opt{"GRUB_MENU"})) {
337 get_ktest_config("REBOOT_TYPE");
338 $rtype = $entered_configs{"REBOOT_TYPE"};
339 } else {
340 $rtype = "grub";

--- 42 unchanged lines hidden (view full) ---

383 $retval =~ s/ //;
384
385 return "$retval"
386}
387
388sub set_value {
389 my ($lvalue, $rvalue, $override, $overrides, $name) = @_;
390
345 my $rtype = $opt{"REBOOT_TYPE"};
346
347 if (!defined($rtype)) {
348 if (!defined($opt{"GRUB_MENU"})) {
349 get_ktest_config("REBOOT_TYPE");
350 $rtype = $entered_configs{"REBOOT_TYPE"};
351 } else {
352 $rtype = "grub";

--- 42 unchanged lines hidden (view full) ---

395 $retval =~ s/ //;
396
397 return "$retval"
398}
399
400sub set_value {
401 my ($lvalue, $rvalue, $override, $overrides, $name) = @_;
402
403 if ($lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $rvalue ne "build") {
404 # Note if a test is something other than build, then we
405 # will need other manditory options.
406 $buildonly = 0;
407 }
408
391 if (defined($opt{$lvalue})) {
392 if (!$override || defined(${$overrides}{$lvalue})) {
393 my $extra = "";
394 if ($override) {
395 $extra = "In the same override section!\n";
396 }
397 die "$name: $.: Option $lvalue defined more than once!\n$extra";
398 }

--- 2867 unchanged lines hidden (view full) ---

3266 mkpath($dir) or
3267 die "can't create $dir";
3268 }
3269 }
3270
3271 $ENV{"SSH_USER"} = $ssh_user;
3272 $ENV{"MACHINE"} = $machine;
3273
409 if (defined($opt{$lvalue})) {
410 if (!$override || defined(${$overrides}{$lvalue})) {
411 my $extra = "";
412 if ($override) {
413 $extra = "In the same override section!\n";
414 }
415 die "$name: $.: Option $lvalue defined more than once!\n$extra";
416 }

--- 2867 unchanged lines hidden (view full) ---

3284 mkpath($dir) or
3285 die "can't create $dir";
3286 }
3287 }
3288
3289 $ENV{"SSH_USER"} = $ssh_user;
3290 $ENV{"MACHINE"} = $machine;
3291
3274 $target = "$ssh_user\@$machine";
3275
3276 $buildlog = "$tmpdir/buildlog-$machine";
3277 $testlog = "$tmpdir/testlog-$machine";
3278 $dmesg = "$tmpdir/dmesg-$machine";
3279 $make = "$makecmd O=$outputdir";
3280 $output_config = "$outputdir/.config";
3281
3292 $buildlog = "$tmpdir/buildlog-$machine";
3293 $testlog = "$tmpdir/testlog-$machine";
3294 $dmesg = "$tmpdir/dmesg-$machine";
3295 $make = "$makecmd O=$outputdir";
3296 $output_config = "$outputdir/.config";
3297
3282 if ($reboot_type eq "grub") {
3283 dodie "GRUB_MENU not defined" if (!defined($grub_menu));
3284 } elsif (!defined($reboot_script)) {
3285 dodie "REBOOT_SCRIPT not defined"
3298 if (!$buildonly) {
3299 $target = "$ssh_user\@$machine";
3300 if ($reboot_type eq "grub") {
3301 dodie "GRUB_MENU not defined" if (!defined($grub_menu));
3302 } elsif (!defined($reboot_script)) {
3303 dodie "REBOOT_SCRIPT not defined"
3304 }
3286 }
3287
3288 my $run_type = $build_type;
3289 if ($test_type eq "patchcheck") {
3290 $run_type = $opt{"PATCHCHECK_TYPE[$i]"};
3291 } elsif ($test_type eq "bisect") {
3292 $run_type = $opt{"BISECT_TYPE[$i]"};
3293 } elsif ($test_type eq "config_bisect") {

--- 89 unchanged lines hidden ---
3305 }
3306
3307 my $run_type = $build_type;
3308 if ($test_type eq "patchcheck") {
3309 $run_type = $opt{"PATCHCHECK_TYPE[$i]"};
3310 } elsif ($test_type eq "bisect") {
3311 $run_type = $opt{"BISECT_TYPE[$i]"};
3312 } elsif ($test_type eq "config_bisect") {

--- 89 unchanged lines hidden ---