From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 03/14] tests/functional: make cached asset files read-only
Date: Thu, 31 Oct 2024 18:48:21 +0100 [thread overview]
Message-ID: <20241031174832.6574-4-thuth@redhat.com> (raw)
In-Reply-To: <20241031174832.6574-1-thuth@redhat.com>
From: Daniel P. Berrangé <berrange@redhat.com>
This ensures that if a functional test runs QEMU with a writable
disk pointing to a cached asset, an error will be reported, rather
than silently modifying the cache file.
As an example, tweaking test_sbsaref.py to set snapshot=off,
results in a clear error:
Command: ./build/qemu-system-aarch64 ...snip... -drive file=/var/home/berrange/.cache/qemu/download/44cdbae275ef1bb6dab1d5fbb59473d4f741e1c8ea8a80fd9e906b531d6ad461,format=raw,snapshot=off -cpu max,pauth=off
Output: qemu-system-aarch64: Could not open '/var/home/berrange/.cache/qemu/download/44cdbae275ef1bb6dab1d5fbb59473d4f741e1c8ea8a80fd9e906b531d6ad461': Permission denied
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20241025092659.2312118-3-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/functional/qemu_test/asset.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/functional/qemu_test/asset.py b/tests/functional/qemu_test/asset.py
index e47bfac035..f126cd5863 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -8,6 +8,7 @@
import hashlib
import logging
import os
+import stat
import subprocess
import sys
import unittest
@@ -143,6 +144,8 @@ def fetch(self):
raise Exception("Hash of %s does not match %s" %
(self.url, self.hash))
tmp_cache_file.replace(self.cache_file)
+ # Remove write perms to stop tests accidentally modifying them
+ os.chmod(self.cache_file, stat.S_IRUSR | stat.S_IRGRP)
self.log.info("Cached %s at %s" % (self.url, self.cache_file))
return str(self.cache_file)
--
2.47.0
next prev parent reply other threads:[~2024-10-31 17:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 17:48 [PULL 00/14] Misc patches (functional tests, next-cube machine, ...) Thomas Huth
2024-10-31 17:48 ` [PULL 01/14] .gitlab-ci.d/cirrus: Remove the macos-15 job Thomas Huth
2024-10-31 17:48 ` [PULL 02/14] tests/functional: make tuxrun disk images writable Thomas Huth
2024-10-31 17:48 ` Thomas Huth [this message]
2024-10-31 17:48 ` [PULL 04/14] Revert "Remove the unused sh4eb target" Thomas Huth
2024-10-31 17:48 ` [PULL 05/14] tests/functional: Add a test for sh4eb Thomas Huth
2024-10-31 17:48 ` [PULL 06/14] tests/vm/openbsd: Remove the "Time appears wrong" workaround Thomas Huth
2024-10-31 17:48 ` [PULL 07/14] tests/functional: Fix the s390x and ppc64 tuxrun tests Thomas Huth
2024-10-31 17:48 ` [PULL 08/14] hw/s390x: Re-enable the pci-bridge device on s390x Thomas Huth
2024-10-31 17:48 ` [PULL 09/14] next-cube: fix up compilation when DEBUG_NEXT is enabled Thomas Huth
2024-10-31 17:48 ` [PULL 10/14] next-cube: remove cpu parameter from next_scsi_init() Thomas Huth
2024-10-31 17:48 ` [PULL 11/14] tests/functional: Convert the tcg_plugins test Thomas Huth
2024-10-31 17:48 ` [PULL 12/14] tests/functional: Convert BananaPi tests to the functional framework Thomas Huth
2024-11-01 19:07 ` Peter Maydell
2024-11-04 8:11 ` Thomas Huth
2024-10-31 17:48 ` [PULL 13/14] tests/functional: Convert the OrangePi " Thomas Huth
2024-10-31 17:48 ` [PULL 14/14] tests/functional: Convert the riscv_opensbi avocado test into a standalone test Thomas Huth
2024-11-04 12:31 ` [PULL 00/14] Misc patches (functional tests, next-cube machine, ...) Peter Maydell
2024-11-04 13:14 ` Thomas Huth
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=20241031174832.6574-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=berrange@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).