On Tue, Feb 2, 2010 at 9:52 AM, Martin Bligh <[email protected]> wrote:
> On Tue, Feb 2, 2010 at 9:44 AM, Darin Petkov <[email protected]> wrote: > > > > > > On Tue, Feb 2, 2010 at 9:31 AM, Martin Bligh <[email protected]> wrote: > >> > >> + if utils.system('echo %s > /sys/power/state' % state) != 0: > >> + raise error.TestError('Unable to set power state to ' + state) > >> > >> That looks odd. If you're looking for a non-zero exit code, it'll throw > >> an exception from utils.system? > > > > So do a bunch of other utilities in base_utils.py -- e.g. get_cpu_family, > > get_cpu_vendor, ping_default_gateway... We can certainly do something > > different for these routines, of course. > > Those look different to me, it's not general error checking. > ping_default_gateway > is close, but it's trying to turn a success or failure into a return code. > > As is, the code will never hit the != 0 check because it'll throw an > exception > in system (well, from run inside system) > Ah, you're right -- the strange default for utils.system's ignore_status. > I'd think the code in the patch would be either just: > > utils.write_one_line('/sys/power/state', state) > Yes, will changed to that. Darin > > and you'll get the default exceptions or: > > try: > utils.write_one_line('/sys/power/state', state) > except: > raise error.TestError('Unable to set power state to ' + state) >
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
