On Sun, Jun 26, 2011 at 12:08 PM, Lucas Meneghel Rodrigues
<[email protected]> wrote:

>> +class TransparentHugePageConfig(object):
>> +    def __init__(self, test, params):
>> +        """
>> +        Find paths for transparent hugepages and kugepaged configuration. 
>> Also,
>> +        back up original host configuration so it can be restored during
>> +        cleanup.
>> +        """
>> +        def file_writeable(file_name):
>> +            """
>> +            Check if the file is writeable
>> +            """
>> +            o = utils.system_output("ls -l %s" % file_name)
>> +            if re.findall("w", o[0:10]):
>> +                return True
>> +            return False
>
> ^ This can be replaced with os.access (file_name, os.W_OK)

^ Ok, nevermind, this suggestion didn't quite work as I expected... So
in the final version of the code, we'll try to open the file for
writing, if an IOError arises, catch it. It's reliable, does the job
and we don't need to resort to an external program (in this case, ls).
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to