From patchwork Wed Feb 5 14:56:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liam Merwick X-Patchwork-Id: 11366447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AFB4112B for ; Wed, 5 Feb 2020 15:00:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D606921741 for ; Wed, 5 Feb 2020 15:00:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="n8cel0F5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D606921741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izMA3-0003yM-1O for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Feb 2020 10:00:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46718) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izM8Y-0001QJ-2h for qemu-devel@nongnu.org; Wed, 05 Feb 2020 09:58:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izM8W-0004qk-SH for qemu-devel@nongnu.org; Wed, 05 Feb 2020 09:58:41 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:39556) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1izM8W-0004o7-Ip for qemu-devel@nongnu.org; Wed, 05 Feb 2020 09:58:40 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 015EwE6x188776; Wed, 5 Feb 2020 14:58:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=jKD4F/i81ODMhCydEAUkfu0ajc611DYWcWzceMoBqjs=; b=n8cel0F5VTZhX3px/RMlkhKQNWt6t3xSGtUwsDtfWIsddz1T3XlQ+yC2Cuo/dpITrZSB +vWtgGXipSzgdROQ1ZePE2QJS7OHkHJ8dpBTDb5HGo6Np94cFW+nTgiX/HkTTO+bbkQM 8BZUOFgYRd3YWOWN3XVFHJd66OFCvSpbZUQ61HUT9u+is1hTYaN03S18Ppy6LMl4SKNn u+QFveQCAYPqtFgluVbjfPSsXga4+uTezhrlvthFVqdbeAkbv4M1V9M3a94hm9BXKhJ8 zAU7Q3yfxS4ftWUlZVW6wreYoH2NbQPhwFalfcnTbgd5bDc85cDLCTShyCmif+HvUs69 vA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2xykbp3hb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Feb 2020 14:58:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 015ErRYv035693; Wed, 5 Feb 2020 14:56:23 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2xykbs1jja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 05 Feb 2020 14:56:23 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 015EuMYZ017963; Wed, 5 Feb 2020 14:56:22 GMT Received: from ol7.uk.oracle.com (/10.175.206.136) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 05 Feb 2020 06:56:21 -0800 From: Liam Merwick To: alex.bennee@linaro.org, fam@euphon.net, philmd@redhat.com Subject: [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method Date: Wed, 5 Feb 2020 14:56:03 +0000 Message-Id: <1580914565-19675-5-git-send-email-liam.merwick@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1580914565-19675-1-git-send-email-liam.merwick@oracle.com> References: <1580914565-19675-1-git-send-email-liam.merwick@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9521 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=940 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2002050118 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9521 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2002050119 X-MIME-Autoconverted: from 8bit to quoted-printable by userp2130.oracle.com id 015EwE6x188776 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.86 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: slp@redhat.com, qemu-devel@nongnu.org, wainersm@redhat.com, pbonzini@redhat.com, sgarzare@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Add a method to extract a specified file from an RPM to the test's working directory and return the path to the extracted file. Signed-off-by: Liam Merwick Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index e9375590bc1c..6a473363a122 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -51,6 +51,22 @@ class BootLinuxConsole(Test): os.chdir(cwd) return self.workdir + path + def extract_from_rpm(self, rpm, path): + """ + Extracts a file from an RPM package into the test workdir. + + :param rpm: path to the rpm archive + :param path: path within the rpm archive of the file to be extracted + needs to be a relative path (starting with './') because + cpio(1), which is used to extract the file, expects that. + :returns: path of the extracted file + """ + cwd = os.getcwd() + os.chdir(self.workdir) + process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True) + os.chdir(cwd) + return os.path.normpath(os.path.join(self.workdir, path)) + def do_test_x86_64_machine(self): """ Common routine to boot an x86_64 guest.