[PATCH] [Sanitizers Coverage] Make sancov.py work with wildcards from Windows CMD shell

Timur Iskhodzhanov timurrrr at google.com
Tue Mar 31 09:14:13 PDT 2015


Hi kcc,

CMD doesn't expand * in command lines, so we have to do it ourselves.

http://reviews.llvm.org/D8724

Files:
  lib/sanitizer_common/scripts/sancov.py

Index: lib/sanitizer_common/scripts/sancov.py
===================================================================
--- lib/sanitizer_common/scripts/sancov.py
+++ lib/sanitizer_common/scripts/sancov.py
@@ -4,10 +4,11 @@
 # We need to merge these integers into a set and then
 # either print them (as hex) or dump them into another file.
 import array
-import struct
-import sys
 import bisect
+import glob
 import os.path
+import struct
+import sys
 
 prog_name = ""
 
@@ -181,13 +182,22 @@
   if len(sys.argv) <= 2:
     Usage();
 
+  file_list = []
+  for f in sys.argv[2:]:
+    if f.find("*") != -1:
+      file_list += glob.glob(f)
+    else:
+      file_list.append(f)
+  if not file_list:
+    Usage()
+
   if sys.argv[1] == "print":
-    PrintFiles(sys.argv[2:])
+    PrintFiles(file_list, bits)
   elif sys.argv[1] == "merge":
-    MergeAndPrint(sys.argv[2:])
+    MergeAndPrint(file_list, bits)
   elif sys.argv[1] == "unpack":
-    Unpack(sys.argv[2:])
+    Unpack(file_list)
   elif sys.argv[1] == "rawunpack":
-    RawUnpack(sys.argv[2:])
+    RawUnpack(file_list, bits)
   else:
     Usage()

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8724.22965.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150331/c2970ef6/attachment.bin>


More information about the llvm-commits mailing list