canonical / testflinger

https://testflinger.readthedocs.io/en/latest/
GNU General Public License v3.0
12 stars 20 forks source link

chore(muxpi): Move storage plugging to context manager #342

Closed thp-canonical closed 2 months ago

thp-canonical commented 2 months ago

Description

This moves the code for temporarily mounting the storage device on the host running the device connector to a single function, centralizing the stm and zapper sdwire / zapper typecmux commands for easy discovery. Ideally in the future, this feature should be provided to the test code in a generic way, so that test code can work without having to know whether SD, USB or the "stm" method is used for deployment.

Resolved issues

This is a first step to making it possible for test scripts to mount the SD card / USB storage device back to the agent for inspection in a test case.

Documentation

This should keep the behavior the same, with the exception that due to the finally: blocks in the context manager, the storage device is returned to the DUT even if an exception is thrown in the code that flashes the image to the device. This is different to what happened before (exception is thrown, and stm -dut, zapper sdwire set DUT, zapper typecmux set DUT were never called). It might be desireable that we don't re-attach the storage back to the DUT in these cases. In this case, just the try..finally would need to be removed.

Web service API changes

None.

Tests

Not tested.