Skip to content

Commit 1f44a0b

Browse files
committed
Make minor improvements to the creduce wrapper script
Use shlex.quote instead of pipes.quote. We don't need to support Python 2.7 anymore. Remove -fcolor-diagnostics first, because that can sometimes interfere with the interestingness test.
1 parent 028546c commit 1f44a0b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

clang/utils/creduce-clang-crash.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import stat
1616
import sys
1717
import subprocess
18-
import pipes
1918
import shlex
2019
import tempfile
2120
import shutil
@@ -61,7 +60,7 @@ def check_cmd(cmd_name, cmd_dir, cmd_path=None):
6160

6261

6362
def quote_cmd(cmd):
64-
return " ".join(pipes.quote(arg) for arg in cmd)
63+
return " ".join(shlex.quote(arg) for arg in cmd)
6564

6665

6766
def write_to_script(text, filename):
@@ -220,7 +219,7 @@ def write_interestingness_test(self):
220219
)
221220

222221
for msg in self.expected_output:
223-
output += "grep -F %s t.log || exit 1\n" % pipes.quote(msg)
222+
output += "grep -F %s t.log || exit 1\n" % shlex.quote(msg)
224223

225224
write_to_script(output, self.testfile)
226225
self.check_interestingness()
@@ -318,9 +317,17 @@ def simplify_clang_args(self):
318317
interestingness test takes to run.
319318
"""
320319
print("\nSimplifying the clang command...")
320+
new_args = self.clang_args
321+
322+
# Remove the color diagnostics flag to make it easier to match error
323+
# text.
324+
new_args = self.try_remove_args(
325+
new_args,
326+
msg="Removed -fcolor-diagnostics",
327+
opts_equal=["-fcolor-diagnostics"],
328+
)
321329

322330
# Remove some clang arguments to speed up the interestingness test
323-
new_args = self.clang_args
324331
new_args = self.try_remove_args(
325332
new_args,
326333
msg="Removed debug info options",

0 commit comments

Comments
 (0)