transfer scripts from dorne to curstree
This commit is contained in:
parent
606171f090
commit
9d31afc224
2 changed files with 51 additions and 0 deletions
3
scripts/mk
Executable file
3
scripts/mk
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
$([ -x "$(command -v bear)" ] && echo 'bear -- ') make $@
|
||||
|
||||
48
scripts/test
Executable file
48
scripts/test
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
USAGE='test program [[run]-[valgrind]] ...'
|
||||
if [[ "$1" =~ help ]]; then
|
||||
echo "$USAGE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# === ARGPARSE
|
||||
MODE=
|
||||
REBUILD=true
|
||||
VALGRIND=false
|
||||
TARGET=debug
|
||||
PROGRAM="$1"
|
||||
MODE_ARG="$2"
|
||||
|
||||
if [[ "$MODE_ARG" =~ run.* ]]; then
|
||||
MODE="$MODE_ARG"
|
||||
REBUILD=false
|
||||
fi
|
||||
if [[ "$MODE_ARG" =~ .*valgrind ]]; then
|
||||
MODE="$MODE_ARG"
|
||||
VALGRIND=true
|
||||
PROXY='valgrind -s --log-file=logs/valgrind.log --leak-check=full --show-leak-kinds=all'
|
||||
TARGET=debug
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$MODE" ]]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
# === MAIN
|
||||
if [[ "$REBUILD" == true ]]; then
|
||||
make clean $TARGET
|
||||
fi
|
||||
|
||||
if [[ ! -x "$PROGRAM" ]]; then
|
||||
echo "[!] Invalid program: \"$PROGRAM\""
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p logs
|
||||
LD_LIBRARY_PATH=./lib $PROXY "$PROGRAM" $@
|
||||
|
||||
# If ncurses doesn't close gracefully, termios attributes
|
||||
# will require reinitialisation (not a reset! don't clear the screen!)
|
||||
tput init
|
||||
Loading…
Add table
Add a link
Reference in a new issue