From patchwork Fri Jul 26 13:44:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 13742807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9FD56C3DA70 for ; Fri, 26 Jul 2024 13:46:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXLGZ-0004u7-6k; Fri, 26 Jul 2024 09:45:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXLG3-0004dp-6E for qemu-devel@nongnu.org; Fri, 26 Jul 2024 09:45:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXLG1-0001tU-A3 for qemu-devel@nongnu.org; Fri, 26 Jul 2024 09:45:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722001515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=osLPoiTFxmzb7yDc5D1S/zDpmyUMFotz0CS6WEgfGpM=; b=WgNUJpI4VFnW/lNNd6VSMVCykvP8W52GlX2NIhdq8aHnNwWYWPMOIgvI5KX4mEvlq5iydh 7BQ89l9Q+OEg3pbh4QAoUpjbUlmTulHRAPQa52Oizz0+RiCKY+IqlkYuT4u/SxtvqqAiGL 7sK7yAGfQQFlHkpXrruxcHQtSkTogWg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-149-3RQj_R13N2mlf7KIO6P6CQ-1; Fri, 26 Jul 2024 09:45:10 -0400 X-MC-Unique: 3RQj_R13N2mlf7KIO6P6CQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 04B251944A95; Fri, 26 Jul 2024 13:45:08 +0000 (UTC) Received: from p1.localdomain.com (unknown [10.22.17.77]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B9EB1955D45; Fri, 26 Jul 2024 13:45:03 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas Huth , Beraldo Leal , Sriram Yagnaraman , David Woodhouse , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Leif Lindholm , Jiaxun Yang , kvm@vger.kernel.org, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , Marcin Juszkiewicz , Wainer dos Santos Moschetta , qemu-arm@nongnu.org, Radoslaw Biernacki , Cleber Rosa , Paul Durrant , Paolo Bonzini , Akihiko Odaki Subject: [PATCH 04/13] tests/avocado: add cdrom permission related tests Date: Fri, 26 Jul 2024 09:44:29 -0400 Message-ID: <20240726134438.14720-5-crosa@redhat.com> In-Reply-To: <20240726134438.14720-1-crosa@redhat.com> References: <20240726134438.14720-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass client-ip=170.10.129.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.143, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Cleber Rosa --- tests/avocado/cdrom.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/avocado/cdrom.py diff --git a/tests/avocado/cdrom.py b/tests/avocado/cdrom.py new file mode 100644 index 0000000000..c9aa5d69cb --- /dev/null +++ b/tests/avocado/cdrom.py @@ -0,0 +1,41 @@ +# Simple functional tests for cdrom devices +# +# Copyright (c) 2023 Red Hat, Inc. +# +# Author: +# Cleber Rosa +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import os + +from avocado.utils.iso9660 import iso9660 +from avocado_qemu import QemuSystemTest + + +class Cdrom(QemuSystemTest): + """ + :avocado: tags=block,cdrom,quick + :avocado: tags=machine:none + """ + def setUp(self): + super().setUp() + self.iso_path = os.path.join(self.workdir, "cdrom.iso") + iso = iso9660(self.iso_path) + iso.create() + iso.close() + + def test_plain_iso_rw(self): + self.vm.add_args('-drive', f'file={self.iso_path}') + self.vm.launch() + query_block_result = self.vm.qmp('query-block')['return'] + self.assertEqual(len(query_block_result), 1) + self.assertFalse(query_block_result[0]["inserted"]["ro"]) + + def test_media_cdrom_ro(self): + self.vm.add_args('-drive', f'file={self.iso_path},media=cdrom') + self.vm.launch() + query_block_result = self.vm.qmp('query-block')['return'] + self.assertEqual(len(query_block_result), 1) + self.assertTrue(query_block_result[0]["inserted"]["ro"])