On 8/24/2026 10:55 AM, Matthew Rosato wrote:
On 8/12/26 11:21 AM, Joshua Daley wrote:
Split test_s390x_secure_ipl() into two subtests. Each tests with a
different boot device: virtio-blk-ccw or virtio-blk-pci. Use a state var
such that the setup is run only once.

[...]

+
+    @skipBigDataTest()
+    def test_s390x_secure_ipl_ccw(self):
+        """Test secure IPL with a virtio-blk-ccw boot device."""
+        self.require_accelerator('kvm')
+        if not self.setup_done:
+            self.setup_s390x_secure_ipl()

AFAICT this setup_done check won't do anything.

If I run this file I will enter setup twice, once for
test_secure_ipl.S390xSecureIpl.test_s390x_secure_ipl_ccw
and again for
test_secure_ipl.S390xSecureIpl.test_s390x_secure_ipl_pci

I think it's because each test will run with it's own instance of the class.

You're correct, good catch.

+        self.verify_s390x_secure_ipl('ccw')
+
+    @skipBigDataTest()
+    def test_s390x_secure_ipl_pci(self):
+        """Test secure IPL with a virtio-blk-pci boot device."""
+        self.require_accelerator('kvm')
+        if not self.setup_done:
+            self.setup_s390x_secure_ipl()

Same

Unless this is really time consuming, I think the simple answer is to
just let the setup run twice and don't try to share between the 2 instances?

Thanks,
Matt

The setup is time consuming compared to the verification step. On my machine, 
the entire test takes about 120s, and about 90% of that is setup.

A simple solution is to scrap the subtest idea and just have:

@skipBigDataTest()
def test_s390x_secure_ipl(self):
    self.require_accelerator('kvm')
    self.setup_s390x_secure_ipl()
    self.verify_s390x_secure_ipl('ccw')
    self.verify_s390x_secure_ipl('pci')

But if we value separating the ccw and pci cases into separate subtests, I have 
a solution using setUpClass() and class-level vars to run the setup only once. 
It just makes the code a bit uglier. I'll proceed with it for v2, unless other 
opinions arise.

Thanks.

Reply via email to