From 2ce4e51cfc5be4b4aeeae331f9accffad46e6e1b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 31 Jul 2022 17:46:34 +0300 Subject: tests: Only call execute() if the test is run directly Only run a test automatically if the Python test script is executed directly. This will allow importing tests as modules in a test runner. Signed-off-by: Laurent Pinchart --- tests/kms-test-allplanes.py | 4 +++- tests/kms-test-brxalloc.py | 4 +++- tests/kms-test-connectors.py | 3 ++- tests/kms-test-crc.py | 4 +++- tests/kms-test-formats.py | 4 +++- tests/kms-test-legacy-modeset.py | 4 +++- tests/kms-test-modes.py | 4 +++- tests/kms-test-modeset.py | 4 +++- tests/kms-test-pageflip.py | 4 +++- tests/kms-test-plane-alpha.py | 4 +++- tests/kms-test-plane-position.py | 4 +++- tests/kms-test-plane-zpos.py | 4 +++- tests/kms-test-routing.py | 3 ++- 13 files changed, 37 insertions(+), 13 deletions(-) diff --git a/tests/kms-test-allplanes.py b/tests/kms-test-allplanes.py index 96ac4f1..6a6f7e7 100755 --- a/tests/kms-test-allplanes.py +++ b/tests/kms-test-allplanes.py @@ -85,4 +85,6 @@ class AllPlanesTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -AllPlanesTest().execute() + +if __name__ == '__main__': + AllPlanesTest().execute() diff --git a/tests/kms-test-brxalloc.py b/tests/kms-test-brxalloc.py index c80d2e3..3ccd699 100755 --- a/tests/kms-test-brxalloc.py +++ b/tests/kms-test-brxalloc.py @@ -128,4 +128,6 @@ class BRxAllocTest(kmstest.KMSTest): self.atomic_crtc_disable(outputs[0].crtc) self.atomic_crtc_disable(outputs[1].crtc) -BRxAllocTest().execute() + +if __name__ == '__main__': + BRxAllocTest().execute() diff --git a/tests/kms-test-connectors.py b/tests/kms-test-connectors.py index d2ca636..fdbe8bd 100755 --- a/tests/kms-test-connectors.py +++ b/tests/kms-test-connectors.py @@ -27,4 +27,5 @@ class ConnectorsTest(kmstest.KMSTest): self.success() -ConnectorsTest().execute() +if __name__ == '__main__': + ConnectorsTest().execute() diff --git a/tests/kms-test-crc.py b/tests/kms-test-crc.py index 01f9606..b1af65d 100755 --- a/tests/kms-test-crc.py +++ b/tests/kms-test-crc.py @@ -230,4 +230,6 @@ class CRCTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -CRCTest().execute() + +if __name__ == '__main__': + CRCTest().execute() diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py index 5c3bfd4..afc5454 100755 --- a/tests/kms-test-formats.py +++ b/tests/kms-test-formats.py @@ -75,4 +75,6 @@ class FormatsTest(kmstest.KMSTest): else: self.success() -FormatsTest().execute() + +if __name__ == '__main__': + FormatsTest().execute() diff --git a/tests/kms-test-legacy-modeset.py b/tests/kms-test-legacy-modeset.py index 06ecead..4082093 100755 --- a/tests/kms-test-legacy-modeset.py +++ b/tests/kms-test-legacy-modeset.py @@ -59,4 +59,6 @@ class LegacyModeSetTest(kmstest.KMSTest): self.success() -LegacyModeSetTest().execute() + +if __name__ == '__main__': + LegacyModeSetTest().execute() diff --git a/tests/kms-test-modes.py b/tests/kms-test-modes.py index 14463ad..d857dd6 100755 --- a/tests/kms-test-modes.py +++ b/tests/kms-test-modes.py @@ -65,4 +65,6 @@ class ModesTest(kmstest.KMSTest): else: self.success() -ModesTest().execute() + +if __name__ == '__main__': + ModesTest().execute() diff --git a/tests/kms-test-modeset.py b/tests/kms-test-modeset.py index e8b3d9a..fd0c4ac 100755 --- a/tests/kms-test-modeset.py +++ b/tests/kms-test-modeset.py @@ -58,4 +58,6 @@ class ModeSetTest(kmstest.KMSTest): else: self.success() -ModeSetTest().execute() + +if __name__ == '__main__': + ModeSetTest().execute() diff --git a/tests/kms-test-pageflip.py b/tests/kms-test-pageflip.py index 14bea0a..1bb1214 100755 --- a/tests/kms-test-pageflip.py +++ b/tests/kms-test-pageflip.py @@ -118,4 +118,6 @@ class PageFlipTest(kmstest.KMSTest): f'({self.flips}/{frames} frames in {interval} s)') self.success() -PageFlipTest().execute() + +if __name__ == '__main__': + PageFlipTest().execute() diff --git a/tests/kms-test-plane-alpha.py b/tests/kms-test-plane-alpha.py index 8802bfe..894e4ab 100755 --- a/tests/kms-test-plane-alpha.py +++ b/tests/kms-test-plane-alpha.py @@ -94,4 +94,6 @@ class PlaneAlphaTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -PlaneAlphaTest().execute() + +if __name__ == '__main__': + PlaneAlphaTest().execute() diff --git a/tests/kms-test-plane-position.py b/tests/kms-test-plane-position.py index aceb849..5dfcfaa 100755 --- a/tests/kms-test-plane-position.py +++ b/tests/kms-test-plane-position.py @@ -123,4 +123,6 @@ class PlanePositionTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) self.success() -PlanePositionTest().execute() + +if __name__ == '__main__': + PlanePositionTest().execute() diff --git a/tests/kms-test-plane-zpos.py b/tests/kms-test-plane-zpos.py index 052eea5..d270088 100755 --- a/tests/kms-test-plane-zpos.py +++ b/tests/kms-test-plane-zpos.py @@ -99,4 +99,6 @@ class PlaneZPosTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -PlaneZPosTest().execute() + +if __name__ == '__main__': + PlaneZPosTest().execute() diff --git a/tests/kms-test-routing.py b/tests/kms-test-routing.py index 68aff9c..ccf61d8 100755 --- a/tests/kms-test-routing.py +++ b/tests/kms-test-routing.py @@ -141,4 +141,5 @@ class RoutingTest(kmstest.KMSTest): return allocated -RoutingTest().execute() +if __name__ == '__main__': + RoutingTest().execute() -- cgit v1.2.3