Re: [Fuego] Time sync

"Bird, Tim" <[email protected]> Thu, 21 Apr 2022 21:36:37 +0000
Newsgroups dev.linux.lists.fuego
Message-ID <BYAPR13MB2503796A5F331A94CA4E790DFDF49@BYAPR13MB2503.namprd13.prod.outlook.com>
> -----Original Message-----
> From: Fuego <[email protected]> On Behalf Of Muk An=
c
>=20
> Hello all,
> I am looking for some information about time syncing the fuego tests with=
 DUT logs. Our DUT has a RTC, but loses time info on every
> reboot. Is there a way I can set the time on the board from Fuego? This w=
ill help us generate timestamped logs on DUT and thus sync the
> board logs to the Fuego logs.

This is possible inside Fuego.

You can do something like this, from inside any test:

cmd "date $(date +%m%d%H%M%Y.%S)"

This will get the date from the host machine, and then executes date on the=
 DUT
using the resulting string.  If the DUT is using NTP or systemd's timesyncd=
, then
this might not work.  (But I presume that's not the case if the board doesn=
't
have the correct time on boot).

You can put this command at the end of the test_deploy() function in a fueg=
o_test.sh script,
or maybe at the beginning of the test_run() function.

This would cause the synchronization to happen for the test you put it in. =
 This will work
if you have a pre-determined set of tests.  You could add this line to=20
the first test your run after rebooting.  Or you could make a test specific=
ally to perform
this operation, and run it before other tests.

If you want to perform the time synchronization for every test, then there =
are ways to
add this to an overlay function, and trigger it using a special value for D=
ISTRIB in the
board file.

This is a bit complicated, but let me know if you'd like to do this, and I'=
ll write some
instructions.

I hope this helps.
 -- Tim