[dts] [PATCH 4/4] framework/dut: Adding exception in case ports_map is empty

Radoslaw Biernacki radoslaw.biernacki at linaro.org
Fri Dec 1 22:20:54 CET 2017

dut_prerequisites() warns with message that "ports_map cannot be
empty". If in fact it cannot be empty it should throw an exception.
Empty port map cause problems in most of the test anyway, so it is better to
crash hard than pushing on diging into the test to find the empty port map as
root cause.

Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki at linaro.org>
 framework/dut.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/framework/dut.py b/framework/dut.py
index ee5608b..bf4dc18 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -212,7 +212,8 @@ class Dut(Crb):
         for port_info in self.ports_info:
         if self.ports_map is None or len(self.ports_map) == 0:
-            self.logger.warning("ports_map should not be empty, please check all links")
+            self.logger.error("ports_map cannot not be empty, please check all links")
+            raise EnvironmentError("ports_map cannot be empty")
         # initialize virtualization resource pool
         self.virt_pool = VirtResource(self)

More information about the dts mailing list