[PATCH] D76899: Only add `darwin_log_cmd` lit shell test feature when the log can be queried.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 27 11:30:13 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG853a1e6942c8: Only add `darwin_log_cmd` lit shell test feature when the log can be queried. (authored by delcypher).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76899/new/
https://reviews.llvm.org/D76899
Files:
compiler-rt/test/lit.common.cfg.py
Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -534,7 +534,16 @@
config.default_sanitizer_opts += ['abort_on_error=0']
config.default_sanitizer_opts += ['log_to_syslog=0']
if lit.util.which('log'):
- config.available_features.add('darwin_log_cmd')
+ # Querying the log can only done by a privileged user so
+ # so check if we can query the log.
+ exit_code = -1
+ with open('/dev/null', 'r') as f:
+ # Run a `log show` command the should finish fairly quickly and produce very little output.
+ exit_code = subprocess.call(['log', 'show', '--last', '1m', '--predicate', '1 == 0'], stdout=f, stderr=f)
+ if exit_code == 0:
+ config.available_features.add('darwin_log_cmd')
+ else:
+ lit_config.warning('log command found but cannot queried')
else:
lit_config.warning('log command not found. Some tests will be skipped.')
elif config.android:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76899.253179.patch
Type: text/x-patch
Size: 1043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200327/b8a46a3b/attachment.bin>
More information about the llvm-commits
mailing list