]> mj.ucw.cz Git - moe.git/commitdiff
Replaced COMP_SANDBOX_INIT and SANDBOX_INIT by (PRE|POST)_(COMPILE|RUN)_HOOK.
authorMartin Mares <mj@ucw.cz>
Wed, 19 Mar 2008 13:24:32 +0000 (14:24 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 19 Mar 2008 13:24:32 +0000 (14:24 +0100)
bin/lib
config

diff --git a/bin/lib b/bin/lib
index 9c074650b0affc22fe60272994a6a8866e5f66b8..19ff00e9b7cea7593b1a09bed76a7326dafc6eca 100644 (file)
--- 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 8e8861243cbaaf8aa3264fe7941d5249ffd3c91a..43beb077fc806b77a048c2b1001a874d39d873a3 100644 (file)
--- 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.