1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

target: Use root in file_exists check

Use case: To check if a kernel supports function profiling we need to
check for the presence of
"/sys/kernel/debug/tracing/function_profiler_enabled", but
"/sys/kernel/debug/"'s permissions are 700.
This commit is contained in:
Brendan Jackman 2016-11-23 13:44:00 +00:00
parent 78ac92bd84
commit c1b5152790

View File

@ -362,7 +362,8 @@ class Target(object):
def file_exists(self, filepath):
command = 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi'
return boolean(self.execute(command.format(filepath)).strip())
output = self.execute(command.format(filepath), as_root=self.is_rooted)
return boolean(output.strip())
def directory_exists(self, filepath):
output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath))