some testing and benchmarking fixes
This commit is contained in:
parent
f1ef8013a5
commit
cf1619acb3
45
Dockerfile
45
Dockerfile
|
@ -1,40 +1,7 @@
|
|||
ARG RUBY_VERSION=2.6.10
|
||||
FROM ruby:$RUBY_VERSION
|
||||
|
||||
ARG TMUX_VERSION=3.2
|
||||
|
||||
COPY spec/use-tmux.sh /tmp/use-tmux.sh
|
||||
COPY spec/install-tmux-versions.sh /tmp/install-tmux-versions.sh
|
||||
|
||||
# Run CI scripts
|
||||
RUN CI_TMUX_VERSION=$TMUX_VERSION /tmp/install-tmux-versions.sh
|
||||
RUN /tmp/use-tmux.sh $TMUX_VERSION
|
||||
|
||||
# Install linux-perf
|
||||
RUN apt-get update && apt-get install -y linux-perf-5.10
|
||||
|
||||
# Mock action stub globally
|
||||
RUN ln -s /app/spec/action-stub.sh /usr/local/bin/action-stub
|
||||
|
||||
# Install hyperfine
|
||||
RUN wget https://github.com/sharkdp/hyperfine/releases/download/v1.13.0/hyperfine_1.13.0_amd64.deb
|
||||
RUN dpkg -i hyperfine_1.13.0_amd64.deb
|
||||
|
||||
COPY Gemfile /app/Gemfile
|
||||
COPY Gemfile.lock /app/Gemfile.lock
|
||||
FROM crystallang/crystal:latest-alpine
|
||||
RUN apk upgrade && apk add bash libevent-dev ncurses-dev ncurses hyperfine
|
||||
COPY ./spec/install-tmux-versions.sh /opt/install-tmux-versions.sh
|
||||
COPY ./spec/use-tmux.sh /opt/use-tmux.sh
|
||||
RUN bash /opt/install-tmux-versions.sh
|
||||
WORKDIR /app
|
||||
|
||||
# Install ruby stuff
|
||||
RUN gem install bundler
|
||||
RUN bundle install
|
||||
|
||||
# Install rbspy
|
||||
RUN wget https://github.com/rbspy/rbspy/releases/download/v0.12.1/rbspy-x86_64-musl.tar.gz -O /tmp/rbspy.tar.gz
|
||||
RUN cd /tmp && tar pfx /tmp/rbspy.tar.gz
|
||||
RUN mv /tmp/rbspy-x86_64-musl /usr/local/bin/rbspy
|
||||
RUN chmod a+x /usr/local/bin/rbspy
|
||||
|
||||
# Expose byebug remote debugging port
|
||||
EXPOSE 1048
|
||||
|
||||
CMD ["bundle", "exec", "rspec"]
|
||||
CMD ["/bin/sh"]
|
||||
|
|
7
Makefile
7
Makefile
|
@ -2,9 +2,4 @@ default:
|
|||
docker build . -t fingers
|
||||
|
||||
shell: default
|
||||
docker run -it --rm fingers /bin/bash
|
||||
|
||||
perf: default
|
||||
docker run --security-opt seccomp=./docker-perf.json -it --rm fingers /bin/bash
|
||||
#latest:
|
||||
#docker build . -t fingers:ruby-latest-tmux-latest --build_arg TMUX_VERSION=3.3-rc --build-arg RUBY_VERSION=latest
|
||||
docker run -it --rm -v $(shell pwd):/app fingers bash
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# requires nfs-utils on host
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.provider 'virtualbox' do |v|
|
||||
v.customize ['modifyvm', :id, '--cpuexecutioncap', '50']
|
||||
end
|
||||
|
||||
config.vm.define 'ubuntu' do |machine|
|
||||
machine.vm.box = 'ubuntu/focal64'
|
||||
machine.vm.synced_folder '.', '/home/vagrant/shared'
|
||||
machine.vm.provision 'shell', path: './spec/provisioning/ubuntu.sh'
|
||||
end
|
||||
end
|
16
benchmark.sh
16
benchmark.sh
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
tmux -f spec/conf/benchmark.conf new-session -d
|
||||
tmux resize-window -t '@0' -x 300 -y 100
|
||||
tmux send-keys 'COLUMNS=$COLUMNS LINES=$LINES ruby spec/fill_screen.rb'
|
||||
/opt/use-tmux.sh 3.3a
|
||||
|
||||
shards build --production
|
||||
tmux -f /app/spec/conf/benchmark.conf new-session -d
|
||||
tmux resize-window -t '@0' -x 300 -y 300
|
||||
tmux send-keys 'COLUMNS=300 LINES=100 crystal run spec/fill_screen.cr'
|
||||
tmux send-keys Enter
|
||||
|
||||
#tmux send-keys 'rbspy record -f /app/shared/report.svg -- /usr/local/bin/ruby --disable-gems bin/fingers start fingers-mode $TMUX_PANE self'
|
||||
#tmux send-keys Enter
|
||||
sleep 5
|
||||
|
||||
tmux send-keys 'hyperfine "/usr/local/bin/ruby --disable-gems bin/fingers trace_start"'
|
||||
#tmux send-keys 'hyperfine "/usr/local/bin/ruby --disable-gems bin/fingers start fingers-mode $TMUX_PANE self"'
|
||||
tmux send-keys Enter
|
||||
tmux new-window 'hyperfine --warmup 5 "bin/tmux-fingers start %0 self" --export-markdown /tmp/benchmark-output'
|
||||
|
|
|
@ -113,7 +113,7 @@ tmux display-menu -T "tmux-fingers" \
|
|||
"- $(get_message) " "" "" \
|
||||
"- " "" ""\
|
||||
"" \
|
||||
"$(binary_or_brew_label)" b "popup -E \"$CURRENT_DIR/install-wizard.sh $(binary_or_brew_action)\"" \
|
||||
"Build from source" s "popup -E \"$CURRENT_DIR/install-wizard.sh install-from-source\"" \
|
||||
"$(binary_or_brew_label)" b "new-window \"$CURRENT_DIR/install-wizard.sh $(binary_or_brew_action)\"" \
|
||||
"Build from source" s "new-window \"$CURRENT_DIR/install-wizard.sh install-from-source\"" \
|
||||
"" \
|
||||
"Exit" q ""
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
set -g prefix C-a
|
||||
set -g default-terminal 'screen-256color'
|
||||
run '/app/tmux-fingers.tmux'
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
set -g prefix C-a
|
||||
set -g @fingers-trace-perf '1'
|
||||
set -g @fingers-benchmark-mode '1'
|
||||
set -g default-terminal 'screen-256color'
|
||||
run '/app/tmux-fingers.tmux'
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
require "uuid"
|
||||
|
||||
SEGMENT_LENGTH = 16
|
||||
COLUMNS = ENV["COLUMNS"].to_i
|
||||
LINES = ENV["LINES"].to_i
|
||||
|
||||
def compute_divisions
|
||||
result = (COLUMNS / SEGMENT_LENGTH).floor.to_i
|
||||
|
||||
loop do
|
||||
break if (result * SEGMENT_LENGTH + (result - 1)) <= COLUMNS
|
||||
result = result - 1
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
DIVISIONS = compute_divisions
|
||||
|
||||
LINES.times do
|
||||
codes = [] of String
|
||||
|
||||
DIVISIONS.times do
|
||||
codes << UUID.random.to_s.gsub("-", "").to_s[0..SEGMENT_LENGTH - 1]
|
||||
end
|
||||
|
||||
puts codes.join(" ")
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
require 'securerandom'
|
||||
|
||||
ENV['LINES'].to_i.times do
|
||||
codes = []
|
||||
(ENV['COLUMNS'].to_i / 16 - 1).times do
|
||||
codes << SecureRandom.hex(8).to_s.tr('abcdef', '123456')
|
||||
end
|
||||
|
||||
puts codes.join(' ')
|
||||
end
|
|
@ -3,11 +3,11 @@
|
|||
if [[ -n "$CI_TMUX_VERSION" ]]; then
|
||||
VERSIONS=("$CI_TMUX_VERSION")
|
||||
else
|
||||
VERSIONS=("2.1" "2.2" "2.3" "2.4" "2.5" "2.6" "2.7" "2.8" "2.9" "2.9a" "3.0" "3.0a")
|
||||
VERSIONS=("3.0a" "3.1c" "3.2a" "3.3a")
|
||||
fi
|
||||
|
||||
sudo mkdir -p /opt
|
||||
sudo chmod a+w /opt
|
||||
mkdir -p /opt
|
||||
chmod a+w /opt
|
||||
|
||||
pushd /tmp
|
||||
for version in "${VERSIONS[@]}";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require "spec"
|
||||
require "../../spec_helper.cr"
|
||||
require "../../../src/fingers/hinter"
|
||||
require "../../../src/fingers/state"
|
||||
require "../../../src/fingers/config"
|
||||
|
|
|
@ -4,13 +4,13 @@ require "../../src/priority_queue"
|
|||
describe PriorityQueue do
|
||||
it "transforms tmux status line format into escape sequences" do
|
||||
test = [
|
||||
[6, "drink tea"],
|
||||
[3, "Clear drains"],
|
||||
[4, "Feed cat"],
|
||||
[6, "drink tea"],
|
||||
[5, "Make tea"],
|
||||
[6, "eat biscuit"],
|
||||
[1, "Solve RC tasks"],
|
||||
[4, "Feed cat"],
|
||||
[7, "eat biscuit"],
|
||||
[2, "Tax return"],
|
||||
[1, "Solve RC tasks"],
|
||||
]
|
||||
|
||||
results = [] of String
|
||||
|
@ -25,13 +25,13 @@ describe PriorityQueue do
|
|||
end
|
||||
|
||||
expected = [
|
||||
"Solve RC tasks",
|
||||
"Tax return",
|
||||
"Clear drains",
|
||||
"Feed cat",
|
||||
"Make tea",
|
||||
"drink tea",
|
||||
"eat biscuit",
|
||||
"drink tea",
|
||||
"Make tea",
|
||||
"Feed cat",
|
||||
"Clear drains",
|
||||
"Tax return",
|
||||
"Solve RC tasks",
|
||||
]
|
||||
|
||||
results.should eq expected
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
require "./spec_helper"
|
||||
require "../src/tmux"
|
||||
|
||||
describe Tmux do
|
||||
it "returns a semantic version for versions without letters" do
|
||||
result = Tmux.tmux_version_to_semver("3.1")
|
||||
result.major.should eq 3
|
||||
result.minor.should eq 1
|
||||
result.patch.should eq 0
|
||||
end
|
||||
|
||||
it "returns a semantic version for versions with letters" do
|
||||
result = Tmux.tmux_version_to_semver("3.1b")
|
||||
result.major.should eq 3
|
||||
result.minor.should eq 1
|
||||
result.patch.should eq 2
|
||||
end
|
||||
|
||||
it "returns a semantic version for versions with letters" do
|
||||
result = Tmux.tmux_version_to_semver("3.3a")
|
||||
result.major.should eq 3
|
||||
result.minor.should eq 3
|
||||
result.patch.should eq 1
|
||||
end
|
||||
|
||||
it "returns comparable semversions" do
|
||||
result = Tmux.tmux_version_to_semver("3.0a") >= Tmux.tmux_version_to_semver("3.1")
|
||||
|
||||
result.should eq false
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
version="$1"
|
||||
rm -rf /usr/bin/tmux
|
||||
rm -rf /usr/local/bin/tmux
|
||||
ln -s /opt/tmux-${version}/tmux /usr/local/bin/tmux
|
||||
ln -s /opt/tmux-${version}/tmux /usr/bin/tmux
|
||||
|
|
|
@ -43,6 +43,8 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
|
|||
config.alt_action = value
|
||||
when "shift_action"
|
||||
config.shift_action = value
|
||||
when "benchmark_mode"
|
||||
config.benchmark_mode = value
|
||||
when "hint_style"
|
||||
config.hint_style = tmux.parse_style(value)
|
||||
when "selected_hint_style"
|
||||
|
|
|
@ -31,6 +31,10 @@ module Fingers::Commands
|
|||
track_options_to_restore!
|
||||
show_hints
|
||||
|
||||
if Fingers.config.benchmark_mode == "1"
|
||||
exit(0)
|
||||
end
|
||||
|
||||
handle_input
|
||||
|
||||
teardown
|
||||
|
|
|
@ -8,6 +8,7 @@ module Fingers
|
|||
property keyboard_layout : String
|
||||
property patterns : Array(String)
|
||||
property alphabet : Array(String)
|
||||
property benchmark_mode : String
|
||||
property main_action : String
|
||||
property ctrl_action : String
|
||||
property alt_action : String
|
||||
|
@ -69,7 +70,8 @@ module Fingers
|
|||
@selected_highlight_style = FORMAT_PRINTER.print("fg=green,dim"),
|
||||
@highlight_style = FORMAT_PRINTER.print("fg=yellow,dim"),
|
||||
@backdrop_style = FORMAT_PRINTER.print("bg=black,fg=color250"),
|
||||
@tmux_version = ""
|
||||
@tmux_version = "",
|
||||
@benchmark_mode = "0"
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue