From patchwork Thu Jul 15 15:57:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 112260 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6FFvee4008886 for ; Thu, 15 Jul 2010 15:57:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932437Ab0GOP5h (ORCPT ); Thu, 15 Jul 2010 11:57:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20949 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932834Ab0GOP5g (ORCPT ); Thu, 15 Jul 2010 11:57:36 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvZMn031866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 15 Jul 2010 11:57:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvYFU008381; Thu, 15 Jul 2010 11:57:34 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6FFvUQM021960; Thu, 15 Jul 2010 11:57:33 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 3/9] KVM test: rss_file_transfer.py: add convenience functions upload() and download() Date: Thu, 15 Jul 2010 18:57:32 +0300 Message-Id: <1279209458-19590-3-git-send-email-mgoldish@redhat.com> In-Reply-To: <1279209458-19590-2-git-send-email-mgoldish@redhat.com> References: <1279209458-19590-1-git-send-email-mgoldish@redhat.com> <1279209458-19590-2-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Jul 2010 15:57:41 +0000 (UTC) diff --git a/client/tests/kvm/rss_file_transfer.py b/client/tests/kvm/rss_file_transfer.py index c584397..3de8259 100755 --- a/client/tests/kvm/rss_file_transfer.py +++ b/client/tests/kvm/rss_file_transfer.py @@ -395,6 +395,30 @@ class FileDownloadClient(FileTransferClient): raise +def upload(address, port, src_pattern, dst_path, timeout=60, + connect_timeout=10): + """ + Connect to server and upload files. + + @see: FileUploadClient + """ + client = FileUploadClient(address, port, connect_timeout) + client.upload(src_pattern, dst_path, timeout) + client.close() + + +def download(address, port, src_pattern, dst_path, timeout=60, + connect_timeout=10): + """ + Connect to server and upload files. + + @see: FileDownloadClient + """ + client = FileDownloadClient(address, port, connect_timeout) + client.download(src_pattern, dst_path, timeout) + client.close() + + def main(): import optparse @@ -418,13 +442,9 @@ def main(): port = int(port) if options.download: - client = FileDownloadClient(address, port) - client.download(src_pattern, dst_path, timeout=options.timeout) - client.close() + download(address, port, src_pattern, dst_path, options.timeout) elif options.upload: - client = FileUploadClient(address, port) - client.upload(src_pattern, dst_path, timeout=options.timeout) - client.close() + upload(address, port, src_pattern, dst_path, options.timeout) if __name__ == "__main__":