On 29/08/2025 11.04, Daniel P. Berrangé wrote:
On Fri, Aug 29, 2025 at 10:50:41AM +0200, Thomas Huth wrote:
On 29/08/2025 10.31, Daniel P. Berrangé wrote:
If the 'QEMU_TEST_REFRESH_CACHE' environment variable is set, then
ignore any existing cached asset and download a fresh copy.

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
   docs/devel/testing/functional.rst   | 3 +++
   tests/functional/qemu_test/asset.py | 4 ++++
   2 files changed, 7 insertions(+)

diff --git a/docs/devel/testing/functional.rst 
b/docs/devel/testing/functional.rst
index 3728bab6c0..fdeaebaadc 100644
--- a/docs/devel/testing/functional.rst
+++ b/docs/devel/testing/functional.rst
@@ -312,6 +312,9 @@ The cache is populated in the ``~/.cache/qemu/download`` 
directory by
   default, but the location can be changed by setting the
   ``QEMU_TEST_CACHE_DIR`` environment variable.
+To force the test suite to re-download the cache, even if still valid,
+set the ``QEMU_TEST_REFRESH_CACHE`` environment variable.
+
   Skipping tests
   --------------
diff --git a/tests/functional/qemu_test/asset.py 
b/tests/functional/qemu_test/asset.py
index 704b84d0ea..b5a6136d36 100644
--- a/tests/functional/qemu_test/asset.py
+++ b/tests/functional/qemu_test/asset.py
@@ -72,6 +72,10 @@ def _check(self, cache_file):
           return self.hash == hl.hexdigest()
       def valid(self):
+        if os.getenv("QEMU_TEST_REFRESH_CACHE", None) is not None:
+            self.log.info("Force refresh of asset %s", self.url)
+            return False
+

Do we really need this? You can also simply "rm ~/.cache/qemu/downloads"
instead, or click on the "Clear runner caches" in the gitlab CI.

This can selectively refresh assets from a single test

   QEMU_TEST_REFRESH_CACHE=1 ./tests/functional/test_blah.py

Ok, fair point.

Reviewed-by: Thomas Huth <th...@redhat.com>


Reply via email to