ansitest/OSX/zfs-test-encryption-speeds--osx--copy-iso.sh

55 lines
1.4 KiB
Bash
Raw Normal View History

2021-04-08 12:54:45 -05:00
#!/bin/bash
2021-04-08 12:26:25 -05:00
# osx
2021-04-08 12:54:45 -05:00
# basic copy ISO to test each ZFS cipher's encryption speed after running zfs-test-encryption-speeds--osx (which creates the datasets)
2021-04-08 12:26:25 -05:00
stime=$(date)
# TODO editme
zp=zint500 # This is where the Test-aes* datasets live
tmpfile=$HOME/zfstestencrspeeds.txt
outfile=$HOME/zfs-test-encryption-speeds-results.log
2021-04-08 12:54:45 -05:00
#source ~/bin/failexit.mrg
# failexit.mrg
function failexit () {
echo '! Something failed! Code: '"$1 $2" # code # (and optional description)
exit $1
}
2021-04-08 12:26:25 -05:00
useramdisk=1
[ $useramdisk -eq 0 ] && isopath=/Volumes/zsgtera4/shrcompr-zsgt2B/ISO # use if < 6GB RAM installed
2021-04-08 12:54:45 -05:00
# xxx TODO EDITME ^^
2021-04-08 12:26:25 -05:00
[ "$isopath" = "" ] && isopath=/Volumes/ramdisk
[ -e "$isopath" ] || failexit 101 "! Ramdisk or ISO source not detected - run zfs-test-encryption-speeds--osx to create it"
cd "$isopath" && pwd
function ttime () {
2021-04-08 12:54:45 -05:00
result=$(date -j -f "%a %b %d %T %Z %Y" "$(date)" "+%s")
2021-04-08 12:26:25 -05:00
# see ' man date ' -- seconds
}
2021-04-08 12:54:45 -05:00
# blankit
2021-04-08 12:26:25 -05:00
> $tmpfile
2021-04-08 12:54:45 -05:00
echo "$(date) - Copying ISO file to each encrypted dataset"
2021-04-08 12:26:25 -05:00
for d in /Volumes/$zp/Test-aes*; do
date; ttime; tstart=$result
time cp -vf *.iso $d
date; ttime; tend=$result
ntime=$(date)
let csecs=$tend-$tstart
echo "$csecs Seconds to Copy ISO to $d" |tee -a $tmpfile
2021-04-08 12:54:45 -05:00
sleep 10
purge # OSX doesnt really have a sync, this is close
2021-04-08 12:26:25 -05:00
done
echo "o Start time: $stime -- End time: $ntime"
sort -n $tmpfile > $outfile && rm -f $tmpfile
ls -al $outfile
exit;