From f0b99910f3558a426bcc80e2aff54c5d0428e5bb Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 6 Jul 2018 22:49:55 -0700 Subject: 4313 - some helpers for managing test binaries I'm getting sick of hitting the key. --- subx/edit | 10 ++++++++++ subx/g | 14 ++++++++++++++ subx/g2 | 14 ++++++++++++++ subx/gen | 46 ++++++++++++++++++++++++++++++++++++++++++++++ subx/nrun | 10 ++++++++++ subx/run | 10 ++++++++++ subx/teensy/vimrc.vim | 1 + 7 files changed, 105 insertions(+) create mode 100755 subx/edit create mode 100755 subx/g create mode 100755 subx/g2 create mode 100755 subx/gen create mode 100755 subx/nrun create mode 100755 subx/run create mode 100644 subx/teensy/vimrc.vim diff --git a/subx/edit b/subx/edit new file mode 100755 index 00000000..39aa9d38 --- /dev/null +++ b/subx/edit @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh +# Open a specific example. + +if [ $# -eq 0 ] +then + echo "edit " + exit 1 +fi + +$EDITOR ./teensy/test$1*.[cs] diff --git a/subx/g b/subx/g new file mode 100755 index 00000000..dc57cceb --- /dev/null +++ b/subx/g @@ -0,0 +1,14 @@ +#!/usr/bin/env zsh +# Run git commands on a specific example's source. + +if [ $# -eq 0 ] +then + echo "g " + exit 1 +fi + +arg=( $* ) +suffix=$arg[${#arg[@]}] +unset "arg[${#arg[@]}]" + +git ${arg[@]} ./teensy/test$suffix*.[cs] diff --git a/subx/g2 b/subx/g2 new file mode 100755 index 00000000..03b356f3 --- /dev/null +++ b/subx/g2 @@ -0,0 +1,14 @@ +#!/usr/bin/env zsh +# Run git commands on a specific example's generated binary. + +if [ $# -eq 0 ] +then + echo "g " + exit 1 +fi + +arg=( $* ) +suffix=$arg[${#arg[@]}] +unset "arg[${#arg[@]}]" + +git ${arg[@]} ./teensy/test$suffix diff --git a/subx/gen b/subx/gen new file mode 100755 index 00000000..d8465bc0 --- /dev/null +++ b/subx/gen @@ -0,0 +1,46 @@ +#!/usr/bin/env zsh +# Build a specific example. + +if [ $1 -eq 1 ] +then + gcc -Wall -s teensy/test1.c -o teensy/test1 + exit $? +fi + +if [ $1 -eq 2 ] +then + nasm -f elf teensy/test2.s && gcc -Wall -s teensy/test2.o -o teensy/test2 + exit $? +fi + +if [ $1 -eq 3 ] +then + nasm -f elf teensy/test3.s && gcc -Wall -s -nostartfiles teensy/test3.o -o teensy/test3 + exit $? +fi + +if [ $1 -eq 4 ] +then + nasm -f elf teensy/test4.s && gcc -Wall -s -nostdlib teensy/test4.o -o teensy/test4 + exit $? +fi + +if [ $1 -eq 5 ] +then + nasm -f bin teensy/test5.s -o teensy/test5 && chmod +x teensy/test5 + exit $? +fi + +if [ $1 -eq 6 ] +then + nasm -f elf teensy/test6-global.s && gcc -Wall -s teensy/test6-global.o -o teensy/test6 + exit $? +fi + +if [ $1 -eq 7 ] +then + nasm -f bin teensy/test7-global.s -o teensy/test7 && chmod +x teensy/test7 + exit $? +fi + +exit 127 diff --git a/subx/nrun b/subx/nrun new file mode 100755 index 00000000..f5c22dee --- /dev/null +++ b/subx/nrun @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh +# Natively run a specific example. + +if [ $# -eq 0 ] +then + echo "nrun " + exit 1 +fi + +./teensy/test$1 diff --git a/subx/run b/subx/run new file mode 100755 index 00000000..bc55c720 --- /dev/null +++ b/subx/run @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh +# Simulate a specific example using subx. + +if [ $# -eq 0 ] +then + echo "run " + exit 1 +fi + +CFLAGS=-g subx run teensy/test$1 diff --git a/subx/teensy/vimrc.vim b/subx/teensy/vimrc.vim new file mode 100644 index 00000000..68b63640 --- /dev/null +++ b/subx/teensy/vimrc.vim @@ -0,0 +1 @@ +command! -nargs=1 EE exec "vert split teensy/test" . . "*.[cs]" -- cgit 1.4.1-2-gfad0