Skip to content

Commit

Permalink
Improve diagnostics (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Jul 10, 2024
1 parent 574f337 commit 65e2e2f
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 15 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ To execute `run_full.sh` on multiple machines in parallel create a machine addre
./run_multiple_machine.sh main machines.txt <project_path_on_machine>
```

#### If `make small-test` fails

If `make small-test` fails in a branch that you wish to merge into the main
branch, run `make small-test` in the main branch (which should succeed) and also
in your branch, and investigate the differences.


### Load the stored cache

To decompress the cache run `make decompress-cache`. This is done automatically in `run_full.sh` if `cache/` does not exist.
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ echo "Number of machines: $num_machines"
echo "Output directory: $OUT_DIR"
echo "Options: $comparator_flags"

./gradlew -q assemble -g ../.gradle/
JAVA_HOME="$JAVA11_HOME" ./gradlew -q assemble -g ../.gradle/

mkdir -p "$OUT_DIR"

Expand Down Expand Up @@ -168,7 +168,7 @@ python3 src/python/test_repo_heads.py \
--output_path "$OUT_DIR/repos_head_passes.csv" \
--cache_dir "$CACHE_DIR"

java -cp build/libs/astmergeevaluation-all.jar \
JAVA_HOME="${JAVA17_HOME}" "${JAVA17_HOME}"/bin/java -cp build/libs/astmergeevaluation-all.jar \
astmergeevaluation.FindMergeCommits \
"$OUT_DIR/repos_head_passes.csv" \
"$OUT_DIR/merges"
Expand Down
2 changes: 1 addition & 1 deletion src/python/cache_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def lookup_in_cache(
lock.release()
return cache_data
if set_run:
logger.debug(f"lookup_in_cache: Setting {cache_key} to None")
logger.debug(f"lookup_in_cache: Setting {cache_key} to None for {repo_slug}")
set_in_cache(cache_key, None, repo_slug, cache_directory, acquire_lock=False)
lock.release()
return None
Expand Down
2 changes: 1 addition & 1 deletion src/python/merge_runtime_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def main():
else:
logger.info(
f"merge_timer: Running {merge_tool.name} "
f"on {repo_slug} {left_hash} {right_hash}"
f"on {idx} {repo_slug} {left_hash} {right_hash}"
)
run_times = []
for _ in range(args.n_timings):
Expand Down
4 changes: 2 additions & 2 deletions src/python/test_repo_heads.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def head_passes_tests(args: Tuple[pd.Series, Path]) -> pd.Series:
logger.info("test_repo_heads: Finished Building Output")

logger.success(
"test_repo_heads: Number of repos whose head passes tests:"
"test_repo_heads: Number of repos whose head passes tests: "
+ str(len(filtered_df))
+ "out of"
+ " out of "
+ str(len(df))
)
if len(filtered_df) == 0:
Expand Down
8 changes: 6 additions & 2 deletions src/python/write_head_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ def get_latest_hash(args):

# If file exists ignore this step
if os.path.isfile(arguments.output_path):
logger.info("write_head_hashes: File already exists, skipping")
logger.info(
f"write_head_hashes: File already exists, skipping {arguments.output_path}"
)
sys.exit(0)

df = pd.read_csv(arguments.repos_csv, index_col="idx")
df["repository"] = df["repository"].str.lower()

logger.info("write_head_hashes: Started cloning repos and collecting head hashes")
logger.info(
"write_head_hashes: Started cloning repos and collecting head hashes for {arguments.output_path}"
)
with multiprocessing.Pool(processes=num_processes()) as pool:
with Progress(
SpinnerColumn(),
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/git_hires_merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ branch2=$3
# Print the current PATH
echo "PATH: $PATH"

cd "$clone_dir" || exit 1
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)

git checkout "$branch1" --force

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/gitmerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ branch2=$3
strategy=$4

# perform merge
cd "$clone_dir" || exit 1
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)

git checkout "$branch1" --force
git config merge.conflictstyle zdiff3
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/gitmerge_resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ status=$?

if [ "$status" -ne 0 ]; then
echo "Removing filenames from conflict markers."
cd "$clone_dir" || exit 1
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)
readarray -t files < <(grep -l -r '^\(<<<<<<<\||||||||\|>>>>>>>\) .merge_file_')
for file in "${files[@]}" ; do
echo "Removing filenames from conflict markers in $file"
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/intellimerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "Temp dir: $temp_out_dir"
clone_dir_absolutepath=$(realpath "$clone_dir")

# run intellimerge
cd "$clone_dir" || exit 1
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)

java -Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -Djava.io.tmpdir="$temp_intellimerge_dir" -jar "$intellimerge_absolutepath" -r "$clone_dir_absolutepath" -b "$branch1" "$branch2" -o $temp_out_dir

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/merge_plumelib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ merge_strategy=$5 #"--only-adjacent"

echo "$0: Merging $branch1 and $branch2 with git_strategy=$git_strategy and merge_strategy=$merge_strategy"

cd "$clone_dir" || exit 1
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)

git checkout "$branch1" --force

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/merge_tools/spork.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ clone_dir=$1
branch1=$2
branch2=$3

cd "$clone_dir" || exit
cd "$clone_dir" || (echo "$0: cannot cd to $clone_dir" ; exit 1)

# set up spork driver
git config --local merge.spork.name "spork"
Expand Down
5 changes: 4 additions & 1 deletion test/check_equal_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def remove_run_time(df):
if actual_df[col].equals(goal_df[col]):
continue
# Print the differences.
print(os.system(f"diff {goal_folder/goal_file} {actual_file}"))
diff_exit_code = os.waitstatus_to_exitcode(
os.system(f"diff {goal_folder/goal_file} {actual_file}")
)
print(f"diff exit code: {diff_exit_code}")
# Now print details, after diffs so it is not obscured by the diff output.
different_columns = []
for col in goal_df.columns:
Expand Down

0 comments on commit 65e2e2f

Please sign in to comment.