kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 0609d4f5481ce17a1ee7479c4c06da48de9f3ec3
parent 08390c2d35ae822a809dbab87bf54984052ea044
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Thu, 16 Jul 2026 10:37:57 -0700

test: cover strip and size dash operands

Diffstat:
Atest/strip/cases/06-leading-dash-with-double-dash.expected | 2++
Atest/strip/cases/06-leading-dash-with-double-dash.sh | 23+++++++++++++++++++++++
Mtest/tools/run.sh | 16++++++++++++++++
3 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/test/strip/cases/06-leading-dash-with-double-dash.expected b/test/strip/cases/06-leading-dash-with-double-dash.expected @@ -0,0 +1,2 @@ +direct: ok +alias: ok diff --git a/test/strip/cases/06-leading-dash-with-double-dash.sh b/test/strip/cases/06-leading-dash-with-double-dash.sh @@ -0,0 +1,23 @@ +# A leading-dash operand is unambiguous after `--`, both through `kit strip` +# and an installed multicall alias. +cat > dash.c <<'EOF' +int dash_symbol(void) { return 7; } +EOF +"$KIT" cc -g -c dash.c -o ./-dash.o + +if "$KIT" strip --strip-debug -o direct.o -- -dash.o && + "$KIT" objdump -h direct.o >/dev/null; then + echo "direct: ok" +else + echo "direct: failed" + exit 1 +fi + +ln -s "$KIT" strip +if ./strip --strip-debug -o alias.o -- -dash.o && + "$KIT" objdump -h alias.o >/dev/null; then + echo "alias: ok" +else + echo "alias: failed" + exit 1 +fi diff --git a/test/tools/run.sh b/test/tools/run.sh @@ -400,6 +400,22 @@ if [ "$?" -eq 0 ]; then ok image-double-dash; else not_ok image-double-dash "$work/image-dash.err" fi same_file image-double-dash-bytes "$work/kernel.bin" "$work/kernel.dash.bin" +cp "$work/kernel.elf" "$work/-size.elf" +(cd "$work" && "$KIT" size -- -size.elf) \ + > "$work/size-dash.out" 2> "$work/size-dash.err" +if [ "$?" -eq 0 ] && grep -q 'text' "$work/size-dash.out"; then + ok size-double-dash +else + not_ok size-double-dash "$work/size-dash.err" +fi +ln -s "$KIT" "$work/size" +(cd "$work" && ./size -- -size.elf) \ + > "$work/size-alias-dash.out" 2> "$work/size-alias-dash.err" +if [ "$?" -eq 0 ] && grep -q 'text' "$work/size-alias-dash.out"; then + ok size-alias-double-dash +else + not_ok size-alias-double-dash "$work/size-alias-dash.err" +fi run_ok image-paddr "$KIT" image --format bin --addr paddr "$work/kernel.elf" \ -o "$work/kernel.paddr.bin" same_file image-paddr-matches-vaddr "$work/kernel.bin" "$work/kernel.paddr.bin"