aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/ktest')
-rwxr-xr-xtools/testing/ktest/ktest.pl26
-rw-r--r--tools/testing/ktest/sample.conf14
2 files changed, 33 insertions, 7 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 0a5f6cb007af..1143e6c5f07f 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -46,6 +46,7 @@ my %default = (
46 "DIE_ON_FAILURE" => 1, 46 "DIE_ON_FAILURE" => 1,
47 "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND", 47 "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND",
48 "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", 48 "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE",
49 "SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}",
49 "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", 50 "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot",
50 "STOP_AFTER_SUCCESS" => 10, 51 "STOP_AFTER_SUCCESS" => 10,
51 "STOP_AFTER_FAILURE" => 60, 52 "STOP_AFTER_FAILURE" => 60,
@@ -91,6 +92,7 @@ my $powercycle_after_reboot;
91my $poweroff_after_halt; 92my $poweroff_after_halt;
92my $ssh_exec; 93my $ssh_exec;
93my $scp_to_target; 94my $scp_to_target;
95my $scp_to_target_install;
94my $power_off; 96my $power_off;
95my $grub_menu; 97my $grub_menu;
96my $grub_number; 98my $grub_number;
@@ -243,6 +245,7 @@ my %option_map = (
243 "BUILD_TARGET" => \$build_target, 245 "BUILD_TARGET" => \$build_target,
244 "SSH_EXEC" => \$ssh_exec, 246 "SSH_EXEC" => \$ssh_exec,
245 "SCP_TO_TARGET" => \$scp_to_target, 247 "SCP_TO_TARGET" => \$scp_to_target,
248 "SCP_TO_TARGET_INSTALL" => \$scp_to_target_install,
246 "CHECKOUT" => \$checkout, 249 "CHECKOUT" => \$checkout,
247 "TARGET_IMAGE" => \$target_image, 250 "TARGET_IMAGE" => \$target_image,
248 "LOCALVERSION" => \$localversion, 251 "LOCALVERSION" => \$localversion,
@@ -1349,8 +1352,7 @@ sub run_ssh {
1349} 1352}
1350 1353
1351sub run_scp { 1354sub run_scp {
1352 my ($src, $dst) = @_; 1355 my ($src, $dst, $cp_scp) = @_;
1353 my $cp_scp = $scp_to_target;
1354 1356
1355 $cp_scp =~ s/\$SRC_FILE/$src/g; 1357 $cp_scp =~ s/\$SRC_FILE/$src/g;
1356 $cp_scp =~ s/\$DST_FILE/$dst/g; 1358 $cp_scp =~ s/\$DST_FILE/$dst/g;
@@ -1358,6 +1360,22 @@ sub run_scp {
1358 return run_command "$cp_scp"; 1360 return run_command "$cp_scp";
1359} 1361}
1360 1362
1363sub run_scp_install {
1364 my ($src, $dst) = @_;
1365
1366 my $cp_scp = $scp_to_target_install;
1367
1368 return run_scp($src, $dst, $cp_scp);
1369}
1370
1371sub run_scp_mod {
1372 my ($src, $dst) = @_;
1373
1374 my $cp_scp = $scp_to_target;
1375
1376 return run_scp($src, $dst, $cp_scp);
1377}
1378
1361sub get_grub_index { 1379sub get_grub_index {
1362 1380
1363 if ($reboot_type ne "grub") { 1381 if ($reboot_type ne "grub") {
@@ -1630,7 +1648,7 @@ sub install {
1630 1648
1631 my $cp_target = eval_kernel_version $target_image; 1649 my $cp_target = eval_kernel_version $target_image;
1632 1650
1633 run_scp "$outputdir/$build_target", "$cp_target" or 1651 run_scp_install "$outputdir/$build_target", "$cp_target" or
1634 dodie "failed to copy image"; 1652 dodie "failed to copy image";
1635 1653
1636 my $install_mods = 0; 1654 my $install_mods = 0;
@@ -1665,7 +1683,7 @@ sub install {
1665 run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or 1683 run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or
1666 dodie "making tarball"; 1684 dodie "making tarball";
1667 1685
1668 run_scp "$tmpdir/$modtar", "/tmp" or 1686 run_scp_mod "$tmpdir/$modtar", "/tmp" or
1669 dodie "failed to copy modules"; 1687 dodie "failed to copy modules";
1670 1688
1671 unlink "$tmpdir/$modtar"; 1689 unlink "$tmpdir/$modtar";
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 5ea04c6a71bf..b682456afda8 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -710,10 +710,18 @@
710# The variables SSH_USER, MACHINE and SSH_COMMAND are defined 710# The variables SSH_USER, MACHINE and SSH_COMMAND are defined
711#SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND"; 711#SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND";
712 712
713# The way to copy a file to the target 713# The way to copy a file to the target (install and modules)
714# (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE) 714# (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE)
715# The variables SSH_USER, MACHINE, SRC_FILE and DST_FILE are defined. 715# The variables SSH_USER, MACHINE are defined by the config
716#SCP_TO_TARGET = scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE 716# SRC_FILE and DST_FILE are ktest internal variables and
717# should only have '$' and not the '${}' notation.
718# (default scp $SRC_FILE ${SSH_USER}@${MACHINE}:$DST_FILE)
719#SCP_TO_TARGET = echo skip scp for $SRC_FILE $DST_FILE
720
721# If install needs to be different than modules, then this
722# option will override the SCP_TO_TARGET for installation.
723# (default ${SCP_TO_TARGET} )
724#SCP_TO_TARGET_INSTALL = scp $SRC_FILE tftp@tftpserver:$DST_FILE
717 725
718# The nice way to reboot the target 726# The nice way to reboot the target
719# (default ssh $SSH_USER@$MACHINE reboot) 727# (default ssh $SSH_USER@$MACHINE reboot)