Skip to contentSkip to conversation

tests/functional: Convert Aarch64 SBSA-Ref avocado tests

PATCH Superseded Philippe Mathieu-Daudé 3 participants 10 messages Aug 22, 2024 – Aug 23, 2024 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/functional: Convert Aarch64 SBSA-Ref avocado tests

Straight forward conversion. Since SBSA_FLASH files are not tarballs, use lzma_uncompress() method.

---
Based-on: <[email protected]>

---
 MAINTAINERS                                   |   2 +-
 tests/functional/meson.build                  |   5 +
 .../test_aarch64_sbsaref.py}                  | 144 ++++++------------
 3 files changed, 55 insertions(+), 96 deletions(-)
 rename tests/{avocado/machine_aarch64_sbsaref.py => functional/test_aarch64_sbsaref.py} (56%)
 mode change 100644 => 100755
MAINTAINERS +1 -1
index 91e5b061bf..c720c02800 100644
@@ -971,7 +971,7 @@ F: hw/misc/sbsa_ec.c
 F: hw/watchdog/sbsa_gwdt.c
 F: include/hw/watchdog/sbsa_gwdt.h
 F: docs/system/arm/sbsa.rst
-F: tests/avocado/machine_aarch64_sbsaref.py
+F: tests/functional/test_aarch64_sbsaref.py
 
 Sharp SL-5500 (Collie) PDA
 M: Peter Maydell <[email protected]>
