|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""Calls C-Reduce to create a minimal reproducer for clang crashes. |
3 | | -Unknown arguments are treated at creduce options. |
| 2 | +"""Calls reduction tools to create minimal reproducers for clang crashes. |
| 3 | +
|
| 4 | +Unknown arguments are treated at cvise/creduce options. |
4 | 5 |
|
5 | 6 | Output files: |
6 | 7 | *.reduced.sh -- crash reproducer with minimal arguments |
7 | 8 | *.reduced.cpp -- the reduced file |
8 | | - *.test.sh -- interestingness test for C-Reduce |
| 9 | + *.test.sh -- interestingness test for C-Vise |
9 | 10 | """ |
10 | 11 |
|
11 | 12 | from argparse import ArgumentParser, RawTextHelpFormatter |
@@ -311,7 +312,7 @@ def try_remove_arg_by_index(self, args, index): |
311 | 312 | return args, index + 1 |
312 | 313 |
|
313 | 314 | def simplify_clang_args(self): |
314 | | - """Simplify clang arguments before running C-Reduce to reduce the time the |
| 315 | + """Simplify clang arguments before running C-Vise to reduce the time the |
315 | 316 | interestingness test takes to run. |
316 | 317 | """ |
317 | 318 | print("\nSimplifying the clang command...") |
@@ -370,7 +371,7 @@ def simplify_clang_args(self): |
370 | 371 | verbose_print("Simplified command:", quote_cmd(self.get_crash_cmd())) |
371 | 372 |
|
372 | 373 | def reduce_clang_args(self): |
373 | | - """Minimize the clang arguments after running C-Reduce, to get the smallest |
| 374 | + """Minimize the clang arguments after running C-Vise, to get the smallest |
374 | 375 | command that reproduces the crash on the reduced file. |
375 | 376 | """ |
376 | 377 | print("\nReducing the clang crash command...") |
@@ -413,14 +414,14 @@ def run_creduce(self): |
413 | 414 | full_creduce_cmd = ( |
414 | 415 | [creduce_cmd] + self.creduce_flags + [self.testfile, self.file_to_reduce] |
415 | 416 | ) |
416 | | - print("\nRunning C-Reduce...") |
| 417 | + print("\nRunning C reduction tool...") |
417 | 418 | verbose_print(quote_cmd(full_creduce_cmd)) |
418 | 419 | try: |
419 | 420 | p = subprocess.Popen(full_creduce_cmd) |
420 | 421 | p.communicate() |
421 | 422 | except KeyboardInterrupt: |
422 | 423 | # Hack to kill C-Reduce because it jumps into its own pgid |
423 | | - print("\n\nctrl-c detected, killed creduce") |
| 424 | + print("\n\nctrl-c detected, killed reduction tool") |
424 | 425 | p.kill() |
425 | 426 |
|
426 | 427 |
|
@@ -453,14 +454,15 @@ def main(): |
453 | 454 | "--creduce", |
454 | 455 | dest="creduce", |
455 | 456 | type=str, |
456 | | - help="The path to the `creduce` executable. " |
457 | | - "Required if `creduce` is not in PATH environment.", |
| 457 | + help="The path to the `creduce` or `cvise` executable. " |
| 458 | + "Required if neither `creduce` nor `cvise` are on PATH.", |
458 | 459 | ) |
459 | 460 | parser.add_argument("-v", "--verbose", action="store_true") |
460 | 461 | args, creduce_flags = parser.parse_known_args() |
461 | 462 | verbose = args.verbose |
462 | 463 | llvm_bin = os.path.abspath(args.llvm_bin) if args.llvm_bin else None |
463 | 464 | creduce_cmd = check_cmd("creduce", None, args.creduce) |
| 465 | + creduce_cmd = check_cmd("cvise", None, args.creduce) |
464 | 466 | clang_cmd = check_cmd("clang", llvm_bin, args.clang) |
465 | 467 |
|
466 | 468 | crash_script = check_file(args.crash_script[0]) |
|
0 commit comments