This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from darrenldl/dev
Test suite overhaul
- Loading branch information
Showing
39 changed files
with
2,120 additions
and
503 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,87 @@ | ||
#!/bin/bash | ||
|
||
source kcov_blkar_fun.sh | ||
|
||
exit_code=0 | ||
|
||
VERSIONS=(1 17) | ||
|
||
source functions.sh | ||
|
||
# Encode in all 6 versions | ||
for ver in ${VERSIONS[*]}; do | ||
for c in 0 1; do | ||
echo -n "Generating container of version $ver, copy #$c" | ||
corrupt 1000 dummy | ||
output=$(blkar encode --uid DEADBEEF0123 --json --sbx-version $ver -f dummy dummy$ver.$c.sbx \ | ||
--rs-data 10 --rs-parity 2) | ||
if [[ $(echo $output | jq -r ".error") != null ]]; then | ||
echo " ==> Invalid JSON" | ||
exit_code=1 | ||
fi | ||
if [[ $(echo $output | jq -r ".stats.sbxVersion") == "$ver" ]]; then | ||
echo " ==> Okay" | ||
else | ||
echo " ==> NOT okay" | ||
exit_code=1 | ||
fi | ||
done | ||
done | ||
|
||
# Check hash of all containers | ||
for ver in ${VERSIONS[*]}; do | ||
if [[ $ver == 1 || $ver == 17 ]]; then | ||
block_size=512 | ||
elif [[ $ver == 2 || $ver == 18 ]]; then | ||
block_size=128 | ||
elif [[ $ver == 3 || $ver == 19 ]]; then | ||
block_size=4096 | ||
fi | ||
|
||
echo -n "Checking container version $ver, copy #0" | ||
output=$(blkar check --hash --json --pv 2 --verbose dummy$ver.0.sbx 2>/dev/null) | ||
if [[ $(echo $output | jq -r ".error") != null ]]; then | ||
echo " ==> Invalid JSON" | ||
exit_code=1 | ||
fi | ||
if [[ $(echo $output | jq -r ".stats.numberOfBlocksFailedCheck") == 0 ]]; then | ||
echo -n " ==> Okay" | ||
else | ||
echo -n " ==> NOT okay" | ||
exit_code=1 | ||
fi | ||
recorded_hash=$(echo $output | jq -r ".stats.recordedHash" | awk '{ print $3 }') | ||
stored_data_hash=$(echo $output | jq -r ".stats.hashOfStoredData" | awk '{ print $3 }') | ||
if [[ $recorded_hash == $stored_data_hash ]]; then | ||
echo " ==> Okay" | ||
else | ||
echo " ==> NOT okay" | ||
exit_code=1 | ||
fi | ||
|
||
echo "Overwriting first block of copy #0 with copy #1" | ||
dd if=dummy$ver.1.sbx of=dummy$ver.0.sbx bs=$block_size count=1 conv=notrunc &>/dev/null | ||
|
||
echo -n "Checking container version $ver, copy #0 after overwrite" | ||
output=$(blkar check --hash --json --pv 2 --verbose dummy$ver.0.sbx 2>/dev/null) | ||
if [[ $(echo $output | jq -r ".error") != null ]]; then | ||
echo " ==> Invalid JSON" | ||
exit_code=1 | ||
fi | ||
if [[ $(echo $output | jq -r ".stats.numberOfBlocksFailedCheck") == 0 ]]; then | ||
echo -n " ==> Okay" | ||
else | ||
echo -n " ==> NOT okay" | ||
exit_code=1 | ||
fi | ||
recorded_hash=$(echo $output | jq -r ".stats.recordedHash" | awk '{ print $3 }') | ||
stored_data_hash=$(echo $output | jq -r ".stats.hashOfStoredData" | awk '{ print $3 }') | ||
if [[ $recorded_hash != $stored_data_hash ]]; then | ||
echo " ==> Okay" | ||
else | ||
echo " ==> NOT okay" | ||
exit_code=1 | ||
fi | ||
done | ||
|
||
echo $exit_code > exit_code |
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 |
---|---|---|
@@ -1,19 +1,52 @@ | ||
#!/bin/bash | ||
|
||
if [[ $PWD != */cov_tests ]]; then | ||
cd cov_tests | ||
if [[ $PWD != */blockyarchive/cov_tests ]]; then | ||
echo "Please invoke clean.sh in the cov_tests directory" | ||
exit 1 | ||
fi | ||
|
||
rm dummy* &>/dev/null | ||
source test_list.sh | ||
|
||
rm *.sbx &>/dev/null | ||
rm -f dummy* | ||
|
||
rm rescued_data/* &>/dev/null | ||
rm -f *.sbx | ||
|
||
rm rescued_data2/* &>/dev/null | ||
rm -f *.ecsbx | ||
|
||
rm rescue_log &>/dev/null | ||
rm -f rescued_data/* | ||
|
||
rm filler* &>/dev/null | ||
rm -f rescued_data2/* | ||
|
||
rm out_test/* &>/dev/null | ||
rm -f rescue_log | ||
|
||
rm -f filler* | ||
|
||
rm -f out_test/* | ||
|
||
rm -f sort_*.sbx.* | ||
|
||
rm -f sort_*.ecsbx.* | ||
|
||
rm -f exit_code | ||
|
||
rm -f ../blkar | ||
|
||
rm -f data_chunk | ||
|
||
rm -f data_chunk_orig | ||
|
||
rm -f chunk_* | ||
|
||
rm -f decode*.sbx.* | ||
|
||
rm -f decode*.ecsbx.* | ||
|
||
find . -regextype sed -regex "./sort_[0-9]*_[0-9]*_[0-9]*" -delete | ||
|
||
find . -regextype sed -regex "./decode_[0-9]*_[0-9]*_[0-9]*" -delete | ||
|
||
for t in ${tests[@]}; do | ||
if [[ "$t" != "" ]]; then | ||
rm -rf $t | ||
fi | ||
done |
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 |
---|---|---|
|
@@ -7,4 +7,3 @@ cargo build | |
|
||
echo "Copying blkar binary over" | ||
cp target/debug/blkar ./cov_tests/blkar | ||
cd cov_tests |
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
Oops, something went wrong.