tests/functional/meson.build +5 -0
index f1fce045fc..2445239a5c 100644
@@ -11,6 +11,7 @@ endif
 
 # Timeouts for individual tests that can be slow e.g. with debugging enabled
 test_timeouts = {
+  'aarch64_sbsaref' : 180,
   'acpi_bits' : 240,
   'netdev_ethtool' : 180,
   'ppc_40p' : 240,
@@ -26,6 +27,10 @@ tests_generic = [
   'version',
 ]
 
+tests_aarch64_thorough = [
+  'aarch64_sbsaref',
+]
+
 tests_arm_thorough = [
   'arm_canona1100',
   'arm_integratorcp',
tests/functional/test_aarch64_sbsaref.py renamed from tests/avocado/machine_aarch64_sbsaref.py +49 -95

242 lines not on this page · raw message

Signature · 1 line
2.45.2
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

Straight forward conversion. Since SBSA_FLASH files are not tarballs, use lzma_uncompress() method.

---
Based-on: <[email protected]>

Quoted 7 lines
---
  MAINTAINERS                                   |   2 +-
  tests/functional/meson.build                  |   5 +
  .../test_aarch64_sbsaref.py}                  | 144 ++++++------------
  3 files changed, 55 insertions(+), 96 deletions(-)

rename tests/{avocado/machine_aarch64_sbsaref.py => functional/test_aarch64_sbsaref.py} (56%) mode change 100644 => 100755

Thanks for your help with the conversions!

#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 3 lines · Philippe Mathieu-Daudé

# Timeouts for individual tests that can be slow e.g. with debugging enabled test_timeouts = {
+ 'aarch64_sbsaref' : 180,

What kind of machine is able to run those tests in 180s? I bumped them to 2400s and got timeout (Macbook with M1 Pro).

"make check-avocado" (with some AVOCADO_* vars to limit list of tests) shown me which test is run and pass/fail for each.

"make check-functional-aarch64 V=1" shows me "1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref" and timeouts without information which tests pass, which fail.

Maybe for QEMU project this is a progress. For me it is moving tests from working ones to "sorry, timeout, find out why" ones.

#3 lore raw
Quoted 10 lines · Marcin Juszkiewicz
Quoted 3 lines · Philippe Mathieu-Daudé

  # Timeouts for individual tests that can be slow e.g. with debugging enabled test_timeouts = {
+  'aarch64_sbsaref' : 180,

What kind of machine is able to run those tests in 180s? I bumped them to 2400s and got timeout (Macbook with M1 Pro).

"make check-avocado" (with some AVOCADO_* vars to limit list of tests) shown me which test is run and pass/fail for each.

"make check-functional-aarch64 V=1" shows me "1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref" and timeouts without information which tests pass, which fail.

Try running "make check-functional V=1" ... it should show you the individual subtests, so you hopefully can conclude from the tests that succeeded to the one that was hanging.

Thomas

#4 lore raw
In reply to Marcin Juszkiewicz
Quoted 5 lines · Marcin Juszkiewicz
Quoted 3 lines · Philippe Mathieu-Daudé

  # Timeouts for individual tests that can be slow e.g. with debugging enabled test_timeouts = {
+  'aarch64_sbsaref' : 180,

Quoted 7 lines

What kind of machine is able to run those tests in 180s? I bumped them to 2400s and got timeout (Macbook with M1 Pro).

"make check-avocado" (with some AVOCADO_* vars to limit list of tests) shown me which test is run and pass/fail for each.

"make check-functional-aarch64 V=1" shows me "1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref" and timeouts without information which tests pass, which fail.

Maybe for QEMU project this is a progress. For me it is moving tests from working ones to "sorry, timeout, find out why" ones.

Sorry for the annoyance of switching from one framework to another one :/ Are you using Linux on your Macbook with M1 Pro? I'm using macOS and these tests currently don't work, so for me this is a huge win.

Most of the (long) time was spent in downloading the assets.

IIUC there is a way to pre-download without using the test timer (apparently Richard and Daniel use it) but I haven't found the way yet.

I'll check with Thomas how to tune these timeouts and return back to you.

Regards,

Phil.

#5 lore raw
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 5 lines · Marcin Juszkiewicz
Quoted 3 lines · Philippe Mathieu-Daudé

  # Timeouts for individual tests that can be slow e.g. with debugging enabled test_timeouts = {
+  'aarch64_sbsaref' : 180,

Quoted 7 lines

What kind of machine is able to run those tests in 180s? I bumped them to 2400s and got timeout (Macbook with M1 Pro).

"make check-avocado" (with some AVOCADO_* vars to limit list of tests) shown me which test is run and pass/fail for each.

"make check-functional-aarch64 V=1" shows me "1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref" and timeouts without information which tests pass, which fail.

Maybe for QEMU project this is a progress. For me it is moving tests from working ones to "sorry, timeout, find out why" ones.

Sorry for the annoyance of switching from one framework to another one :/ Are you using Linux on your Macbook with M1 Pro? I'm using macOS and these tests currently don't work, so for me this is a huge win.

Quoted 5 lines

Most of the (long) time was spent in downloading the assets.

IIUC there is a way to pre-download without using the test timer (apparently Richard and Daniel use it) but I haven't found the way yet.

It's done automatically when you run "make check-functional" ... but I think it might get skipped if you run "make check-functional-<target>".

Anyway, you can do the precaching manually by running:

make precache-functional

HTH,
Thomas

#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 3 lines · Philippe Mathieu-Daudé
Quoted 1 line · Marcin Juszkiewicz

Maybe for QEMU project this is a progress. For me it is moving tests from working ones to "sorry, timeout, find out why" ones.

OK, problem was found (check my previous mail). Tests took 222s on Macbook with M1 Pro. Not looked yet how to enable skipped ones.

▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_cortex_a57 OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max SKIP
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max_pauth_impdef OK

▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max_pauth_off    OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_neoverse_n1      OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_edk2_firmware                 OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_cortex_a57          OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max                 SKIP
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max_pauth_impdef    SKIP
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max_pauth_off       OK
▶ 1/4 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_neoverse_n1         OK

1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref OK 222.88s 8 subtests passed

Quoted 2 lines

Sorry for the annoyance of switching from one framework to another one :/

Project wants to change framework so I am not against it. Just asking questions.

Quoted 3 lines

Are you using Linux on your Macbook with M1 Pro? I'm using macOS and these tests currently don't work, so for me this is a huge win.

I am using Fedora Asahi Remix on this Macbook for over a year. Total use of MacOS was probably a few hours total (including waiting for MacOS updates to fetch).

#7 lore raw
In reply to Marcin Juszkiewicz
Quoted 6 lines · Marcin Juszkiewicz
Quoted 3 lines · Philippe Mathieu-Daudé

  # Timeouts for individual tests that can be slow e.g. with debugging enabled test_timeouts = {
+  'aarch64_sbsaref' : 180,

What kind of machine is able to run those tests in 180s? I bumped them to 2400s and got timeout (Macbook with M1 Pro).

Indeed with Avocado this timeout was per test function, now it is per test class. Having 11 test functions, for a 1-1 change we'd need 180 * 11 = 1980 seconds.

I made a comment on Thomas/Daniel's series this patch is based on:
https://lore.kernel.org/qemu-devel/[email protected]/

I could run all the tests in <300sec but for safety, should I keep Avocado equivalent and use 2000s?

▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max_pauth_impdef OK ▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_max_pauth_off
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_alpine_linux_neoverse_n1
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_edk2_firmware
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_cortex_a57
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max_pauth_impdef
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_max_pauth_off
OK
▶ 1/5 test_aarch64_sbsaref.Aarch64SbsarefMachine.test_sbsaref_openbsd73_neoverse_n1
OK
1/5 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref OK 241.79s 11 subtests passed

Quoted 5 lines

"make check-avocado" (with some AVOCADO_* vars to limit list of tests) shown me which test is run and pass/fail for each.

"make check-functional-aarch64 V=1" shows me "1/4 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_sbsaref" and timeouts without information which tests pass, which fail.

Maybe for QEMU project this is a progress. For me it is moving tests from working ones to "sorry, timeout, find out why" ones.

#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 34 lines · Philippe Mathieu-Daudé

Straight forward conversion. Since SBSA_FLASH files are not tarballs, use lzma_uncompress() method.

---
Based-on: <[email protected]>
---

tests/functional/test_aarch64_sbsaref.py renamed from tests/avocado/machine_aarch64_sbsaref.py +2 -8
old mode 100644
new mode 100755
similarity index 56%
rename from tests/avocado/machine_aarch64_sbsaref.py
rename to tests/functional/test_aarch64_sbsaref.py
index f8bf40c192..6728e5f92a
@@ -44,47 +55,31 @@ def fetch_firmware(self):
          """
 
          # Secure BootRom (TF-A code)
-        fs0_xz_url = (
-            "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/"
-            "20240619-148232/edk2/SBSA_FLASH0.fd.xz"
-        )
-        fs0_xz_hash = "0c954842a590988f526984de22e21ae0ab9cb351a0c99a8a58e928f0c7359cf7"
-        tar_xz_path = self.fetch_asset(fs0_xz_url, asset_hash=fs0_xz_hash,
-                                      algorithm='sha256')
-        archive.extract(tar_xz_path, self.workdir)
+        fs0_xz_path = self.ASSET_FLASH0.fetch()
          fs0_path = os.path.join(self.workdir, "SBSA_FLASH0.fd")
+        lzma_uncompress(fs0_xz_path, fs0_path)
 

tests/functional/test_aarch64_sbsaref.py def fetch_firmware(self): · line 63

Quoted 10 lines
tests/functional/test_aarch64_sbsaref.py renamed from tests/avocado/machine_aarch64_sbsaref.py +1 -8
          # Non-secure rom (UEFI and EFI variables)
-        fs1_xz_url = (
-            "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/"
-            "20240619-148232/edk2/SBSA_FLASH1.fd.xz"
-        )
-        fs1_xz_hash = "c6ec39374c4d79bb9e9cdeeb6db44732d90bb4a334cec92002b3f4b9cac4b5ee"
-        tar_xz_path = self.fetch_asset(fs1_xz_url, asset_hash=fs1_xz_hash,
-                                      algorithm='sha256')
-        archive.extract(tar_xz_path, self.workdir)
+        fs1_xz_path = self.ASSET_FLASH0.fetch()

Here you want ASSET_FLASH1 not ASSET_FLASH0. That's why it timed out - system was hanging on exit from TF-A to EDK2.

Quoted 2 lines
tests/functional/test_aarch64_sbsaref.py renamed from tests/avocado/machine_aarch64_sbsaref.py +1 -0
          fs1_path = os.path.join(self.workdir, "SBSA_FLASH1.fd")
+        lzma_uncompress(fs1_xz_path, fs1_path)
#9 lore raw
Quoted 43 lines · Marcin Juszkiewicz
Quoted 42 lines · Philippe Mathieu-Daudé

Straight forward conversion. Since SBSA_FLASH files are not tarballs, use lzma_uncompress() method.

---
Based-on: <[email protected]>
---

tests/functional/test_aarch64_sbsaref.py renamed from tests/avocado/machine_aarch64_sbsaref.py +0 -0
old mode 100644
new mode 100755
similarity index 56%
rename from tests/avocado/machine_aarch64_sbsaref.py
rename to tests/functional/test_aarch64_sbsaref.py
index f8bf40c192..6728e5f92a
@@ -44,47 +55,31 @@ def fetch_firmware(self):

          """
          # Secure BootRom (TF-A code)
-        fs0_xz_url = (
- "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/" -            "20240619-148232/edk2/SBSA_FLASH0.fd.xz"
-        )
-        fs0_xz_hash = "0c954842a590988f526984de22e21ae0ab9cb351a0c99a8a58e928f0c7359cf7" -        tar_xz_path = self.fetch_asset(fs0_xz_url, asset_hash=fs0_xz_hash,
-                                      algorithm='sha256') -        archive.extract(tar_xz_path, self.workdir)
+        fs0_xz_path = self.ASSET_FLASH0.fetch() fs0_path = os.path.join(self.workdir, "SBSA_FLASH0.fd") +        lzma_uncompress(fs0_xz_path, fs0_path)
          # Non-secure rom (UEFI and EFI variables)
-        fs1_xz_url = (
- "https://artifacts.codelinaro.org/artifactory/linaro-419-sbsa-ref/" -            "20240619-148232/edk2/SBSA_FLASH1.fd.xz"
-        )
-        fs1_xz_hash =

Quoted 8 lines
Quoted 6 lines

"c6ec39374c4d79bb9e9cdeeb6db44732d90bb4a334cec92002b3f4b9cac4b5ee" -        tar_xz_path = self.fetch_asset(fs1_xz_url, asset_hash=fs1_xz_hash,
-                                      algorithm='sha256') -        archive.extract(tar_xz_path, self.workdir)
+        fs1_xz_path = self.ASSET_FLASH0.fetch()

Here you want ASSET_FLASH1 not ASSET_FLASH0. That's why it timed out - system was hanging on exit from TF-A to EDK2.

Oops... Thanks you for debugging / noticing this!

Quoted 4 lines
Quoted 3 lines

          fs1_path = os.path.join(self.workdir, "SBSA_FLASH1.fd") +        lzma_uncompress(fs1_xz_path, fs1_path)