-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from contour-terminal/improvement/tb-and-overa…
…ll-run Fixes an infinite loop in termbnech.cpp and add some overall improvements
- Loading branch information
Showing
6 changed files
with
177 additions
and
86 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Usage: Xvfb-contour-run.sh <contour-args> | ||
# Usage: Xvfb-bench-run.sh <path-to-tb-executable> | ||
|
||
set -x | ||
TB_BIN="${1:-${TB_BIN}}" | ||
CONTOUR_BIN="${CONTOUR_BIN:-contour}" | ||
KITTY_BIN="${KITTY_BIN:-kitty}" | ||
XTERM_BIN="${XTERM_BIN:-xterm}" | ||
ALACRITTY_BIN="${ALACRITTY_BIN:-alacritty}" | ||
FB_DISPLAY="${FB_DISPLAY:-:99}" | ||
|
||
OUTPUT_DIR="${PWD}" | ||
|
||
if [[ "$TB_BIN" == "" ]]; then | ||
echo "Usage: $0 <path-to-tb-executable>" | ||
exit 1 | ||
fi | ||
|
||
function require_bin() { | ||
local tool="${1}" | ||
if ! which "${tool}" >/dev/null; then | ||
echo 1>&2 "$0: Could not find the required tool ${tool}." | ||
exit 1 | ||
fi | ||
} | ||
|
||
require_bin Xvfb | ||
require_bin "${TB_BIN}" | ||
require_bin "${CONTOUR_BIN}" | ||
require_bin "${KITTY_BIN}" | ||
require_bin "${XTERM_BIN}" | ||
require_bin "${ALACRITTY_BIN}" | ||
|
||
export TB_BIN=$(realpath $TB_BIN) | ||
export DISPLAY=${FB_DISPLAY} | ||
export LIBGL_ALWAYS_SOFTWARE="${LIBGL_ALWAYS_SOFTWARE:-true}" | ||
|
||
LIBGL_ALWAYS_SOFTWARE="${LIBGL_ALWAYS_SOFTWARE:-true}" | ||
DISPLAY=:99 | ||
export LIBGL_ALWAYS_SOFTWARE | ||
export DISPLAY | ||
function program_exit() { | ||
local exit_code=$1 | ||
if [[ "$GITHUB_OUTPUT" != "" ]]; then | ||
echo "exitCode=$exit_code" >> "$GITHUB_OUTPUT" | ||
fi | ||
exit $exit_code | ||
} | ||
|
||
function bench_terminal() { | ||
printf "\033[1m==> Running terminal: $1\033[m\n" | ||
local terminal_name=$(basename $1) | ||
time "${@}" -e "${TB_BIN}" --fixed-size --stdout-fastpath --column-by-column --output "${OUTPUT_DIR}/${terminal_name}_results" | ||
local exit_code=$? | ||
printf "\033[1m==> Terminal exit code: $exit_code\033[m\n" | ||
if [[ $exit_code -ne 0 ]]; then | ||
program_exit $exit_code | ||
fi | ||
} | ||
|
||
set -x | ||
|
||
Xvfb $DISPLAY -screen 0 1280x1024x24 & | ||
XVFB_PID=$! | ||
trap "kill $XVFB_PID" EXIT | ||
|
||
sleep 3 | ||
|
||
TB_BIN=$PWD/build/tb/tb | ||
bench_terminal "${CONTOUR_BIN}" display ${DISPLAY} | ||
bench_terminal "${KITTY_BIN}" | ||
bench_terminal "${XTERM_BIN}" -display ${DISPLAY} | ||
bench_terminal "${ALACRITTY_BIN}" | ||
|
||
contour display ${DISPLAY} $TB_BIN --output contour_results | ||
mv $HOME/contour_results . | ||
kitty -e $TB_BIN --output kitty_results | ||
xterm -display ${DISPLAY} -e $TB_BIN --output xterm_results | ||
alacritty -e $TB_BIN --output alacritty_results | ||
|
||
if [[ "$GITHUB_OUTPUT" != "" ]]; then | ||
echo "exitCode=$?" >> "$GITHUB_OUTPUT" | ||
fi | ||
program_exit 0 |
This file contains 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
Oops, something went wrong.