diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-06 22:49:55 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-06 22:49:55 -0700 |
commit | f0b99910f3558a426bcc80e2aff54c5d0428e5bb (patch) | |
tree | 351abe9676ea14106127e65ce78d16633e0ac92b | |
parent | 5f1de34a679ab0b9c59067f7924f1c953917b53e (diff) | |
download | mu-f0b99910f3558a426bcc80e2aff54c5d0428e5bb.tar.gz |
4313 - some helpers for managing test binaries
I'm getting sick of hitting the <Tab> key.
-rwxr-xr-x | subx/edit | 10 | ||||
-rwxr-xr-x | subx/g | 14 | ||||
-rwxr-xr-x | subx/g2 | 14 | ||||
-rwxr-xr-x | subx/gen | 46 | ||||
-rwxr-xr-x | subx/nrun | 10 | ||||
-rwxr-xr-x | subx/run | 10 | ||||
-rw-r--r-- | subx/teensy/vimrc.vim | 1 |
7 files changed, 105 insertions, 0 deletions
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 <suffix>" + 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 <git command> <args> <suffix>" + 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 <git command> <args> <suffix>" + 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 <suffix>" + 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 <suffix>" + 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" . <args> . "*.[cs]" |