summaryrefslogtreecommitdiff
path: root/utils/update_test_checks.py
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-04-05 18:00:47 +0000
committerSanjay Patel <spatel@rotateright.com>2016-04-05 18:00:47 +0000
commitd8f98f3e4e5120d8f963bf3f9ba54bf9f2309b23 (patch)
treeb74ce1ca71a179c9ccb480fc59ffc5559a0cd5cc /utils/update_test_checks.py
parent037ba978f58e7c2a12e347f0d928a439d0647983 (diff)
add example usage and workflow to --help output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/update_test_checks.py')
-rwxr-xr-xutils/update_test_checks.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/utils/update_test_checks.py b/utils/update_test_checks.py
index 9458273a595..3a5e388e508 100755
--- a/utils/update_test_checks.py
+++ b/utils/update_test_checks.py
@@ -1,10 +1,32 @@
#!/usr/bin/env python2.7
-"""A test case update script.
+"""A script to generate FileCheck statements for regression tests.
This script is a utility to update LLVM opt or llc test cases with new
FileCheck patterns. It can either update all of the tests in the file or
a single test function.
+
+Example usage:
+$ update_test_checks.py --tool=../bin/opt test/foo.ll
+
+Workflow:
+1. Make a compiler patch that requires updating some number of FileCheck lines
+ in regression test files.
+2. Save the patch and revert it from your local work area.
+3. Update the RUN-lines in the affected regression tests to look canonical.
+ Example: "; RUN: opt < %s -instcombine -S | FileCheck %s"
+4. Refresh the FileCheck lines for either the entire file or select functions by
+ running this script.
+5. Commit the fresh baseline of checks.
+6. Apply your patch from step 1 and rebuild your local binaries.
+7. Re-run this script on affected regression tests.
+8. Check the diffs to ensure the script has done something reasonable.
+9. Submit a patch including the regression test diffs for review.
+
+A common pattern is to have the script insert complete checking of every
+instruction. Then, edit it down to only check the relevant instructions.
+The script is designed to make adding checks to a test case fast, it is *not*
+designed to be authoratitive about what constitutes a good test!
"""
import argparse
@@ -242,7 +264,8 @@ def should_add_line_to_output(input_line, prefix_set):
def main():
- parser = argparse.ArgumentParser(description=__doc__)
+ from argparse import RawTextHelpFormatter
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=RawTextHelpFormatter)
parser.add_argument('-v', '--verbose', action='store_true',
help='Show verbose output')
parser.add_argument('--tool-binary', default='llc',