diff --git a/common.zsh b/common.zsh index 2f1be36..65bcc9b 100644 --- a/common.zsh +++ b/common.zsh @@ -37,12 +37,22 @@ VERSION=(3 4.0 4.1 4.2) # Shared functions # # # ###################### +function client_run() +{ + zparseopts -D -K t=TERMINAL + [[ ! -z $TERMINAL ]] && SSH_OPT="-t" + ssh $SSH_OPT ${CLIENT[-1]} sudo run.zsh $* +} + +function client_setup() +{ + ssh ${CLIENT[-1]} sudo setup.zsh $* +} + function setup_client_func() { - ssh ${CLIENT[-1]} "sudo setup-testdirs.zsh ${SERVER[-1]} \ - ${EXPORT[-1]} \ - ${MOUNTPOINT[-1]} \ - $USER" + client_setup testdirs.zsh ${SERVER[-1]} ${EXPORT[-1]} \ + ${MOUNTPOINT[-1]} $USER } function prepare_to_test() diff --git a/install-scripts.zsh b/install-scripts.zsh index b00efbf..8e50104 100755 --- a/install-scripts.zsh +++ b/install-scripts.zsh @@ -1,17 +1,15 @@ #!/bin/zsh BIN=$HOME/bin -SCRIPTS=(grub-list.zsh setup-testdirs.zsh \ - setup-xfstests.zsh run-xfstests.zsh \ - setup-read_plus.zsh setup-read_plus-files.py - run-nfstest-rplus.zsh) +SCRIPTS=(grub-list.zsh setup.zsh setup/ run/) function install_script() { - ssh $1 mkdir -p bin/ + ssh $1 mkdir -p bin/{setup,run} echo -n "$2 Copying files ..." for script in $SCRIPTS; do - scp -q $BIN/$script $1:bin/ + scp -qr $BIN/$script $1:bin/ done + ssh $1 cp bin/setup.zsh bin/run.zsh echo " done" } diff --git a/nfstest_rplus.zsh b/nfstest_rplus.zsh index 5ef0941..c1f588d 100755 --- a/nfstest_rplus.zsh +++ b/nfstest_rplus.zsh @@ -8,10 +8,8 @@ zparseopts -F -K \ s:=SERVER -server:=SERVER \ x:=EXPORT -export:=EXPORT -RUN_NFSTEST="run-nfstest-rplus.zsh" - prepare_to_test -ssh -t ${CLIENT[-1]} "$RUN_NFSTEST --server ${SERVER[-1]} \ - --export ${EXPORT[-1]} \ - --mountpoint ${MOUNTPOINT[-1]} \ - --user $USER" +client_run -t nfstest-rplus.zsh --server ${SERVER[-1]} \ + --export ${EXPORT[-1]} \ + --mountpoint ${MOUNTPOINT[-1]} \ + --user $USER diff --git a/read_plus.zsh b/read_plus.zsh index f43c2e9..cbca586 100755 --- a/read_plus.zsh +++ b/read_plus.zsh @@ -15,7 +15,6 @@ zparseopts -F -K \ COLOR="python -u $BIN/colors/read_plus.py ${SIZE[-1]} ${FILE[-1]}" IFLAG= -RUN_READ_PLUS="sudo run-read_plus.zsh" SRV_DIR=${EXPORT[-1]}/$USER/read_plus TEST_DIR=${MOUNTPOINT[-1]}/read_plus TEST_DEV=${SERVER[-1]}:$SRV_DIR @@ -27,8 +26,9 @@ TIME_CMD="sudo /usr/bin/time -f \"%Ss kern, %P cpu\"" # function setup_client_func() { - ssh ${CLIENT[-1]} "sudo setup-read_plus.zsh ${SERVER[-1]} ${EXPORT[-1]} \ - ${MOUNTPOINT[-1]} $USER ${SIZE[-1]} 1,2,4,8,16" | eval ${COLOR} + client_setup read_plus.zsh ${SERVER[-1]} ${EXPORT[-1]} \ + ${MOUNTPOINT[-1]} $USER ${SIZE[-1]} \ + 1,2,4,8,16 | eval ${COLOR} } prepare_to_test diff --git a/run-nfstest-rplus.zsh b/run/nfstest-rplus.zsh similarity index 100% rename from run-nfstest-rplus.zsh rename to run/nfstest-rplus.zsh diff --git a/run-xfstests.zsh b/run/xfstests.zsh similarity index 100% rename from run-xfstests.zsh rename to run/xfstests.zsh diff --git a/setup.zsh b/setup.zsh new file mode 100755 index 0000000..83cfe1f --- /dev/null +++ b/setup.zsh @@ -0,0 +1,8 @@ +#!/bin/zsh + +[[ "$(basename $0)" == "run.zsh" ]] && TARGET=bin/run || TARGET=bin/setup + +TARGET=$TARGET/$1 +shift + +[[ -x $TARGET ]] && $TARGET $* diff --git a/setup-read_plus-files.py b/setup/read_plus-files.py similarity index 100% rename from setup-read_plus-files.py rename to setup/read_plus-files.py diff --git a/setup-read_plus.zsh b/setup/read_plus.zsh similarity index 83% rename from setup-read_plus.zsh rename to setup/read_plus.zsh index c0d8d5c..d0c9f42 100755 --- a/setup-read_plus.zsh +++ b/setup/read_plus.zsh @@ -18,5 +18,5 @@ TRAPEXIT() { } mkdir -p -m 777 $MOUNTPOINT/$USER/read_plus -setup-read_plus-files.py $MOUNTPOINT/$USER/read_plus $SIZE $CHUNKS +bin/setup/read_plus-files.py $MOUNTPOINT/$USER/read_plus $SIZE $CHUNKS sync diff --git a/setup-testdirs.zsh b/setup/testdirs.zsh similarity index 100% rename from setup-testdirs.zsh rename to setup/testdirs.zsh diff --git a/setup-xfstests.zsh b/setup/xfstests.zsh similarity index 73% rename from setup-xfstests.zsh rename to setup/xfstests.zsh index 94105b4..5a6179a 100755 --- a/setup-xfstests.zsh +++ b/setup/xfstests.zsh @@ -16,5 +16,5 @@ groupadd fsgqa 2>/dev/null useradd --badnames 123456-fsgqa 2>/dev/null useradd fsgqa2 2>/dev/null -setup-testdirs.zsh $SERVER $EXPORT $MOUNTPOINT $USER -setup-testdirs.zsh $SERVER $SCRATCH $SCRATCHMNT $USER +setup.zsh testdirs.zsh $SERVER $EXPORT $MOUNTPOINT $USER +setup.zsh testdirs.zsh $SERVER $SCRATCH $SCRATCHMNT $USER diff --git a/xfstests.zsh b/xfstests.zsh index 418764d..ec8cc99 100755 --- a/xfstests.zsh +++ b/xfstests.zsh @@ -15,7 +15,6 @@ zparseopts -D -K \ v+:=VERSION -version+:=VERSION COLOR=$BIN/colors/xfstests.py -RUN_XFSTESTS="sudo run-xfstests.zsh" OPTIONS="sec=sys" RESULT_BASE=$HOME/.local/share/xfstests/ DATE=$(date +%Y-%m-%d-%H:%M:%S%z) @@ -34,9 +33,9 @@ fi # function setup_client_func() { - ssh ${CLIENT[-1]} "sudo setup-xfstests.zsh ${SERVER[-1]} \ - ${EXPORT[-1]} ${MOUNTPOINT[-1]} \ - ${SCRATCH[-1]} ${SCRATCHMNT[-1]} $USER" + client_setup xfstests.zsh ${SERVER[-1]} ${EXPORT[-1]} \ + ${MOUNTPOINT[-1]} ${SCRATCH[-1]} \ + ${SCRATCHMNT[-1]} $USER } prepare_to_test if [ ${#NCONNECT} -gt 0 ]; then @@ -49,15 +48,15 @@ for arg in $*; do done run_xfs_tests() { - ssh ${CLIENT[-1]} "$RUN_XFSTESTS --server ${SERVER[-1]} \ - --export ${EXPORT[-1]} \ - --mountpoint ${MOUNTPOINT[-1]} \ - --scratch ${SCRATCH[-1]} \ - --scratchmnt ${SCRATCHMNT[-1]} \ - --proto $1 \ - --version $2 \ - --opts $OPTIONS \ - --user $USER $testargs" | python $COLOR $1 $2 + client_run xfstests.zsh --server ${SERVER[-1]} \ + --export ${EXPORT[-1]} \ + --mountpoint ${MOUNTPOINT[-1]} \ + --scratch ${SCRATCH[-1]} \ + --scratchmnt ${SCRATCHMNT[-1]} \ + --proto $1 \ + --version $2 \ + --opts $OPTIONS \ + --user $USER $testargs | python $COLOR $1 $2 scp -q ${CLIENT[-1]}:$REMOTE_RESULTS/$1/$2/result.xml $TMP_RESULTS/$1-$2.xml }