-# HOME set automatically
-# CONTESTANT set automatically
-# TASK set automatically
-
-PDIR="${HOME}/problems/${TASK}"
-SDIR="${HOME}/solutions/${CONTESTANT}/${TASK}"
-TDIR="${HOME}/testing/${CONTESTANT}/${TASK}"
-
-TESTCASE_IN=${TEST}.in
-TESTCASE_OUT=${TEST}.out
-TESTCASE_OK=${TEST}.ok
-TESTCASE_STATUS=${TEST}.stat
-TESTCASE_RAW=${TEST}.raw
-# backward compatibility
-TESTCASE_PTS=${TEST}.pts
-
-DEBUG=1
-
-# HOOKS
-# TESTCASE_HOOKS
-
-### Programming language settings
-
-# Known source file extensions
-EXTENSIONS="c cc C cpp p pas"
-
-# Some of the extensions can be aliases for other extensions
-ALIAS_EXT_cc=cpp
-ALIAS_EXT_C=cpp
-ALIAS_EXT_p=pas
-
-# SRC is auto
-
-## Variables which control compilation and execution
-## (see below for values for individual languages)
-
-# Command used to run the compiler
-COMP=false
-
-# Sandbox options used when compiling
-COMP_SANDBOX_OPTS="-m262144 -w60 -e -i/dev/null"
-
-EXE=$TASK
-
-# Command used to execute the compiled program, may be ./$PROGRAM (default) or an
-# interpreter with $PROGRAM as a parameter.
-TEST_EXEC_CMD=./$EXE
-
-## Settings for individual languages
-
-# C
-EXT_c_COMP="/usr/bin/gcc -std=gnu99 -O2 -g -o $EXE $EXTRA_CFLAGS $SRC -lm"
-EXTRA_CFLAGS=
-
-# C++
-EXT_cpp_COMP="/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm"
-EXTRA_CXXFLAGS=
-
-# Pascal
-EXT_pas_COMP="/usr/bin/fpc -Ci -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC"
-EXTRA_PFLAGS=
-
-### Per-task configuration variables (default values, override in per-task config)
-
-# List of extra files needed for compilation. They are copied to the compiler
-# sandbox from the problem's directory. XXX: or tdir
-#COMP_EXTRAS="extras.h"
-
-# Task type:
-# batch off-line task
-# interactive interactive task communicating via stdio with a testing program
-# open-data open-data task (i.e., we don't submit program, but output files)
-TASK_TYPE=batch
-
-# I/O type (IO_TYPE sets defaults for IN_TYPE and OUT_TYPE)
-# file input from $PROBLEM.in, output to $PROBLEM.out (possible even for interactive tasks)
-# stdio input from stdin, output to stdout
-# dir input from all files in the directory $TEST.in; these are copied to $BOXDIR
-# and if they include .stdin, it will be available as program's std. input.
-# none no input/output
-IO_TYPE=stdio
-#IN_TYPE=stdio
-#OUT_TYPE=stdio
-
-IN_NAME=$TASK.in
-OUT_NAME=$TASK.out
-
-# A list of all tests
-TESTS="1 2 3 4 5 6 7 8 9 10"
-
-# A list of public tests (executed by submit and check scripts)
-SAMPLE_TESTS="0"
-
-# Number of points per test
-POINTS_PER_TEST=1
-
-# Time limit in seconds (can be fractional, but beware of noise)
-TIME_LIMIT=10
-
-# Memory limit in kilobytes
-MEM_LIMIT=16384
-
-# Stack size limit in kilobytes (0=limited only by MEM_LIMIT)
-STACK_LIMIT=0
-
-# Command used for filtering of program output (optional)
-# If turned on, program output (*.raw) is ran through this filter and the
-# checkers are applied to the output of the filter (*.out).
-# Can exit with code 1 if there is a syntax error in the output.
-#OUTPUT_FILTER=tr -d '\r' <$TDIR/$TEST.raw >$TDIR/$TEST.out
-
-# Command used to check output syntax (optional)
-# Returns exit code 1 if syntax is wrong, 0 if correct
-# fd1 is connect to evaluator log, feel free to log anything
-# fd2 is an optional one-line verdict
-#SYNTAX_CHECK=grep -v -- - $TDIR/$TEST.out
-
-# Command used to check output correctness
-# Returns exit code 1 if output is incorrect, 0 if correct
-# fd1 is connect to evaluator log, feel free to log anything
-# fd2 is an optional one-line verdict
-# The checker can generate $TDIR/$TEST.pts to assign points irregularly
-OUTPUT_CHECK=diff -bBu $TDIR/$TEST.ok $TDIR/$TEST.out
-
-# Checker for interactive tasks
-# Returns exit code 1 if test failed, 0 if passed
-# fd0 and fd1 are connected to fd1 and fd0 of the program tested
-# fd2 is an optional one-line verdict
-# The checker can generate $TDIR/$TEST.pts to assign points irregularly
-#IC_CHECK=$PDIR/checker $PDIR/$TEST.in $PDIR/$TEST.chk
-
-# Sandbox options used when testing
-TEST_SANDBOX_OPTS=-a2 -f -m$MEM_LIMIT -k$STACK_LIMIT -t$TIME_LIMIT $BOX_EXTRAS $BOX_IO_OPTS
-
-# Extra options to be overridden in task configuration
-BOX_EXTRAS=
-
-### Hook priorities:
-
-# Task pipeline for batch and interactive tasks:
-# 100 compile-init
-# 150 compile-run
-# 190 compile-done
-# 200 batch-tests
-
-# Test pipeline:
-# 000 setup copy input and correct output to $TDIR
-# 100 prepare copy input and executables to the sandbox
-# 200 run run inside the sandbox
-# 300 collect copy output out of the sandbox
-# 400 filter filter the output ($OUTPUT_FILTER)
-# 500 syntax check syntax of the output ($SYNTAX_CHECK)
-# 600 judge check correctness of the output ($OUTPUT_CHECK)
-# 700 points award $POINTS_PER_TEST points unless already done
+# Basic directories
+TDIR = "{HOME}/test"
+PDIR = "{HOME}/tasks/{TASK}"
+
+# Files
+USER_LOG = "{TDIR}/log"
+TASK_CONFIG = "{PDIR}/config"
+STATUS_FILE = "{TDIR}/status"
+
+# only for testing:
+TASK = "sum"
+TASK_TYPE = "dummy"
+USER = "gavento"
+SOURCE = "suma.c"
+EXTENSIONS += " dummy "
+
+#### Old config format (inspiration?)
+
+# # HOME set automatically
+# # CONTESTANT set automatically
+# # TASK set automatically
+#
+# PDIR="${HOME}/problems/${TASK}"
+# SDIR="${HOME}/solutions/${CONTESTANT}/${TASK}"
+# TDIR="${HOME}/testing/${CONTESTANT}/${TASK}"
+#
+# TESTCASE_IN=${TEST}.in
+# TESTCASE_OUT=${TEST}.out
+# TESTCASE_OK=${TEST}.ok
+# TESTCASE_STATUS=${TEST}.stat
+# TESTCASE_RAW=${TEST}.raw
+# # backward compatibility
+# TESTCASE_PTS=${TEST}.pts
+#
+# DEBUG=1
+#
+# # HOOKS
+# # TESTCASE_HOOKS
+#
+# ### Programming language settings
+#
+# # Known source file extensions
+# EXTENSIONS="c cc C cpp p pas"
+#
+# # Some of the extensions can be aliases for other extensions
+# ALIAS_EXT_cc=cpp
+# ALIAS_EXT_C=cpp
+# ALIAS_EXT_p=pas
+#
+# # SRC is auto
+#
+# ## Variables which control compilation and execution
+# ## (see below for values for individual languages)
+#
+# # Command used to run the compiler
+# COMP=false
+#
+# # Sandbox options used when compiling
+# COMP_SANDBOX_OPTS="-m262144 -w60 -e -i/dev/null"
+#
+# EXE=$TASK
+#
+# # Command used to execute the compiled program, may be ./$PROGRAM (default) or an
+# # interpreter with $PROGRAM as a parameter.
+# TEST_EXEC_CMD=./$EXE
+#
+# ## Settings for individual languages
+#
+# # C
+# EXT_c_COMP="/usr/bin/gcc -std=gnu99 -O2 -g -o $EXE $EXTRA_CFLAGS $SRC -lm"
+# EXTRA_CFLAGS=
+#
+# # C++
+# EXT_cpp_COMP="/usr/bin/g++ -O2 -g -o $EXE $EXTRA_CXXFLAGS $SRC -lm"
+# EXTRA_CXXFLAGS=
+#
+# # Pascal
+# EXT_pas_COMP="/usr/bin/fpc -Ci -g -O2 -Sg -o$EXE $EXTRA_PFLAGS $SRC"
+# EXTRA_PFLAGS=
+#
+# ### Per-task configuration variables (default values, override in per-task config)
+#
+# # List of extra files needed for compilation. They are copied to the compiler
+# # sandbox from the problem's directory. XXX: or tdir
+# #COMP_EXTRAS="extras.h"
+#
+# # Task type:
+# # batch off-line task
+# # interactive interactive task communicating via stdio with a testing program
+# # open-data open-data task (i.e., we don't submit program, but output files)
+# TASK_TYPE=batch
+#
+# # I/O type (IO_TYPE sets defaults for IN_TYPE and OUT_TYPE)
+# # file input from $PROBLEM.in, output to $PROBLEM.out (possible even for interactive tasks)
+# # stdio input from stdin, output to stdout
+# # dir input from all files in the directory $TEST.in; these are copied to $BOXDIR
+# # and if they include .stdin, it will be available as program's std. input.
+# # none no input/output
+# IO_TYPE=stdio
+# #IN_TYPE=stdio
+# #OUT_TYPE=stdio
+#
+# IN_NAME=$TASK.in
+# OUT_NAME=$TASK.out
+#
+# # A list of all tests
+# TESTS="1 2 3 4 5 6 7 8 9 10"
+#
+# # A list of public tests (executed by submit and check scripts)
+# SAMPLE_TESTS="0"
+#
+# # Number of points per test
+# POINTS_PER_TEST=1
+#
+# # Time limit in seconds (can be fractional, but beware of noise)
+# TIME_LIMIT=10
+#
+# # Memory limit in kilobytes
+# MEM_LIMIT=16384
+#
+# # Stack size limit in kilobytes (0=limited only by MEM_LIMIT)
+# STACK_LIMIT=0
+#
+# # Command used for filtering of program output (optional)
+# # If turned on, program output (*.raw) is ran through this filter and the
+# # checkers are applied to the output of the filter (*.out).
+# # Can exit with code 1 if there is a syntax error in the output.
+# #OUTPUT_FILTER=tr -d '\r' <$TDIR/$TEST.raw >$TDIR/$TEST.out
+#
+# # Command used to check output syntax (optional)
+# # Returns exit code 1 if syntax is wrong, 0 if correct
+# # fd1 is connect to evaluator log, feel free to log anything
+# # fd2 is an optional one-line verdict
+# #SYNTAX_CHECK=grep -v -- - $TDIR/$TEST.out
+#
+# # Command used to check output correctness
+# # Returns exit code 1 if output is incorrect, 0 if correct
+# # fd1 is connect to evaluator log, feel free to log anything
+# # fd2 is an optional one-line verdict
+# # The checker can generate $TDIR/$TEST.pts to assign points irregularly
+# OUTPUT_CHECK=diff -bBu $TDIR/$TEST.ok $TDIR/$TEST.out
+#
+# # Checker for interactive tasks
+# # Returns exit code 1 if test failed, 0 if passed
+# # fd0 and fd1 are connected to fd1 and fd0 of the program tested
+# # fd2 is an optional one-line verdict
+# # The checker can generate $TDIR/$TEST.pts to assign points irregularly
+# #IC_CHECK=$PDIR/checker $PDIR/$TEST.in $PDIR/$TEST.chk
+#
+# # Sandbox options used when testing
+# TEST_SANDBOX_OPTS=-a2 -f -m$MEM_LIMIT -k$STACK_LIMIT -t$TIME_LIMIT $BOX_EXTRAS $BOX_IO_OPTS
+#
+# # Extra options to be overridden in task configuration
+# BOX_EXTRAS=
+#
+# ### Hook priorities:
+#
+# # Task pipeline for batch and interactive tasks:
+# # 100 compile-init
+# # 150 compile-run
+# # 190 compile-done
+# # 200 batch-tests
+#
+# # Test pipeline:
+# # 000 setup copy input and correct output to $TDIR
+# # 100 prepare copy input and executables to the sandbox
+# # 200 run run inside the sandbox
+# # 300 collect copy output out of the sandbox
+# # 400 filter filter the output ($OUTPUT_FILTER)
+# # 500 syntax check syntax of the output ($SYNTAX_CHECK)
+# # 600 judge check correctness of the output ($OUTPUT_CHECK)
+# # 700 points award $POINTS_PER_TEST points unless already done
"""
def __init__(self):
- self.log = moe.log.Logers()
+ self.log = moe.log.Loggers()
self.config = moe.config.ConfigTree()
self.main_pipe = moe.pipeline.MoePipeline("main")
self.test_pipe = moe.pipeline.MoePipeline("test")
self.log.info("Initializing ...")
# set basic builtins
- self.config.parse('HOME=\'%s\'' % os.getcwd(), source="<builtins>", level=0)
- self.config.parse('CONFIG="{HOME}/config"', source="<builtins>", level=0)
- self.config.parse('LOG="{HOME}/log"', source="<builtins>", level=0)
- self.config.parse('DEBUG_LEVEL="0"', source="<builtins>", level=0)
- self.config.parse('VERBOSE=""', source="<builtins>", level=0)
+ self.config.parse('HOME = \'%s\'' % os.getcwd(), source="<builtins>", level=0)
+ self.config.parse('CONFIG = "{HOME}/config"', source="<builtins>", level=0)
+ self.config.parse('LOG = "{HOME}/log"', source="<builtins>", level=0)
+ self.config.parse('DEBUG_LEVEL = "0"', source="<builtins>", level=0)
+ self.config.parse('VERBOSE = ""', source="<builtins>", level=0)
+ self.config.parse('EXTENSIONS = ""', source="<builtins>", level=0)
- # Non-basic configuration, should be in default config file
- self.config.parse("""
- TDIR = "{HOME}/test"
- PDIR = "{HOME}/tasks/{TASK}"
- USER_LOG = "{TDIR}/log"
- TASK_CONFIG = "{PDIR}/config"
- STATUS_FILE = "{TDIR}/status"
- EXTENSIONS = ""
- # only for testing:
- TASK = "sum"
- TASK_TYPE = "dummy"
- USER = "gavento"
- SOURCE = "suma.c"
- EXTENSIONS += " dummy "
- """, source="<temp-builtins>", level=0) # -> config
-
# apply overrides
for ov in overrides:
self.config.parse(ov, source="<overrides>", level=100)