diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/BisonCompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/BisonCompilationBox.php index 68e7362af..beb8e07a1 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/BisonCompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/BisonCompilationBox.php @@ -4,14 +4,9 @@ use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use App\Helpers\JobConfig\SandboxConfig; -use App\Helpers\JobConfig\Tasks\Task; /** * Box that compile Bison format into C/C++ sources. @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array $inputFile = $this->getInputPortValue(self::$SOURCE_FILE_PORT_KEY)->getValue(ConfigParams::$EVAL_DIR); $inputBaseName = basename($inputFile, self::$BISON_EXT); - // Prepare cmdline args + // Prepare commandline args $args = []; if ($this->hasInputPortValue(self::$ARGS_PORT_KEY)) { $args = $this->getInputPortValue(self::$ARGS_PORT_KEY)->getValue(); diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/CustomCompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/CustomCompilationBox.php index 238291d7b..5b4db9600 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/CustomCompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/CustomCompilationBox.php @@ -4,14 +4,7 @@ use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use App\Helpers\JobConfig\SandboxConfig; -use App\Helpers\JobConfig\Tasks\Task; /** * Box which represents custom compilation unit. @@ -49,7 +42,7 @@ public static function init() } /** - * JudgeNormalBox constructor. + * CustomCompilationBox constructor. * @param BoxMeta $meta */ public function __construct(BoxMeta $meta) diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ElfExecutionBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ElfExecutionBox.php index be05ef391..4a8226d8c 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ElfExecutionBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ElfExecutionBox.php @@ -5,8 +5,6 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FetchFileBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FetchFileBox.php index b66ce798f..28c2212c0 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FetchFileBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FetchFileBox.php @@ -4,7 +4,6 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FileInBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FileInBox.php index 130beff74..ded88f4fe 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FileInBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FileInBox.php @@ -5,11 +5,8 @@ use App\Exceptions\ExerciseCompilationException; use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskCommands; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; -use App\Helpers\ExerciseConfig\Variable; use App\Helpers\ExerciseConfig\VariableTypes; use App\Helpers\JobConfig\Tasks\Task; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesInBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesInBox.php index da6003e96..20e9de0db 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesInBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesInBox.php @@ -5,11 +5,8 @@ use App\Exceptions\ExerciseCompilationException; use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskCommands; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; -use App\Helpers\ExerciseConfig\Variable; use App\Helpers\ExerciseConfig\VariableTypes; use App\Helpers\JobConfig\Tasks\Task; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesNamesBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesNamesBox.php index ac1df5724..856d471f7 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesNamesBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FilesNamesBox.php @@ -9,7 +9,6 @@ use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use Exception; /** * Takes array of files and produces array of strings with file names (including the path). diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FpcCompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FpcCompilationBox.php index 77b7ad9b1..18f7b3779 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FpcCompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/FpcCompilationBox.php @@ -4,14 +4,9 @@ use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use App\Helpers\JobConfig\SandboxConfig; -use App\Helpers\JobConfig\Tasks\Task; /** * Box which represents fpc compilation unit. @@ -116,7 +111,7 @@ public function compile(CompilationParams $params): array $task->setCommandBinary( $this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY) - ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$FPC_BINARY_DEFAULT + ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$FPC_BINARY_DEFAULT ); $args = []; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GccCompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GccCompilationBox.php index 8eb95fed1..0ea54fcc9 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GccCompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GccCompilationBox.php @@ -4,14 +4,9 @@ use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use App\Helpers\JobConfig\SandboxConfig; -use App\Helpers\JobConfig\Tasks\Task; /** * Box which represents gcc compilation unit. @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array $task->setCommandBinary( $this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY) - ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GCC_BINARY_DEFAULT + ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GCC_BINARY_DEFAULT ); $args = []; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GppCompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GppCompilationBox.php index a9e1dbc12..7c7bbca5b 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GppCompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/GppCompilationBox.php @@ -4,14 +4,9 @@ use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\LinuxSandbox; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\Priorities; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\TaskType; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; -use App\Helpers\JobConfig\SandboxConfig; -use App\Helpers\JobConfig\Tasks\Task; /** * Box which represents g++ compilation unit. @@ -112,7 +107,7 @@ public function compile(CompilationParams $params): array $task->setCommandBinary( $this->hasInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY) - ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GPP_BINARY_DEFAULT + ? $this->getInputPortValue(self::$COMPILER_EXEC_PATH_PORT_KEY)->getValue() : self::$GPP_BINARY_DEFAULT ); $args = []; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/HaskellExecutionBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/HaskellExecutionBox.php index 4c085aaf6..a6341ed1e 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/HaskellExecutionBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/HaskellExecutionBox.php @@ -7,8 +7,6 @@ use App\Exceptions\FrontendErrorMappings; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JoinPipelinesBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JoinPipelinesBox.php index b6e1cb729..0ce956710 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JoinPipelinesBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JoinPipelinesBox.php @@ -14,7 +14,7 @@ use App\Helpers\JobConfig\Tasks\Task; /** - * Customizable box for joing two pipelines in-between. There are only one input + * Customizable box for joining two pipelines in-between. There are only one input * port and only one output port, ports can be modified. * Default values for ports and name are not implemented. * @note Should be used only for internal purposes. diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JudgeBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JudgeBox.php index e299f6631..d8ab52f09 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JudgeBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/JudgeBox.php @@ -140,7 +140,7 @@ private function getJudgeBinaryAndArgs(): array // Translation of judge type to command and args. The first item is the default. static $judgeTypes = null; if ($judgeTypes === null) { - // TODO - this is work in progress, a more elaborate way to define recodex-token-judge parameters will be devised soon + // TODO - this is work in progress, we need a better way to define recodex-token-judge parameters // TODO - shuffle-rows and shuffle-all versions are not implemented yet in recodex-token-judge // Note: recodex-token-judge is the new judge, which provides more verbose output for the logs $commonArgs = ['--log-limit', '4k', '--ignore-trailing-whitespace']; @@ -230,7 +230,7 @@ public function compile(CompilationParams $params): array ) ); - $sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE); + $sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT); $sandbox->setOutput(true); $task->setSandboxConfig($sandbox); diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeFilesBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeFilesBox.php index 0116cfd18..73b67fca8 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeFilesBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeFilesBox.php @@ -3,9 +3,6 @@ namespace App\Helpers\ExerciseConfig\Pipeline\Box; use App\Exceptions\ExerciseConfigException; -use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeStringsBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeStringsBox.php index 6c7edf4e1..186ca152d 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeStringsBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/MergeStringsBox.php @@ -3,9 +3,6 @@ namespace App\Helpers\ExerciseConfig\Pipeline\Box; use App\Exceptions\ExerciseConfigException; -use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/NodeRunBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/NodeRunBox.php index 400e135d9..661549a2e 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/NodeRunBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/NodeRunBox.php @@ -4,7 +4,6 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/PhpRunBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/PhpRunBox.php index 375f4ed53..369a9419d 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/PhpRunBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/PhpRunBox.php @@ -4,7 +4,6 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ScriptExecutionBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ScriptExecutionBox.php index 39e0ca9f6..164216f7b 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ScriptExecutionBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/ScriptExecutionBox.php @@ -4,14 +4,11 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; -use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** * Box which represents execution where the main scripting file (entry-point) - * needs to be passed to a particular scripting runtime. Optinally, the runtime + * needs to be passed to a particular scripting runtime. Optionally, the runtime * may get arguments of its own. */ class ScriptExecutionBox extends ExecutionBox diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/WrappedExecutionBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/WrappedExecutionBox.php index 4ac6801ea..c08428c10 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/WrappedExecutionBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/WrappedExecutionBox.php @@ -5,13 +5,11 @@ use App\Exceptions\ExerciseConfigException; use App\Helpers\ExerciseConfig\Compilation\CompilationParams; use App\Helpers\ExerciseConfig\Pipeline\Box\Params\ConfigParams; -use App\Helpers\ExerciseConfig\Pipeline\Ports\Port; -use App\Helpers\ExerciseConfig\Pipeline\Ports\PortMeta; use App\Helpers\ExerciseConfig\VariableTypes; /** * Box which represents execution where the executable file needs to - * be passed to a particular runtime. Optinally, the runtime may get + * be passed to a particular runtime. Optionally, the runtime may get * arguments of its own. */ class WrappedExecutionBox extends ExecutionBox diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/CompilationBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/CompilationBox.php index b8f48415c..ff22fb735 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/CompilationBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/CompilationBox.php @@ -27,7 +27,7 @@ abstract class CompilationBox extends Box public static $RUNNER_FILE_PORT_KEY = "runner"; public static $COMPILER_EXEC_PATH_PORT_KEY = "compiler-exec-path"; public static $EXISTS_FAILED_MSG = - "Compilation process completed correctly but no executable file was yielded. Unable to proceed with testing."; + "Compilation process completed correctly but no executable file was yielded. Unable to proceed with testing."; /** @@ -57,15 +57,15 @@ protected function compileBaseTask(CompilationParams $params): Task $task->setPriority(Priorities::$INITIATION); $task->setType(TaskType::$INITIATION); - $sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE)->setOutput(true); + $sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT)->setOutput(true); $task->setSandboxConfig($sandbox); if ($params->isDebug()) { // My debug, you bow to no one... $sandbox->setStderrToStdout(true); $stdoutRandom = "compilation." . Random::generate(20) . ".out"; - // all outputs are stored as carboncopies in results directory - $sandbox->setCarboncopyStdout(ConfigParams::$RESULT_DIR . $stdoutRandom); + // all outputs are stored as carbon copies in results directory + $sandbox->setCarbonCopyStdout(ConfigParams::$RESULT_DIR . $stdoutRandom); } return $task; diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/ExecutionBox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/ExecutionBox.php index 8c563bf53..4fada8494 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/ExecutionBox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Boxes/base/ExecutionBox.php @@ -66,7 +66,7 @@ protected function compileBaseTask(CompilationParams $params): Task $task->setPriority(Priorities::$EXECUTION); $task->setType(TaskType::$EXECUTION); - $sandbox = (new SandboxConfig())->setName(LinuxSandbox::$ISOLATE); + $sandbox = (new SandboxConfig())->setName(LinuxSandbox::DEFAULT); if ($this->hasInputPortValue(self::$STDIN_FILE_PORT_KEY)) { $sandbox->setStdin($this->getInputPortValue(self::$STDIN_FILE_PORT_KEY)->getValue(ConfigParams::$EVAL_DIR)); } @@ -81,7 +81,7 @@ protected function compileBaseTask(CompilationParams $params): Task if ($params->isDebug()) { // Certainty of debug. Small chance of success. What are we waiting for? $stderrRandom = "execution." . Random::generate(20) . ".stderr"; - // all stderrs are stored alongside solution in case of debugging submission + // the stderr is stored alongside solution in case of debugging submission $sandbox->setStderr(ConfigParams::$EVAL_DIR . $stderrRandom); } @@ -93,7 +93,7 @@ protected function compileBaseTask(CompilationParams $params): Task $code = trim($code); if (preg_match('/^(?[0-9]+)\s*-+\s*(?[0-9]+)$/', $code, $matches)) { // convert string range representation ('from-to') into tuple of ints [from, to] - $code = [ (int)$matches['from'], (int)$matches['to'] ]; + $code = [(int)$matches['from'], (int)$matches['to']]; } } $task->setSuccessExitCodes($codes); diff --git a/app/helpers/ExerciseConfig/Pipeline/Box/Params/LinuxSandbox.php b/app/helpers/ExerciseConfig/Pipeline/Box/Params/LinuxSandbox.php index 0657c184f..163dec73a 100644 --- a/app/helpers/ExerciseConfig/Pipeline/Box/Params/LinuxSandbox.php +++ b/app/helpers/ExerciseConfig/Pipeline/Box/Params/LinuxSandbox.php @@ -7,5 +7,9 @@ */ class LinuxSandbox { - public static $ISOLATE = "isolate"; + public const DEFAULT = ""; // use the sandbox specified in the worker configuration + + // these are currently not used as we rely on worker configuration, but that may change in the future + public const ISOLATE = "isolate"; + public const GUARDIAN = "recodex-guardian"; } diff --git a/app/helpers/JobConfig/Loader.php b/app/helpers/JobConfig/Loader.php index 39c0329f9..587e3bea0 100644 --- a/app/helpers/JobConfig/Loader.php +++ b/app/helpers/JobConfig/Loader.php @@ -232,14 +232,14 @@ public function loadSandboxConfig($data, $taskId = ""): SandboxConfig unset($data[SandboxConfig::OUTPUT_KEY]); } - if (isset($data[SandboxConfig::CARBONCOPY_STDOUT_KEY])) { - $sandboxConfig->setCarboncopyStdout($data[SandboxConfig::CARBONCOPY_STDOUT_KEY]); - unset($data[SandboxConfig::CARBONCOPY_STDOUT_KEY]); + if (isset($data[SandboxConfig::CARBON_COPY_STDOUT_KEY])) { + $sandboxConfig->setCarbonCopyStdout($data[SandboxConfig::CARBON_COPY_STDOUT_KEY]); + unset($data[SandboxConfig::CARBON_COPY_STDOUT_KEY]); } - if (isset($data[SandboxConfig::CARBONCOPY_STDERR_KEY])) { - $sandboxConfig->setCarboncopyStderr($data[SandboxConfig::CARBONCOPY_STDERR_KEY]); - unset($data[SandboxConfig::CARBONCOPY_STDERR_KEY]); + if (isset($data[SandboxConfig::CARBON_COPY_STDERR_KEY])) { + $sandboxConfig->setCarbonCopyStderr($data[SandboxConfig::CARBON_COPY_STDERR_KEY]); + unset($data[SandboxConfig::CARBON_COPY_STDERR_KEY]); } if (isset($data[SandboxConfig::CHDIR_KEY])) { diff --git a/app/helpers/JobConfig/SandboxConfig.php b/app/helpers/JobConfig/SandboxConfig.php index f9acc1f09..a4a497118 100644 --- a/app/helpers/JobConfig/SandboxConfig.php +++ b/app/helpers/JobConfig/SandboxConfig.php @@ -25,9 +25,9 @@ class SandboxConfig /** Output config key */ public const OUTPUT_KEY = "output"; /** Carbon copy stdout key */ - public const CARBONCOPY_STDOUT_KEY = "carboncopy-stdout"; + public const CARBON_COPY_STDOUT_KEY = "carboncopy-stdout"; /** Carbon copy stderr key */ - public const CARBONCOPY_STDERR_KEY = "carboncopy-stderr"; + public const CARBON_COPY_STDERR_KEY = "carboncopy-stderr"; /** Change directory key */ public const CHDIR_KEY = "chdir"; /** Working directory key */ @@ -48,9 +48,9 @@ class SandboxConfig /** @var bool Output from stdout and stderr will be written to result yaml */ private $output = false; /** @var string|null Standard output carbon copy file */ - private $carboncopyStdout = null; + private $carbonCopyStdout = null; /** @var string|null Standard error carbon copy file */ - private $carboncopyStderr = null; + private $carbonCopyStderr = null; /** @var string|null Change directory */ protected $chdir = null; /** @var string|null Working directory */ @@ -184,9 +184,9 @@ public function setOutput(bool $output) * Return standard output carbon copy file. * @return string|null */ - public function getCarboncopyStdout() + public function getCarbonCopyStdout() { - return $this->carboncopyStdout; + return $this->carbonCopyStdout; } /** @@ -194,9 +194,9 @@ public function getCarboncopyStdout() * @param string $stdout * @return $this */ - public function setCarboncopyStdout($stdout) + public function setCarbonCopyStdout($stdout) { - $this->carboncopyStdout = $stdout; + $this->carbonCopyStdout = $stdout; return $this; } @@ -204,9 +204,9 @@ public function setCarboncopyStdout($stdout) * Get standard error carbon copy file. * @return string|null */ - public function getCarboncopyStderr() + public function getCarbonCopyStderr() { - return $this->carboncopyStderr; + return $this->carbonCopyStderr; } /** @@ -214,9 +214,9 @@ public function getCarboncopyStderr() * @param string $stderr * @return $this */ - public function setCarboncopyStderr($stderr) + public function setCarbonCopyStderr($stderr) { - $this->carboncopyStderr = $stderr; + $this->carbonCopyStderr = $stderr; return $this; } @@ -358,11 +358,11 @@ public function toArray(): array if ($this->output) { $data[self::OUTPUT_KEY] = $this->output; } - if (!empty($this->carboncopyStdout)) { - $data[self::CARBONCOPY_STDOUT_KEY] = $this->carboncopyStdout; + if (!empty($this->carbonCopyStdout)) { + $data[self::CARBON_COPY_STDOUT_KEY] = $this->carbonCopyStdout; } - if (!empty($this->carboncopyStderr)) { - $data[self::CARBONCOPY_STDERR_KEY] = $this->carboncopyStderr; + if (!empty($this->carbonCopyStderr)) { + $data[self::CARBON_COPY_STDERR_KEY] = $this->carbonCopyStderr; } if (!empty($this->chdir)) { $data[self::CHDIR_KEY] = $this->chdir; diff --git a/tests/ExerciseConfig/Compilation/BaseCompiler.phpt b/tests/ExerciseConfig/Compilation/BaseCompiler.phpt index 8f697c9c9..ebf83d95f 100644 --- a/tests/ExerciseConfig/Compilation/BaseCompiler.phpt +++ b/tests/ExerciseConfig/Compilation/BaseCompiler.phpt @@ -469,12 +469,12 @@ class TestBaseCompiler extends Tester\TestCase Assert::equal(TaskType::$INITIATION, $initiationCompilationTask->getType()); Assert::equal(null, $initiationCompilationTask->getTestId()); Assert::notEqual(null, $initiationCompilationTask->getSandboxConfig()); - Assert::equal(LinuxSandbox::$ISOLATE, $initiationCompilationTask->getSandboxConfig()->getName()); + Assert::equal(LinuxSandbox::DEFAULT, $initiationCompilationTask->getSandboxConfig()->getName()); Assert::true($initiationCompilationTask->getSandboxConfig()->getStderrToStdout()); - Assert::contains(".out", $initiationCompilationTask->getSandboxConfig()->getCarboncopyStdout()); + Assert::contains(".out", $initiationCompilationTask->getSandboxConfig()->getCarbonCopyStdout()); Assert::contains( '${RESULT_DIR}/compilation.', - $initiationCompilationTask->getSandboxConfig()->getCarboncopyStdout() + $initiationCompilationTask->getSandboxConfig()->getCarbonCopyStdout() ); Assert::equal($initiationDir, $initiationCompilationTask->getSandboxConfig()->getWorkingDirectory()); Assert::count(0, $initiationCompilationTask->getSandboxConfig()->getLimitsArray()); @@ -553,7 +553,7 @@ class TestBaseCompiler extends Tester\TestCase Assert::equal(TaskType::$EXECUTION, $testARunTask->getType()); Assert::equal("testA", $testARunTask->getTestId()); Assert::notEqual(null, $testARunTask->getSandboxConfig()); - Assert::equal(LinuxSandbox::$ISOLATE, $testARunTask->getSandboxConfig()->getName()); + Assert::equal(LinuxSandbox::DEFAULT, $testARunTask->getSandboxConfig()->getName()); Assert::null($testARunTask->getSandboxConfig()->getChdir()); Assert::count(2, $testARunTask->getSandboxConfig()->getLimitsArray()); Assert::equal(ConfigParams::$EVAL_DIR . "expected.A.in.hash", $testARunTask->getSandboxConfig()->getStdin()); @@ -601,7 +601,7 @@ class TestBaseCompiler extends Tester\TestCase Assert::equal(TaskType::$EVALUATION, $testAJudgeTask->getType()); Assert::equal("testA", $testAJudgeTask->getTestId()); Assert::notEqual(null, $testAJudgeTask->getSandboxConfig()); - Assert::equal(LinuxSandbox::$ISOLATE, $testAJudgeTask->getSandboxConfig()->getName()); + Assert::equal(LinuxSandbox::DEFAULT, $testAJudgeTask->getSandboxConfig()->getName()); Assert::equal("testA", $testAJudgeTask->getSandboxConfig()->getWorkingDirectory()); Assert::count(0, $testAJudgeTask->getSandboxConfig()->getLimitsArray()); @@ -662,7 +662,7 @@ class TestBaseCompiler extends Tester\TestCase Assert::equal(TaskType::$EXECUTION, $testBRunTask->getType()); Assert::equal("testB", $testBRunTask->getTestId()); Assert::notEqual(null, $testBRunTask->getSandboxConfig()); - Assert::equal(LinuxSandbox::$ISOLATE, $testBRunTask->getSandboxConfig()->getName()); + Assert::equal(LinuxSandbox::DEFAULT, $testBRunTask->getSandboxConfig()->getName()); Assert::null($testBRunTask->getSandboxConfig()->getChdir()); Assert::count(0, $testBRunTask->getSandboxConfig()->getLimitsArray()); Assert::equal(ConfigParams::$EVAL_DIR . "expected.B.in.hash", $testBRunTask->getSandboxConfig()->getStdin()); @@ -706,7 +706,7 @@ class TestBaseCompiler extends Tester\TestCase Assert::equal(TaskType::$EVALUATION, $testBJudgeTask->getType()); Assert::equal("testB", $testBJudgeTask->getTestId()); Assert::notEqual(null, $testBJudgeTask->getSandboxConfig()); - Assert::equal(LinuxSandbox::$ISOLATE, $testBJudgeTask->getSandboxConfig()->getName()); + Assert::equal(LinuxSandbox::DEFAULT, $testBJudgeTask->getSandboxConfig()->getName()); Assert::equal("testB", $testBJudgeTask->getSandboxConfig()->getWorkingDirectory()); Assert::count(0, $testBJudgeTask->getSandboxConfig()->getLimitsArray()); } diff --git a/tests/JobConfig/Loader.phpt b/tests/JobConfig/Loader.phpt index f0472ac36..80a95b341 100644 --- a/tests/JobConfig/Loader.phpt +++ b/tests/JobConfig/Loader.phpt @@ -88,8 +88,8 @@ class TestJobConfigLoader extends Tester\TestCase Assert::equal("outstd", $sandboxConfig->getStdout()); Assert::equal("errstd", $sandboxConfig->getStderr()); Assert::true($sandboxConfig->getStderrToStdout()); - Assert::equal("carboncopy-stdout-file", $sandboxConfig->getCarboncopyStdout()); - Assert::equal("carboncopy-stderr-file", $sandboxConfig->getCarboncopyStderr()); + Assert::equal("carboncopy-stdout-file", $sandboxConfig->getCarbonCopyStdout()); + Assert::equal("carboncopy-stderr-file", $sandboxConfig->getCarbonCopyStderr()); Assert::equal("working-dir", $sandboxConfig->getWorkingDirectory()); Assert::count(1, $sandboxConfig->getLimitsArray()); Assert::true($sandboxConfig->hasLimits("A"));