]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/functional: enable force refresh of cached assets
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 29 Aug 2025 14:26:14 +0000 (15:26 +0100)
committerThomas Huth <thuth@redhat.com>
Tue, 9 Sep 2025 07:57:51 +0000 (09:57 +0200)
If the 'QEMU_TEST_REFRESH_CACHE' environment variable is set, then
ignore any existing cached asset and download a fresh copy.

This can be used to selectively refresh assets if set before running
a single test script.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250829142616.2633254-2-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
docs/devel/testing/functional.rst
tests/functional/qemu_test/asset.py

index 3728bab6c0c4b0cbacd00744bdb5c1462c71d7a8..fdeaebaadcb990edaa82eddf429c8ccc2b7e4cb5 100644 (file)
@@ -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
 --------------
 
index 704b84d0ea6ef51945ef748074e8a0d0a989f815..b5a6136d365523c69cac129138c48f1f32af8f80 100644 (file)
@@ -72,6 +72,10 @@ class Asset:
         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
+
         return self.cache_file.exists() and self._check(self.cache_file)
 
     def fetchable(self):