Last active
June 26, 2017 14:56
-
-
Save prumand/aedde8ef66226453be6467a1423664ae to your computer and use it in GitHub Desktop.
script for I/O tests on dev-servers
This file contains hidden or 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
#!/bin/bash | |
set -e | |
TEST_SUITES=(read rw randread randrw) | |
TEST_FILE_PRE=fio_ | |
TEST_FILE_POST=.json | |
function set_filename { | |
FILENAME=${TEST_FILE_PRE}${1}${TEST_FILE_POST} | |
} | |
function run_io_test { | |
# $1 type (see --rw option for fio) | |
# $2 name of test (proposed machine_test) | |
local size=1240m | |
set_filename $1 | |
fio --rw=$1 \ | |
--output-format=json \ | |
--output=fio_$1.json \ | |
--size=$size \ | |
--name=$1 | |
} | |
function run_io_tests_suite { | |
for suite in "${TEST_SUITES[@]}"; do | |
echo "Started $suite" | |
run_io_test $suite | |
done | |
} | |
function run_on_machines { | |
# $1 name of the machine to run it on | |
ssh $1 'bash -s' < run-io-tests.sh remote $2 | |
} | |
function copy_results { | |
local result_dir=results/$1/$(date +%s) | |
mkdir -p $result_dir | |
echo $2 > directory_used | |
scp "$1:$2/${TEST_FILE_PRE}*${TEST_FILE_POST}" ./$result_dir | |
} | |
######## | |
# Main | |
######## | |
if [ "$1" == "remote" ]; then | |
# only running if on remote | |
# $2 machine where to run | |
# $3 directory where to run tests | |
cd $2 | |
run_io_tests_suite | |
else | |
# $1 name of the remote machine = as configured in .ssh/config | |
# $2 directory where to run it on the remote machine | |
run_on_machines $1 $2 | |
copy_results $1 $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment