From patchwork Thu Feb 18 18:10:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8353241 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE5A0C0553 for ; Thu, 18 Feb 2016 18:13:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA40320279 for ; Thu, 18 Feb 2016 18:13:44 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F65220357 for ; Thu, 18 Feb 2016 18:13:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWT2b-000897-Py; Thu, 18 Feb 2016 18:11:01 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWT2a-000892-64 for xen-devel@lists.xenproject.org; Thu, 18 Feb 2016 18:11:00 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id 6E/09-09834-33906C65; Thu, 18 Feb 2016 18:10:59 +0000 X-Env-Sender: prvs=849b1dda4=roger.pau@citrix.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1455819054!24996728!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53168 invoked from network); 18 Feb 2016 18:10:55 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 18 Feb 2016 18:10:55 -0000 X-IronPort-AV: E=Sophos;i="5.22,466,1449532800"; d="scan'208";a="339220025" From: Roger Pau Monne To: Date: Thu, 18 Feb 2016 19:10:47 +0100 Message-ID: <1455819047-43477-1-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.5.4 (Apple Git-61) MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH RFC] osstest: add a cd-{insert/eject} test for Debian HVM X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It could/should be expanded to other guest types, but at least it's a start. It should also test that the guest can correctly access the disk contents. The only supported toolstack for this test is xl. Signed-off-by: Roger Pau Monné --- CC: Ian Jackson --- Osstest/TestSupport.pm | 17 +++++++++++++++++ Osstest/Toolstack/xl.pm | 18 ++++++++++++++++++ sg-run-job | 1 + ts-hvm-cd | 31 +++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 ts-hvm-cd diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 2141905..4445a04 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -2508,6 +2508,23 @@ sub guest_editconfig_nocd ($$) { }); } +# Both the insert/eject functions hardcode 'hdc' as the virtual cdrom unit, +# if more_prepareguest_hvm is changed to use a different unit this is doomed +# to fail. +sub guest_eject_cd ($) { + my ($gho) = @_; + my $ho = $gho->{Host}; + die "xl is the only supported toolstack" if $tsname neq 'xl'; + toolstack($ho)->cd_eject($gho); +} + +sub guest_insert_cd ($) { + my ($gho) = @_; + my $ho = $gho->{Host}; + die "xl is the only supported toolstack" if $tsname neq 'xl'; + toolstack($ho)->cd_insert($gho); +} + sub host_install_postboot_complete ($) { my ($ho) = @_; target_core_dump_setup($ho); diff --git a/Osstest/Toolstack/xl.pm b/Osstest/Toolstack/xl.pm index d956bcd..b25b19c 100644 --- a/Osstest/Toolstack/xl.pm +++ b/Osstest/Toolstack/xl.pm @@ -118,4 +118,22 @@ sub block_attach ($$$$) { target_cmd_root($ho, $cmd, 100); } +sub cd_eject($$) { + my ($self,$gho) = @_; + my $ho = $self->{Host}; + my $gn = $gho->{Name}; + my $cmd = $self->{_VerboseCommand}." cd-eject $gn hdc"; + target_cmd_root($ho, $cmd, 100); +} + +sub cd_insert($$) { + my ($self,$gho) = @_; + my $ho = $self->{Host}; + my $gn = $gho->{Name}; + my $iso = $gho->{Rimage}; + my $cmd = $self->{_VerboseCommand}." cd-insert $gn hdc $iso"; + target_cmd_root($ho, $cmd, 100); +} + + 1; diff --git a/sg-run-job b/sg-run-job index 3e0f966..43a141f 100755 --- a/sg-run-job +++ b/sg-run-job @@ -320,6 +320,7 @@ proc run-job/test-rhelhvm {} { proc need-hosts/test-debianhvm {} { return host } proc run-job/test-debianhvm {} { run-ts . = ts-debian-hvm-install + run-ts . = ts-hvm-cd test-guest debianhvm } diff --git a/ts-hvm-cd b/ts-hvm-cd new file mode 100644 index 0000000..5776afd --- /dev/null +++ b/ts-hvm-cd @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w +# This is part of "osstest", an automated testing framework for Xen. +# Copyright (C) 2009-2016 Citrix Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +use strict qw(vars); +use DBI; +use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); + +our $gho; + +guest_eject_cd($gho) +sleep(10) +guest_insert_cd($gho) +sleep(10) +guest_eject_cd($gho)