mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 05:30:44 +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:
parent
78ac92bd84
commit
c1b5152790
@ -362,7 +362,8 @@ class Target(object):
|
|||||||
|
|
||||||
def file_exists(self, filepath):
|
def file_exists(self, filepath):
|
||||||
command = 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi'
|
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):
|
def directory_exists(self, filepath):
|
||||||
output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath))
|
output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user