-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for hictk fix-mcool. Update unit tests
- Loading branch information
Showing
7 changed files
with
109 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (C) 2023 Roberto Rossini <roberros@uio.no> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
echo "#########################" | ||
echo "#### hictk fix-mcool ####" | ||
|
||
# readlink -f is not available on macos... | ||
function readlink_py { | ||
set -eu | ||
python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$1" | ||
} | ||
|
||
function check_files_exist { | ||
set -eu | ||
status=0 | ||
for f in "$@"; do | ||
if [ ! -f "$f" ]; then | ||
2>&1 echo "Unable to find test file \"$f\"" | ||
status=1 | ||
fi | ||
done | ||
|
||
return "$status" | ||
} | ||
|
||
status=0 | ||
|
||
if [ $# -ne 1 ]; then | ||
2>&1 echo "Usage: $0 path_to_hictk" | ||
status=1 | ||
fi | ||
|
||
hictk_bin="$1" | ||
|
||
data_dir="$(readlink_py "$(dirname "$0")/../data/")" | ||
script_dir="$(readlink_py "$(dirname "$0")")" | ||
|
||
invalid_mcool="$data_dir/cooler/invalid_coolers/corrupted_index.mcool" | ||
|
||
export PATH="$PATH:$script_dir" | ||
|
||
if [ $status -ne 0 ]; then | ||
exit $status | ||
fi | ||
|
||
if ! check_files_exist "$invalid_mcool"; then | ||
exit 1 | ||
fi | ||
|
||
outdir="$(mktemp -d -t hictk-tmp-XXXXXXXXXX)" | ||
trap 'rm -rf -- "$outdir"' EXIT | ||
|
||
"$hictk_bin" fix-mcool "$invalid_mcool" "$outdir/out.mcool" | ||
|
||
if ! "$hictk_bin" validate --validate-index "$outdir/out.mcool"; then | ||
status=1 | ||
fi | ||
|
||
if [ "$status" -eq 0 ]; then | ||
printf '\n### PASS ###\n' | ||
else | ||
cat "$outdir/out.txt" | ||
printf '\n### FAIL ###\n' | ||
fi | ||
|
||
exit "$status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters