Add ser_ctl to open close serial.
This to follow the PR: !1324
The last scenario for us to use docker-test-shell is:
E.g. We use uuu to burn the device, or use other flash/boot method to start the device for us, then these actions will open the serial port for us.
YES, some team need the serial output automatically print to job output, so we had the !1324 fix.
But some team will need full access serial port by their own script in docker-test-shell, e.g. our python uboot test. Leave the log in lava feedback connection just make them not easy to check log, and also leave useless pexpect process there to waste system resource, although they could use ser2net multiple-connection.
Meanwhile, there are some situation which not so easy to distinguish docker-test-shell namespace with other action which open the serial connection. For this scenario, feedback connection clear won't help.
So, for these situations, the thought here is:
Just let lava open the serial when needed, e.g. when boot action running. But before docker-test-shell starts, close the serial, let docker-test-shell control.
As any action may open the serial connection, so this MR use a separate ser-net action here to give full control to job writer to decide when to close/open serial port.
Sample job will like next:
actions:
- any_boot_action_open_serial
# close serial when you want to close it
- boot:
method: ser_ctl
timeout:
seconds: 60
- test:
docker:
image: xxx
# open serial when you need it
- boot:
method: ser_ctl
action: open
timeout:
seconds: 60
- test:
docker:
image: xxx
A more common explanation maybe next:
- boot1 -> ser_ctl -> docker
- boot2 -> ser_ctl -> docker
- boot1 -> ser_ctl -> lxc
- boot2 -> ser_ctl -> lxc
Let ser_ctl
act as a switch here.
Please have a look to see if it's ok? Thanks.