Lucas Meneghel Rodrigues wrote: > Set LANG=C to make sure the output of hwclock will have > the same output in all tested systems, regardless of their > language settings. > > Thanks to Jason Wang, who spotted the the problem, and for > Gregory Smith and John Admanski, who pointed out the solution. > > Changes from v1 > * Removed the initialization method altogether > * Used LC_ALL instead of LANG > * Exported LC_ALL right before the verification command is > executed so we don't have to globally mess up with > the environment variables. > > Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> > --- > client/tests/hwclock/hwclock.py | 18 ++++++++++++++---- > 1 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/client/tests/hwclock/hwclock.py b/client/tests/hwclock/hwclock.py > index 12f8c54..0ee63d1 100644 > --- a/client/tests/hwclock/hwclock.py > +++ b/client/tests/hwclock/hwclock.py > @@ -1,16 +1,26 @@ > from autotest_lib.client.bin import test, utils > from autotest_lib.client.common_lib import error > -import re > +import re, os, logging > > class hwclock(test.test): > version = 1 > > - def run_once(self, seconds=1): > + def run_once(self): > + """ > + Set hwclock back to a date in 1980 and verify if the changes took > + effect in the system. > + """ > + logging.info('Setting hwclock to 2/2/80 03:04:00') > utils.system('/sbin/hwclock --set --date "2/2/80 03:04:00"') > - date = utils.system_output('/sbin/hwclock') > + date = utils.system_output('export LC_ALL=C; /sbin/hwclock') > I think maybe "LC_ALL=C /sbin/hwclock" is enough. > if not re.match('Sat *Feb *2 *03:04:.. 1980', date): > - raise error.TestFail('Failed to set hwclock back to the > eighties') > + raise error.TestFail("Failed to set hwclock back to the > eighties. " > + "Output of hwclock is '%s'" % date) > > > def cleanup(self): > + """ > + Restore hardware clock to current system time. > + """ > + logging.info('Restoring the hardware clock') > utils.system('/sbin/hwclock --systohc --noadjfile --utc') >
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
