Skip to content

Commit

Permalink
Make reproduction of results easier (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schesch authored Jun 8, 2024
1 parent 4b59cea commit 19ea8c9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ compress-cache:
if [ -f cache.tar.gz ]; then rm -f cache.tar.gz; fi
tar --exclude="lock" -czf cache.tar.gz cache

# Compresses the cache without logs.
compress-cache-without-logs:
if [ ! -d cache ]; then echo "cache does not exist"; exit 1; fi
if [ -f cache_without_logs.tar.gz ]; then rm -f cache_without_logs.tar.gz; fi
tar --exclude="lock" --exclude="logs" -czf cache_without_logs.tar.gz cache

compress-small-cache:
if [ ! -d cache-small ]; then echo "cache-small does not exist"; exit 1; fi
if [ -f cache-small.tar ]; then rm -f cache-small.tar; fi
Expand All @@ -72,6 +78,12 @@ decompress-cache:
if [ -d cache ]; then echo "cache already exists"; exit 1; fi
tar -xzf cache.tar.gz

# Decompresses the cache without logs.
decompress-cache-without-logs:
if [ ! -f cache_without_logs.tar.gz ]; then echo "cache_without_logs.tar.gz does not exist"; exit 1; fi
if [ -d cache ]; then echo "cache already exists"; exit 1; fi
tar -xzf cache_without_logs.tar.gz

decompress-small-cache:
if [ ! -f cache-small.tar ]; then echo "cache-small.tar does not exist"; exit 1; fi
if [ -d cache-small ]; then echo "cache-small already exists"; exit 1; fi
Expand Down Expand Up @@ -166,12 +178,3 @@ tags:

run:
nice -n 5 sh run_full.sh | tee output.txt

# Create a tarball of the artifacts for the paper.
# Keep this target last in the file.
create-artifacts:
rm -rf artifacts
git clone https://github.com/benedikt-schesch/AST-Merging-Evaluation.git artifacts
rm -rf artifacts/.git
sed -i '' 's/benedikt-schesch/anonymous-github-user/g' artifacts/README.md artifacts/Makefile
tar -czf artifacts.tar.gz artifacts
24 changes: 20 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,26 @@ git submodule update --init --recursive
GIT_CONFIG_GLOBAL=$(pwd)/.gitconfig
export GIT_CONFIG_GLOBAL

# Check if cache.tar exists and cache is missing
if [ -f cache.tar ] && [ ! -d cache ]; then
echo "Decompressing cache.tar"
# make decompress-cache
# Check if cache.tar.gz exists and cache is missing
if [ -f cache.tar.gz ] && [ ! -d cache ]; then
read -r -p "cache.tar.gz found and cache directory missing. Do you want to decompress? (y/n) " answer
if [ "$answer" = "y" ]; then
echo "Decompressing cache.tar.gz"
make decompress-cache
else
echo "Decompression aborted."
fi
fi

# Check if cache_without_logs.tar.gz exists and cache is missing
if [ -f cache_without_logs.tar.gz ] && [ ! -d cache_without_logs ]; then
read -r -p "cache_without_logs.tar.gz found and cache_without_logs directory missing. Do you want to decompress? (y/n) " answer
if [ "$answer" = "y" ]; then
echo "Decompressing cache_without_logs.tar.gz"
make decompress-cache-without-logs
else
echo "Decompression aborted."
fi
fi

mvn -v | head -n 1 | cut -c 14-18 | grep -q 3.9. || { echo "Maven 3.9.* is required"; mvn -v; echo "PATH=$PATH"; exit 1; }
Expand Down
13 changes: 1 addition & 12 deletions src/python/test_repo_heads.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,7 @@ def head_passes_tests(args: Tuple[pd.Series, Path]) -> pd.Series:
test_state, _, repo_info["head tree fingerprint"] = repo.checkout_and_test(
repo_info["head hash"], timeout=TIMEOUT_TESTING_PARENT, n_tests=3
)
if test_state == TEST_STATE.Tests_passed:
# Make sure the repo is cloned and exists
repo.clone_repo()
if not repo.repo_path.exists():
logger.error(
f"head_passes_tests: Repo {repo_slug} does not exist after passing tests."
)
raise Exception(
f"Repo {repo_slug} does not exist after passing tests. \
(Either clone the repo or remove the cache entry)"
)
else:
if test_state != TEST_STATE.Tests_passed:
shutil.rmtree(repo.repo_path, ignore_errors=True)

repo_info["head test result"] = test_state.name
Expand Down

0 comments on commit 19ea8c9

Please sign in to comment.