Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve diagnostics #365

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/python/replay_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ def merge_replay(
stderr=subprocess.PIPE,
)
if len(process.stderr.decode("utf-8")) == 0:
conflict_files = process.stdout.decode("utf-8")
is_conflict = len(conflict_files) > 0
git_conflict_files = process.stdout.decode("utf-8")
is_conflict = len(git_conflict_files) > 0
assert (
is_conflict == (merge_result == MERGE_STATE.Merge_failed)
), f"merge_replay: tool{merge_tool} merge_result {merge_result} does not match conflict_files {conflict_files} at path {repo.local_repo_path}"
), f"merge_replay: tool merge result is inconsistent with `git diff --diff-filter=U`: tool={merge_tool} merge_result={merge_result} git_conflict_files={git_conflict_files} path={repo.local_repo_path}"

result_df.loc[
merge_tool.name,
Expand Down Expand Up @@ -308,10 +308,11 @@ def merge_replay(
store_artifacts(result_df)
if delete_workdir:
delete_workdirs(result_df)
print("=====================================\n")
print("fingerprints differ; details follow.")
print(f"=================== start of {log_path}:")
with open(log_path, "r", encoding="utf-8") as f:
print(f.read())
print("=====================================\n")
print(f"=================== end of {log_path}.")
raise Exception(
f"fingerprints differ: after merge of {workdir} with {merge_tool}, found"
+ f" {merge_fingerprint} but expected "
Expand Down
15 changes: 12 additions & 3 deletions src/python/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,20 @@ def stdout_and_stderr(
source: Union[subprocess.TimeoutExpired, subprocess.CompletedProcess],
) -> str:
"""Produces the standard output and standard error of a timedout process."""
explanation = "Run Command: " + " ".join(command) + "\nTimed out"
explanation = "Here is the output from: " + " ".join(command)
if source.stdout:
explanation += "\nstdout:\n" + source.stdout.decode("utf-8", "replace")
explanation += (
"\nstdout:\n"
+ source.stdout.decode("utf-8", "replace")
+ "\nEnd of stdout."
)
if source.stderr:
explanation += "\nstderr:\n" + source.stderr.decode("utf-8", "replace")
explanation += (
"\nstderr:\n"
+ source.stderr.decode("utf-8", "replace")
+ "\nEnd of stderr."
)
explanation += "\nEnd of output from: " + " ".join(command)
return explanation


Expand Down