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.
This commit is contained in:
Reid Kleckner 2024-04-29 22:08:05 +00:00
parent 028546cce2
commit 1f44a0b1ff

View File

@ -15,7 +15,6 @@ import shutil
import stat
import sys
import subprocess
import pipes
import shlex
import tempfile
import shutil
@ -61,7 +60,7 @@ def check_cmd(cmd_name, cmd_dir, cmd_path=None):
def quote_cmd(cmd):
return " ".join(pipes.quote(arg) for arg in cmd)
return " ".join(shlex.quote(arg) for arg in cmd)
def write_to_script(text, filename):
@ -220,7 +219,7 @@ fi
)
for msg in self.expected_output:
output += "grep -F %s t.log || exit 1\n" % pipes.quote(msg)
output += "grep -F %s t.log || exit 1\n" % shlex.quote(msg)
write_to_script(output, self.testfile)
self.check_interestingness()
@ -318,9 +317,17 @@ fi
interestingness test takes to run.
"""
print("\nSimplifying the clang command...")
new_args = self.clang_args
# Remove the color diagnostics flag to make it easier to match error
# text.
new_args = self.try_remove_args(
new_args,
msg="Removed -fcolor-diagnostics",
opts_equal=["-fcolor-diagnostics"],
)
# Remove some clang arguments to speed up the interestingness test
new_args = self.clang_args
new_args = self.try_remove_args(
new_args,
msg="Removed debug info options",