[PATCH] D51648: [UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that it can run on devices.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 5 03:13:17 PDT 2018
delcypher updated this revision to Diff 164000.
delcypher added a comment.
Use `shell=True` mode of `subprocess.call(...)`.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D51648
Files:
test/sanitizer_common/ios_commands/iossim_run.py
test/ubsan/TestCases/Misc/log-path_test.cc
Index: test/ubsan/TestCases/Misc/log-path_test.cc
===================================================================
--- test/ubsan/TestCases/Misc/log-path_test.cc
+++ test/ubsan/TestCases/Misc/log-path_test.cc
@@ -12,11 +12,13 @@
// Good log_path.
// RUN: rm -f %t.log.*
+// RUN: %run rm -f '%t.log.*'
// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out
// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
// Run w/o errors should not produce any log.
// RUN: rm -f %t.log.*
+// RUN: %run rm -f '%t.log.*'
// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t 4
// RUN: not cat %t.log.*
Index: test/sanitizer_common/ios_commands/iossim_run.py
===================================================================
--- test/sanitizer_common/ios_commands/iossim_run.py
+++ test/sanitizer_common/ios_commands/iossim_run.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-import os, sys, subprocess
+import glob, os, pipes, sys, subprocess
if not "SANITIZER_IOSSIM_TEST_DEVICE_IDENTIFIER" in os.environ:
@@ -12,7 +12,25 @@
if e in os.environ:
os.environ["SIMCTL_CHILD_" + e] = os.environ[e]
-exitcode = subprocess.call(["xcrun", "simctl", "spawn", device_id] + sys.argv[1:])
+prog = sys.argv[1]
+exit_code = None
+if prog == 'rm':
+ # The simulator and host actually share the same file system so we can just
+ # execute directly on the host.
+ rm_args = []
+ for arg in sys.argv[2:]:
+ if '*' in arg or '?' in arg:
+ # Don't quote glob pattern
+ rm_args.append(arg)
+ else:
+ # FIXME(dliew): pipes.quote() is deprecated
+ rm_args.append(pipes.quote(arg))
+ rm_cmd_line = ["/bin/rm"] + rm_args
+ rm_cmd_line_str = ' '.join(rm_cmd_line)
+ # We use `shell=True` so that any wildcard globs get expanded by the shell.
+ exitcode = subprocess.call(rm_cmd_line_str, shell=True)
+else:
+ exitcode = subprocess.call(["xcrun", "simctl", "spawn", device_id] + sys.argv[1:])
if exitcode > 125:
exitcode = 126
sys.exit(exitcode)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51648.164000.patch
Type: text/x-patch
Size: 1990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180905/165f9832/attachment.bin>
More information about the llvm-commits
mailing list