From 43d6d2059832a0b0cd42f3c2916eb61bfa0b81a2 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Fri, 28 Dec 2018 23:29:13 +0800 Subject: [PATCH] fix -xchibi.primitive and spurious output in snow-chibi (thanks Martin Hayman) --- main.c | 1 + tests/run/command-line-tests.sh | 7 ++++--- tests/run/test08-xchibi-primitive.args | 2 +- tools/snow-chibi | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 6c31c3e3..5b4809ab 100644 --- a/main.c +++ b/main.c @@ -362,6 +362,7 @@ sexp run_main (int argc, char **argv) { arg = ((argv[i][2] == '\0') ? argv[++i] : argv[i]+2); if (c == 'x') { if (strcmp(arg, "chibi.primitive") == 0) { + argv[i][2] = '\0'; goto load_primitive; } else if (strcmp(arg, "scheme.small") == 0) { load_init(0); diff --git a/tests/run/command-line-tests.sh b/tests/run/command-line-tests.sh index 7e853e34..78fe5316 100755 --- a/tests/run/command-line-tests.sh +++ b/tests/run/command-line-tests.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Test chibi-scheme command-line options. # Should be run from a standard build. @@ -12,13 +12,14 @@ run_chibi() { } for t in $TESTDIR/*.args; do - IFS=$'\r\n' GLOBIGNORE='*' :; args=($(cat $t)) - run_chibi ${args[@]} 2> ${t%.args}.err > ${t%.args}.out + IFS=$'\n' read -d '' -r -a args < $t + run_chibi "${args[@]}" 2> ${t%.args}.err > ${t%.args}.out if diff -w -q ${t%.args}.out ${t%.args}.res \ && ([ ! -e ${t%.args}.err-res ] || \ diff -w -q ${t%.args}.err ${t%.args}.err-res); then echo "[PASS] $(basename ${t%.args})" else + echo chibi "${args[@]}" echo "[FAIL] $(basename ${t%.args})" FAILURES=$((FAILURES + 1)) fi diff --git a/tests/run/test08-xchibi-primitive.args b/tests/run/test08-xchibi-primitive.args index 7f9e955a..277ef830 100644 --- a/tests/run/test08-xchibi-primitive.args +++ b/tests/run/test08-xchibi-primitive.args @@ -1,2 +1,2 @@ --x(chibi primitive) +-xchibi.primitive -p(+ 2 2) diff --git a/tools/snow-chibi b/tools/snow-chibi index 515fa4b5..54cf4a0f 100755 --- a/tools/snow-chibi +++ b/tools/snow-chibi @@ -2,7 +2,7 @@ CHIBI=${CHIBI:-chibi-scheme} IMG=-isnow.img -if [ -x ./chibi-scheme ] && ! type $CHIBI 2>/dev/null; then +if [ -x ./chibi-scheme ] && ! type $CHIBI >/dev/null 2>/dev/null; then # convenience for running from dev, notable "make test-snow" CHIBI="./chibi-scheme" export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"