Hello Vinay,

sure, no problem. I see that SSHControl.run() isn't designed for starting background processes on the target. But I still think it's then better to use subprocess module for starting the server over ssh, rather than bundle everything into one gigantic runCmd().

Alex

On Thu, 27 May 2021 at 14:18, Vinay Kumar <vinay.m.engg@gmail.com> wrote:
Hi Alex,

The reason why I changed this is, we have to execute
"remote-test-server" on the image through background ssh.
So that the "remote-test-server" will be alive waiting for connection.
Then in the rust.py  control passed to the next command (cmd) for
execution.
If we use the sshcontrol.py method we have to set a timeout of 600
otherwise default timeout is 300. Even if the test execution completes
early due to failure then we have to wait till this timeout.

I tried reducing the timeout to 60 seconds and some of the tests got skipped.

If that is ok I will use that copy_to and run from sshcontrol.py as we
did in v4 patches and work for the result.output

Regards,
Vinay

On Thu, May 27, 2021 at 5:33 PM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> On Thu, 27 May 2021 at 10:11, Vinay Kumar <vinay.m.engg@gmail.com> wrote:
>>
>> +                       # To kill remote-test-server executing through background ssh
>> +                       killcommand = "kill -9 \$(ps | grep remote-test-server |  grep -v \"grep\" | awk '{print \$1}')"
>> +                       cmd = cmd + "ssh %s root@%s \"%s\";" % (sshargs, qemu.ip, killcommand)
>
>
> I don't think you actually need to kill the remote test server. As qemu will be stopped anyway, and with it, all the processes that run inside qemu.
>
> Also, it's better to use cmd only to execute the tests. Starting the server is better done through SSHControl.run(), and copying the binary via SSHControl.copy_to() - see examples in selfttest's imagefeatures.py or runtime_test.py.
>
> Alex
>