Skip to contentSkip to conversation

tests/avocado: Make fetch_asset() unconditionally require a crypto hash

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Nov 15, 2023 – Nov 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/avocado: Make fetch_asset() unconditionally require a crypto hash

In a perfect world we'd have reproducible tests, but then we'd be sure we run the same binaries. If a binary artifact isn't hashed, we have no idea what we are running. Therefore enforce hashing for all our artifacts.

With this change, unhashed artifacts produce:

  $ avocado run tests/avocado/multiprocess.py
   (1/2) tests/avocado/multiprocess.py:Multiprocess.test_multiprocess_x86_64:
   ERROR: QemuBaseTest.fetch_asset() missing 1 required positional argument: 'asset_hash' (0.19 s)

---
Based-on: <[email protected]>
"tests/avocado/multiprocess: Add asset hashes to silence warnings"
Based-on: <[email protected]>
"tests/avocado/intel_iommu: Add asset hashes to avoid warnings"
Supersedes: <[email protected]>

v2: Fixed type in subject (Alex)

---
 tests/avocado/avocado_qemu/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/avocado_qemu/__init__.py +1 -1
index d71e989db6..304c428168 100644
@@ -254,7 +254,7 @@ def setUp(self, bin_prefix):
             self.cancel("No QEMU binary defined or found in the build tree")
 
     def fetch_asset(self, name,
-                    asset_hash=None, algorithm=None,
+                    asset_hash, algorithm=None,
                     locations=None, expire=None,
                     find_only=False, cancel_on_missing=True):
         return super().fetch_asset(name,
Signature · 1 line
2.41.0
#1 lore raw
Quoted 33 lines · Philippe Mathieu-Daudé

In a perfect world we'd have reproducible tests, but then we'd be sure we run the same binaries. If a binary artifact isn't hashed, we have no idea what we are running. Therefore enforce hashing for all our artifacts.

With this change, unhashed artifacts produce:

   $ avocado run tests/avocado/multiprocess.py
    (1/2) tests/avocado/multiprocess.py:Multiprocess.test_multiprocess_x86_64:
    ERROR: QemuBaseTest.fetch_asset() missing 1 required positional argument: 'asset_hash' (0.19 s)

---
Based-on: <[email protected]>
"tests/avocado/multiprocess: Add asset hashes to silence warnings"
Based-on: <[email protected]>
"tests/avocado/intel_iommu: Add asset hashes to avoid warnings"
Supersedes: <[email protected]>

v2: Fixed type in subject (Alex)

---
  tests/avocado/avocado_qemu/__init__.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/avocado/avocado_qemu/__init__.py +0 -0
index d71e989db6..304c428168 100644

tests/avocado/avocado_qemu/__init__.py def setUp(self, bin_prefix): · line 260

Quoted 8 lines
tests/avocado/avocado_qemu/__init__.py +1 -1
@@ -254,7 +254,7 @@ def setUp(self, bin_prefix):
              self.cancel("No QEMU binary defined or found in the build tree")
 
      def fetch_asset(self, name,
-                    asset_hash=None, algorithm=None,
+                    asset_hash, algorithm=None,
                      locations=None, expire=None,
                      find_only=False, cancel_on_missing=True):
          return super().fetch_asset(name,

Thanks, queued it now!

Thomas