From: Martin Mares Date: Sun, 3 Feb 2008 22:47:58 +0000 (+0100) Subject: Call `expand-var' for all variable expansions. X-Git-Tag: python-dummy-working~242 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e2dc5896c7c8572a0af1d9ee2ef3da447bb9f71b;p=moe.git Call `expand-var' for all variable expansions. This is a new function which does the same as the original expansions, but this is going to change soon. --- diff --git a/bin/lib b/bin/lib index 2e9ed7e..5adeca6 100644 --- a/bin/lib +++ b/bin/lib @@ -49,6 +49,13 @@ function try-ln ln $1 $2 2>/dev/null || cp $1 $2 } +# Expand occurrences of `$var' in a given variable + +function expand-var +{ + eval echo ${!1} +} + # Given a , override each variable by _ function override-vars @@ -177,8 +184,8 @@ function compile box-clean for a in $SRC $COMP_EXTRAS ; do cp $TDIR/$a $BOXDIR/ ; done EXE=$PROBLEM - CCMD=`eval echo $COMP` - COMP_SANDBOX_OPTS=`eval echo $COMP_SANDBOX_OPTS` + CCMD=$(expand-var COMP) + COMP_SANDBOX_OPTS=$(expand-var COMP_SANDBOX_OPTS) echo "Compiler command: $CCMD" echo "Compiler sandbox options: $COMP_SANDBOX_OPTS" eval $COMP_SANDBOX_INIT @@ -332,7 +339,7 @@ function test-epilog if [ -n "$OUTPUT_FILTER" -a "$OUT_TYPE" != none -a -z "$EV_NOFILTER" ] ; then pcont " " - FILTER=`eval echo \"$OUTPUT_FILTER\"` + FILTER=$(expand-var OUTPUT_FILTER) echo "Output filter command: $FILTER" mv $TDIR/$TEST.out $TDIR/$TEST.raw if ! eval $FILTER 2>$TMPDIR/exec.out ; then @@ -351,7 +358,7 @@ function test-run-file { test-prolog pcont " " - BOXOPTS="`eval echo $TEST_SANDBOX_OPTS`$BOX_EXTRAS" + BOXOPTS="$(expand-var TEST_SANDBOX_OPTS) $(expand-var BOX_EXTRAS)" echo "Sandbox options: $BOXOPTS" if ! $BOXCMD $BOXOPTS -- ./$PROBLEM 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out @@ -368,9 +375,9 @@ function test-run-interactive { test-prolog pcont " " - BOXOPTS="`eval echo $TEST_SANDBOX_OPTS`$BOX_EXTRAS" + BOXOPTS="$(expand-var TEST_SANDBOX_OPTS) $(expand-var BOX_EXTRAS)" echo "Sandbox options: $BOXOPTS" - ICCMD=`eval echo $IA_CHECK` + ICCMD=$(expand-var IA_CHECK) echo "Interactive checker: $ICCMD" if ! $HDIR/bin/iwrapper $BOXCMD $BOXOPTS -- ./$PROBLEM @@ $ICCMD 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out @@ -396,7 +403,7 @@ function syntax-check [ -n "$SYNTAX_CHECK" ] || return 0 [ -z "$EV_NOCHECK" ] || return 0 pcont " " - SCHECK=`eval echo \"$SYNTAX_CHECK\"` + SCHECK=$(expand-var SYNTAX_CHECK) echo "Syntax check command: $SCHECK" if ! eval $SCHECK 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out @@ -415,7 +422,7 @@ function output-check if [ -n "$OUTPUT_CHECK" -a "$OUT_TYPE" != none -a -z "$EV_NOCHECK" ] ; then pcont " " [ -f $PDIR/$TEST.out ] && ln $PDIR/$TEST.out $TDIR/$TEST.ok - OCHECK=`eval echo \"$OUTPUT_CHECK\"` + OCHECK=$(expand-var OUTPUT_CHECK) echo "Output check command: $OCHECK" if ! eval $OCHECK 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out