[cfe-commits] r105177 - /cfe/trunk/utils/FuzzTest

Daniel Dunbar daniel at zuster.org
Sun May 30 15:27:55 PDT 2010


Author: ddunbar
Date: Sun May 30 17:27:55 2010
New Revision: 105177

URL: http://llvm.org/viewvc/llvm-project?rev=105177&view=rev
Log:
FuzzTest: Add support for reading list of replacements from a file.

Modified:
    cfe/trunk/utils/FuzzTest

Modified: cfe/trunk/utils/FuzzTest
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/FuzzTest?rev=105177&r1=105176&r2=105177&view=diff
==============================================================================
--- cfe/trunk/utils/FuzzTest (original)
+++ cfe/trunk/utils/FuzzTest Sun May 30 17:27:55 2010
@@ -233,6 +233,9 @@
     group.add_option("", "--replacement-string", dest="replacement_strings",
                      action="append", help="Add a replacement string to use",
                      default=[])
+    group.add_option("", "--replacement-list", dest="replacement_lists",
+                     help="Add a list of replacement strings (one per line)",
+                     action="append", default=[])
     group.add_option("", "--no-delete", help="Don't delete characters",
                      action='store_false', dest="enable_delete", default=True)
     group.add_option("", "--no-insert", help="Don't insert strings",
@@ -291,6 +294,19 @@
     # Get the list if insert/replacement strings.
     replacements = list(opts.replacement_chars)
     replacements.extend(opts.replacement_strings)
+    for replacement_list in opts.replacement_lists:
+        f = open(replacement_list)
+        try:
+            for ln in f:
+                ln = ln[:-1]
+                if ln:
+                    replacements.append(ln)
+        finally:
+            f.close()
+
+    # Unique and order the replacement list.
+    replacements = list(set(replacements))
+    replacements.sort()
 
     # Create the test generator.
     tg = TestGenerator(input_files, opts.enable_delete, opts.enable_insert,





More information about the cfe-commits mailing list