mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: drjones@redhat.com, rostedt@goodmis.org
Subject: [PATCH 09/10] ktest: test faster, favor rsync over the tarball method
Date: Fri, 12 Aug 2011 15:32:11 +0200	[thread overview]
Message-ID: <1313155932-20092-10-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1313155932-20092-1-git-send-email-drjones@redhat.com>

If we have rsync on the host and target, then use that to install
modules. It's faster, doesn't require as much free disk space, and
is more environmentally friendly. OK, maybe not the last one, but
it's still better.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 tools/testing/ktest/ktest.pl |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 719df19..ac0e688 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -81,6 +81,8 @@ my $powercycle_after_reboot;
 my $poweroff_after_halt;
 my $ssh_exec;
 my $scp_to_target;
+my $have_rsync;
+my %has_rsync = ();
 my $power_off;
 my $grub_menu;
 my $grub_number;
@@ -1137,25 +1139,39 @@ sub install {
 	dodie "Failed to install modules";
 
     my $modlib = "/lib/modules/$version";
-    my $modtar = "ktest-mods.tar.bz2";
 
-    run_ssh "rm -rf $modlib" or
+    if (!defined($have_rsync)) {
+	$have_rsync = run_command("which rsync");
+    }
+
+    if ($have_rsync && !defined($has_rsync{$machine})) {
+	$has_rsync{$machine} = run_ssh("which rsync");
+    }
+
+    if ($have_rsync && $has_rsync{$machine}) {
+	run_command
+	    "rsync -az --delete-before $tmpdir$modlib/ $target:$modlib" or
+		dodie "failed to rsync modules";
+    } else {
+	my $modtar = "ktest-mods.tar.bz2";
+
+	run_ssh "rm -rf $modlib" or
 	dodie "failed to remove old mods: $modlib";
 
-    # would be nice if scp -r did not follow symbolic links
-    run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or
+	# would be nice if scp -r did not follow symbolic links
+	run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or
 	dodie "making tarball";
 
-    run_scp "$tmpdir/$modtar", "/tmp" or
+	run_scp "$tmpdir/$modtar", "/tmp" or
 	dodie "failed to copy modules";
 
-    unlink "$tmpdir/$modtar";
+	unlink "$tmpdir/$modtar";
 
-    run_ssh "'(cd / && tar xjf /tmp/$modtar)'" or
+	run_ssh "'(cd / && tar xjf /tmp/$modtar)'" or
 	dodie "failed to tar modules";
 
-    run_ssh "rm -f /tmp/$modtar";
-
+	run_ssh "rm -f /tmp/$modtar";
+    }
     do_post_install;
 }
 
-- 
1.7.4.1


  parent reply	other threads:[~2011-08-12 13:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 13:32 [KTEST PATCH 00/10] collection of ktest patches Andrew Jones
2011-08-12 13:32 ` [PATCH 01/10] ktest: create outputdir, if it doesn't exist Andrew Jones
2011-08-12 13:32 ` [PATCH 02/10] ktest: small cleanup Andrew Jones
2011-08-12 13:32 ` [PATCH 03/10] ktest: factor reboot code Andrew Jones
2011-08-12 13:32 ` [PATCH 04/10] ktest: Introduce RESET_TIME Andrew Jones
2011-08-12 15:59   ` Steven Rostedt
2011-08-12 16:25   ` [PATCH 04/10 v2] ktest: Introduce CONSOLE_RESET_TIME Andrew Jones
2011-08-18 21:28     ` Steven Rostedt
2011-08-24  8:45       ` Andrew Jones
2011-08-12 13:32 ` [PATCH 05/10] ktest: refactor monitor/boot/test code Andrew Jones
2011-08-12 13:32 ` [PATCH 06/10] ktest: make start_monitor_and_boot true to its name Andrew Jones
2011-08-12 13:32 ` [PATCH 07/10] ktest: Introduce PASS_COUNT Andrew Jones
2011-08-12 16:49   ` Steven Rostedt
2011-08-12 17:09     ` Andrew Jones
2011-08-12 17:20       ` Steven Rostedt
2011-08-12 17:58   ` [PATCH 07/10 v2] ktest: Introduce RERUN Andrew Jones
2011-08-12 13:32 ` [PATCH 08/10] ktest: test faster, put REBOOT_ON_SUCCESS to more work Andrew Jones
2011-08-12 13:32 ` Andrew Jones [this message]
2011-08-12 13:32 ` [PATCH 10/10] ktest: Introduce FAILURE_LINE Andrew Jones
2011-08-12 17:03   ` Steven Rostedt
2011-08-12 17:37   ` [PATCH 10/10 v2] " Andrew Jones
2011-08-12 17:44 ` [KTEST PATCH 00/10] collection of ktest patches Steven Rostedt
2011-08-12 18:03   ` Andrew Jones

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=1313155932-20092-10-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®