From 7a92716fb5147461b9c386038decff1540c1f2dd Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 19 Mar 2008 14:24:32 +0100 Subject: [PATCH] Replaced COMP_SANDBOX_INIT and SANDBOX_INIT by (PRE|POST)_(COMPILE|RUN)_HOOK. --- bin/lib | 18 ++++++++++++++++-- config | 12 ++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bin/lib b/bin/lib index 9c07465..19ff00e 100644 --- a/bin/lib +++ b/bin/lib @@ -196,7 +196,10 @@ function compile COMP_SANDBOX_OPTS=$(expand-var COMP_SANDBOX_OPTS) echo "Compiler command: $CCMD" echo "Compiler sandbox options: $COMP_SANDBOX_OPTS" - eval $COMP_SANDBOX_INIT + if [ -n "$PRE_COMPILE_HOOK" ] ; then + echo "Pre-compile hook: $PRE_COMPILE_HOOK" + eval $PRE_COMPILE_HOOK + fi echo "Compiler input files:" ls -Al $BOXDIR @@ -209,6 +212,10 @@ function compile fi cat $TDIR/compile.out rm $TDIR/compile.out + if [ -n "$POST_COMPILE_HOOK ] ; then + echo "Post-compile hook: $POST_COMPILE_HOOK" + eval $POST_COMPILE_HOOK + fi echo "Compiler output files:" ls -Al $BOXDIR if [ ! -f $BOXDIR/$PROBLEM ] ; then @@ -319,13 +326,20 @@ function test-prolog esac echo "Timeout: $TIME_LIMIT s" echo "Memory: $MEM_LIMIT KB" - eval $SANDBOX_INIT + if [ -n "$PRE_RUN_HOOK" ] ; then + echo "Pre-run hook: $PRE_RUN_HOOK" + eval $PRE_RUN_HOOK + fi echo "Sandbox contents before start:" ls -Al $BOXDIR } function test-epilog { + if [ -n "$POST_RUN_HOOK" ] ; then + echo "Post-run hook: $POST_RUN_HOOK" + eval $POST_RUN_HOOK + fi echo "Sandbox contents after exit:" ls -Al $BOXDIR case ${OUT_TYPE:-$IO_TYPE} in diff --git a/config b/config index 8e88612..43beb07 100644 --- a/config +++ b/config @@ -52,13 +52,16 @@ COMP=false # Sandbox options used when compiling COMP_SANDBOX_OPTS='-m262144 -w60 -e -i/dev/null' -# Sandbox initialization commands for compilation -COMP_SANDBOX_INIT= - # Translation of runtime errors: a function, which receives the exit code as an argument and # if it is recognized as a runtime error code, it prints its name to the standard output. EXIT_CODE_HOOK= +# Hooks which can alter the contents of the sandbox in $BOXDIR before/after compilation/running +PRE_COMPILE_HOOK= +POST_COMPILE_HOOK= +PRE_RUN_HOOK= +POST_RUN_HOOK= + ## Settings for individual languages # C @@ -152,9 +155,6 @@ TEST_SANDBOX_OPTS='-a2 -f -m$MEM_LIMIT -t$TIME_LIMIT $BOX_EXTRAS' # Extra options to be overridden in task configuration BOX_EXTRAS= -# Sandbox initialization commands -SANDBOX_INIT= - ### Debugging and testing # DEBUG: Let `ev' run sample tests, too. -- 2.39.2