From 66b0571170560079b64afd39239165e9ca098d94 Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Wed, 2 Jan 2019 09:01:35 +0100 Subject: [PATCH 1/2] remove :poop: file --- test/tmuxomatic.rFvj4QV | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/tmuxomatic.rFvj4QV diff --git a/test/tmuxomatic.rFvj4QV b/test/tmuxomatic.rFvj4QV deleted file mode 100644 index e69de29..0000000 From 71507f53e8aed188f8e6934760eeead7a8d62e76 Mon Sep 17 00:00:00 2001 From: Jorge Morante Date: Wed, 2 Jan 2019 10:33:32 +0100 Subject: [PATCH 2/2] adding basic benchmarking stuff --- scripts/fingers.sh | 2 ++ scripts/tmux-fingers.sh | 2 ++ test/benchmark.sh | 50 ++++++++++++++++++++++++++++++ test/benchmarks/basic_benchmark.sh | 18 +++++++++++ test/conf/benchmark.conf | 5 +++ test/fixtures/benchmark | 42 +++++++++++++++++++++++++ 6 files changed, 119 insertions(+) create mode 100755 test/benchmark.sh create mode 100755 test/benchmarks/basic_benchmark.sh create mode 100644 test/conf/benchmark.conf create mode 100644 test/fixtures/benchmark diff --git a/scripts/fingers.sh b/scripts/fingers.sh index eb9533c..ecb630a 100755 --- a/scripts/fingers.sh +++ b/scripts/fingers.sh @@ -144,6 +144,8 @@ function run_fingers_copy_command() { fi } +# %BENCHMARK_END% + while read -rsn1 char; do # Escape sequence, flush input if [[ "$char" == $'\x1b' ]]; then diff --git a/scripts/tmux-fingers.sh b/scripts/tmux-fingers.sh index 1860084..96a2948 100755 --- a/scripts/tmux-fingers.sh +++ b/scripts/tmux-fingers.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# %BENCHMARK_START% + CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $CURRENT_DIR/utils.sh diff --git a/test/benchmark.sh b/test/benchmark.sh new file mode 100755 index 0000000..2dbb59c --- /dev/null +++ b/test/benchmark.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +target=$1 +benchmark_repo_path="/tmp/tmux-fingers-benchmark" + +function setup_window_size() { + stty cols 174 + stty rows 42 +} + +function snippet_for { + echo "echo \"\$(cat /tmp/benchmark-execution-id) $1 \$((\$(date +%s%N)/1000000))\" >> ~/shared/benchmark.log" +} + +function setup_benchmark_repo() { + echo "Setting up benchmark repo ..." + rm -rf "$benchmark_repo_path" + cp -r ~/shared "$benchmark_repo_path" + + pushd "$benchmark_repo_path" &> /dev/null + find . -type f | xargs sed -i "s!# %BENCHMARK_START%!$(snippet_for "start")!" + find . -type f | xargs sed -i "s!# %BENCHMARK_END%!$(snippet_for "end")!" + popd &> /dev/null +} + +function set_execution_id() { + execution_id="$(mktemp -u "benchmark.XXXXXX")" + echo "$execution_id" > /tmp/benchmark-execution-id +} + +if [[ "$target" == "within-vm" ]]; then + setup_window_size + setup_benchmark_repo + set_execution_id + + pushd "$benchmark_repo_path" &> /dev/null + for benchmark in $(ls $benchmark_repo_path/test/benchmarks/*.sh); do + + for i in {1..50}; do + echo "* Running $benchmark [ $i ]" + sleep 1 + $benchmark + done + done + popd &> /dev/null +elif [[ -z "$target" ]]; then + echo "Running benchmarks" + vagrant up "$target" &>> /dev/null + vagrant ssh "$target" -c "cd shared && ./test/benchmark.sh within-vm" 2> /dev/null +fi diff --git a/test/benchmarks/basic_benchmark.sh b/test/benchmarks/basic_benchmark.sh new file mode 100755 index 0000000..cc8009b --- /dev/null +++ b/test/benchmarks/basic_benchmark.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +#set -x + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $CURRENT_DIR/../tmuxomatic.sh +source $CURRENT_DIR/../helpers.sh + +tmuxomatic__begin begin_hook + +begin_with_conf "benchmark" + +init_pane +tmuxomatic__exec "cat ./test/fixtures/grep-output" +invoke_fingers +tmuxomatic send-keys "C-c" + +tmuxomatic__end end_hook diff --git a/test/conf/benchmark.conf b/test/conf/benchmark.conf new file mode 100644 index 0000000..c329472 --- /dev/null +++ b/test/conf/benchmark.conf @@ -0,0 +1,5 @@ +set -g prefix C-a +set -g @fingers-compact-hints '0' +set -g default-terminal 'screen-256color' +run /tmp/tmux-fingers-benchmark/tmux-fingers.tmux + diff --git a/test/fixtures/benchmark b/test/fixtures/benchmark new file mode 100644 index 0000000..271600e --- /dev/null +++ b/test/fixtures/benchmark @@ -0,0 +1,42 @@ + +265982390429758 21362301420008 214882893312190 11554155254778 +93112662828415 1861636117514 24293224364897 11616967922589 +149561703515620 147192438517408 119362656132653 259473161016622 +26182816618282 749425011333 147894782452 6442732125800 +3537130105336 141162223621551 91591152616370 171632212717214 +297263221030670 31198631515200 2000545606028 145532950528175 +18022140422319 177071079827303 110342670114356 185239264440 +222352552627429 198841343024320 284501924918415 319402012730857 +37673530947 1488750949859 231481731431188 13193123525466 +7013796711758 11432920120193 635473127653 3101985454008 +68503003211186 28808147557353 5611755517014 7416147411419 +3129768624280 267571483317777 851621635652 10455258643735 +9061703118615 19579308143142 2148192128021 6173076710102 +35102323818615 320662001031610 181373169332438 21549634016318 +13298366824787 158073252417041 677227996806 4954163968740 +23115783425287 64631276326967 111312908917157 182592183213454 +84301535915650 5743953160 18438947914073 29497177372166 +22316194161386 132972607318923 147362181313176 10183176899020 +4437348216794 6735342623369 13226397113030 2250832389266 +66412833810787 181691605229889 18876812529962 1789342018621 +912106516920 220161710416067 99612181032344 15138301620065 +26851651615927 183051502617127 277012151320289 244882340415011 +240402604016713 303082422917199 4209180631952 3249713933226 +28137793427901 314413187918194 27778518525320 16978203091898 +2419179329323 10115128533863 4448323724928 25533123582200 + + + + + + + + + + + + + + + +