Running unit test in embedded hardware target using Jenkins to report results

I want to automate a unit test in my board(running lunix), I want to use Jenkins to run this test in the target periodically . I m not that familiar with Jenkins but as I read I think it is doable, to create a Jenkins job that runs a unit-test.sh file in the hardware target and report results , maybe there is an ssh way from Jenkins! anyway I am trying to get some tips and helps to fulfill this topic.
thanks in advance.

If you can write a shell script to do it, you can do it from Jenkins. I would start there; create a shell script that does the ssh commands, etc., to run your test on the board. Then it will be easy to bring into Jenkins and run periodically.

1 Like

Ah you mean just I will need the shell script that does the job from terminal and after that integrating it into Jenkins and run it periodically is simple, right ?

That is correct, once you have a shell script that can do it, bringing it into Jenkins is easy.

1 Like

You might consider the SSH plugin to simplify the process even further. It does require you install java on the hardware target, but it means your pipeline can go directly to that device and run the unit tests without extra bash scripts.

1 Like

using ssh in the script failed! Got this error “Host key verification failed.”
below the debug info:

OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k  25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.xxx.xxx [192.168.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/jenkins/.ssh/id_rsa type -1
debug1: identity file /home/jenkins/.ssh/id_rsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_dsa type -1
debug1: identity file /home/jenkins/.ssh/id_dsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/jenkins/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ed25519 type 3
debug1: identity file /home/jenkins/.ssh/id_ed25519-cert type -1
debug1: identity file /home/jenkins/.ssh/id_ed25519_sk type -1
debug1: identity file /home/jenkins/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/jenkins/.ssh/id_xmss type -1
debug1: identity file /home/jenkins/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.0
debug1: match: OpenSSH_8.0 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.xxx.xxx:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:g6ZCEtl886IZn8mL87PSNpNPsksdCOVHfki0fcZFmYo
debug1: read_passphrase: can't open /dev/tty: No such device or address
Host key verification failed.
Build step 'Execute shell' marked build as failure
Finished: FAILURE

it looks interesting will give it a try as well.