mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Add option --show-whitespaces-in-diff
to clickhouse-test
This commit is contained in:
parent
08ff37f64e
commit
4d7edb4321
@ -947,6 +947,8 @@ class TestCase:
|
|||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.show_whitespaces_in_diff = args.show_whitespaces_in_diff
|
||||||
|
|
||||||
# should skip test, should increment skipped_total, skip reason
|
# should skip test, should increment skipped_total, skip reason
|
||||||
def should_skip_test(self, suite) -> Optional[FailureReason]:
|
def should_skip_test(self, suite) -> Optional[FailureReason]:
|
||||||
tags = self.tags
|
tags = self.tags
|
||||||
@ -1146,7 +1148,7 @@ class TestCase:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if result_is_different:
|
if result_is_different:
|
||||||
diff = Popen(
|
diff_proc = Popen(
|
||||||
[
|
[
|
||||||
"diff",
|
"diff",
|
||||||
"-U",
|
"-U",
|
||||||
@ -1157,7 +1159,14 @@ class TestCase:
|
|||||||
encoding="latin-1",
|
encoding="latin-1",
|
||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
).communicate()[0]
|
)
|
||||||
|
if self.show_whitespaces_in_diff:
|
||||||
|
cat_proc = Popen(["cat", "-te"], stdin=diff_proc.stdout, stdout=PIPE)
|
||||||
|
diff_proc.stdout.close() # Allow diff to receive a SIGPIPE if cat exits.
|
||||||
|
diff = cat_proc.communicate()[0].decode("utf-8", errors="ignore")
|
||||||
|
else:
|
||||||
|
diff = diff_proc.communicate()[0]
|
||||||
|
|
||||||
if diff.startswith("Binary files "):
|
if diff.startswith("Binary files "):
|
||||||
diff += "Content of stdout:\n===================\n"
|
diff += "Content of stdout:\n===================\n"
|
||||||
file = open(self.stdout_file, "rb")
|
file = open(self.stdout_file, "rb")
|
||||||
@ -2755,6 +2764,12 @@ def parse_args():
|
|||||||
help="Total test groups for crc32(test_name) % run_by_hash_total == run_by_hash_num",
|
help="Total test groups for crc32(test_name) % run_by_hash_total == run_by_hash_num",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--show-whitespaces-in-diff",
|
||||||
|
action="store_true",
|
||||||
|
help="Display TAB characters as ^I and trailing spaces as $ in diff",
|
||||||
|
)
|
||||||
|
|
||||||
group = parser.add_mutually_exclusive_group(required=False)
|
group = parser.add_mutually_exclusive_group(required=False)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"--zookeeper",
|
"--zookeeper",
|
||||||
|
Loading…
Reference in New Issue
Block a user