-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Robert Marklund <[email protected]>
- Loading branch information
1 parent
0b45651
commit c0e9606
Showing
3 changed files
with
92 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
# Test that selection of buffersizes works as expected. | ||
|
||
set -e | ||
. "$(dirname "$0")/common_funcs.sh" | ||
|
||
reset_teststate | ||
|
||
TEST_DIR=buffersizes_speedtest | ||
mkdir -p "$TEST_DIR" | ||
|
||
make_test_files() { | ||
dbgecho "creating test files in $TEST_DIR" | ||
head -c 1000000 /dev/zero >"$TEST_DIR/a" | ||
cp "$TEST_DIR/a" "$TEST_DIR/b" | ||
cp "$TEST_DIR/a" "$TEST_DIR/c" | ||
cp "$TEST_DIR/a" "$TEST_DIR/d" | ||
cp "$TEST_DIR/a" "$TEST_DIR/e" | ||
} | ||
|
||
dbgecho "check so all buffersizes behave the same" | ||
|
||
# disables only run once shellscheck | ||
# shellcheck disable=SC2043 | ||
for checksumtype in sha256; do | ||
i=1 | ||
while :; do | ||
if [ $i -gt 128 ]; then | ||
break | ||
fi | ||
i="$((i*2))" | ||
make_test_files | ||
dbgecho "testing buffersize $((i*1024))" | ||
dbgecho "testing $checksumtype" | ||
# Fix this properly by making rdfind to array and use "${rdfind[@]}" | ||
# this requires bash not sh | ||
# shellcheck disable=SC2086 | ||
$rdfind -buffersize $((i*1024)) -checksum "$checksumtype" -deleteduplicates true "$TEST_DIR" >/dev/null | ||
[ -e "$TEST_DIR/a" ] | ||
[ ! -e "$TEST_DIR/b" ] | ||
[ ! -e "$TEST_DIR/c" ] | ||
[ ! -e "$TEST_DIR/d" ] | ||
[ ! -e "$TEST_DIR/e" ] | ||
done | ||
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
# Performance test for checksumming with diffrent buffersizes. Not meant | ||
# to be run for regular testing. | ||
|
||
set -e | ||
. "$(dirname "$0")/common_funcs.sh" | ||
|
||
reset_teststate | ||
|
||
TEST_DIR=buffersizes_speedtest | ||
mkdir -p "$TEST_DIR" | ||
|
||
make_test_files() { | ||
dbgecho "creating test files in $TEST_DIR" | ||
head -c $((1024*1024*500)) /dev/zero >"$TEST_DIR/a" | ||
cp "$TEST_DIR/a" "$TEST_DIR/b" | ||
cp "$TEST_DIR/a" "$TEST_DIR/c" | ||
cp "$TEST_DIR/a" "$TEST_DIR/d" | ||
cp "$TEST_DIR/a" "$TEST_DIR/e" | ||
} | ||
|
||
dbgecho "run speed test for all shecksums and buffersizes" | ||
|
||
make_test_files | ||
|
||
for checksumtype in md5 sha1 sha256 sha512; do | ||
i=1 | ||
while :; do | ||
if [ $i -gt 128 ]; then | ||
break | ||
fi | ||
i="$((i*2))" | ||
dbgecho "testing buffersize $((i*1024))" | ||
dbgecho "testing $checksumtype" | ||
# Fix this properly by making rdfind to array and use "${rdfind[@]}" | ||
# this requires bash not sh | ||
# shellcheck disable=SC2086 | ||
time $rdfind -buffersize $((i*1024)) -checksum "$checksumtype" -dryrun true -deleteduplicates true "$TEST_DIR" >/dev/null | ||
dbgecho "testing $checksumtype memusage" | ||
# shellcheck disable=SC2086 | ||
/usr/bin/time -f '%M kB' $rdfind -buffersize $((i*1024)) -checksum "$checksumtype" -dryrun true -deleteduplicates true "$TEST_DIR" >/dev/null | ||
done | ||
done | ||
|
||
|