Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #189 from darrenldl/dev
Browse files Browse the repository at this point in the history
Fixed corrupt function in test suite
  • Loading branch information
darrenldl committed May 6, 2019
2 parents 19494b9 + ff1688d commit 4a5f835
Show file tree
Hide file tree
Showing 44 changed files with 60 additions and 126 deletions.
4 changes: 1 addition & 3 deletions tests/burst_corruption_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$4 bs=$2 count=$3 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/burst_corruption_tests_decode_stdout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$4 bs=$2 count=$3 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/burst_corruption_tests_encode_stdin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$4 bs=$2 count=$3 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/check_from_to_force_misalign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/check_from_to_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/check_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

echo -n "Encoding"
output=$(./../blkar encode --json -f dummy --uid DEADBEEF0001)
Expand Down
4 changes: 1 addition & 3 deletions tests/check_ref_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/check_ref_from_to_tests_force_misalign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/check_ref_from_to_tests_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/compare_decode_file_and_stdout_corrupted_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(1 2 3 17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/compare_decode_file_and_stdout_nometa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(1 2 3 17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/corruption_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/corruption_tests_decode_stdout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/corruption_tests_encode_stdin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_blanks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

echo "Testing version 1"
echo "Encoding"
Expand Down
4 changes: 1 addition & 3 deletions tests/decode_blanks_decode_stdout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

echo "Testing version 1"
echo "Encoding"
Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_corruption_based.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

echo -n "Encoding"
output=$(./../blkar encode --json -f dummy --uid DEADBEEF0001 --sbx-version 17 --rs-data 10 --rs-parity 2 --burst 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_corruption_based_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_decode_stdout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

echo "Testing version 1"
echo "Encoding"
Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_decode_stdout_force_misalign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_decode_stdout_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_force_misalign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_from_to_tests_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_multi_pass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(1 2 3 17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_multi_pass_no_skip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(1 2 3 17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_ref_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_ref_from_to_tests_force_misalign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
4 changes: 1 addition & 3 deletions tests/decode_ref_from_to_tests_rounding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

offset=$[1 + RANDOM % 100]

Expand Down
1 change: 1 addition & 0 deletions tests/dev_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ while (( $i < $test_count )); do
mkdir $t/
cd $t
./../gen_dummy.sh
cp ../functions.sh .
./../$t.sh > log 2> stderr_log &
cd ..

Expand Down
4 changes: 1 addition & 3 deletions tests/encode_from_to_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

exit_code=0

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

for (( i=0; i < 10; i++ )); do
from=$[RANDOM % 1000]
Expand Down
17 changes: 17 additions & 0 deletions tests/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

corrupt() {
byte_orig=$(mktemp)
byte_cur=$(mktemp)
dd if=$2 of=$byte_orig bs=1 count=1 skip=$1 &>/dev/null
while true; do
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
dd if=$2 of=$byte_cur bs=1 count=1 skip=$1 &>/dev/null
cmp $byte_cur $byte_orig &>/dev/null
if [[ $? != 0 ]]; then
break
fi
done
rm $byte_orig
rm $byte_cur
}
4 changes: 1 addition & 3 deletions tests/repair_manual_burst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/repair_manual_burst_decode_stdout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down
4 changes: 1 addition & 3 deletions tests/repair_manual_burst_encode_stdin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ exit_code=0

VERSIONS=(17 18 19)

corrupt() {
dd if=/dev/zero of=$2 bs=1 count=1 seek=$1 conv=notrunc &>/dev/null
}
source functions.sh

file_size=$(ls -l dummy | awk '{ print $5 }')

Expand Down

0 comments on commit 4a5f835

Please sign in to comment.