@Test public void testGetRuntimeResultCpp() throws Exception { String workDirectory = workBaseDirectory + "/voj-1000"; String baseFileName = "random-name"; Submission submission = submissionMapper.getSubmission(1000); String inputFilePath = workBaseDirectory + "/testpoints/1000/input#0.txt"; String outputFilePath = workBaseDirectory + "/voj-1000/output#0.txt"; preprocessor.createTestCode(submission, workDirectory, baseFileName); preprocessor.fetchTestPoints(submission.getProblem().getProblemId()); compiler.getCompileResult(submission, workDirectory, baseFileName); Map<String, Object> result = runner.getRuntimeResult(submission, workDirectory, baseFileName, inputFilePath, outputFilePath); Assertions.assertEquals("AC", result.get("runtimeResult")); }
public Map<String, Object> getRuntimeResult(Submission submission, String workDirectory, String baseFileName, String inputFilePath, String outputFilePath) { String commandLine = getCommandLine(submission, workDirectory, baseFileName); int timeLimit = getTimeLimit(submission); int memoryLimit = getMemoryLimit(submission); Map<String, Object> result = new HashMap<>(4, 1); String runtimeResultSlug = "SE"; int usedTime = 0; int usedMemory = 0; try { LOGGER.info(String.format("[Submission #%d] Start running with command %s (TimeLimit=%d, MemoryLimit=%s)", new Object[] { submission.getSubmissionId(), commandLine, timeLimit, memoryLimit })); Map<String, Object> runtimeResult = getRuntimeResult(commandLine, systemUsername, systemPassword, inputFilePath, outputFilePath, timeLimit, memoryLimit); int exitCode = (Integer) runtimeResult.get("exitCode"); usedTime = (Integer) runtimeResult.get("usedTime"); usedMemory = (Integer) runtimeResult.get("usedMemory"); runtimeResultSlug = getRuntimeResultSlug(exitCode, timeLimit, usedTime, memoryLimit, usedMemory); } catch ( Exception ex ) { LOGGER.catching(ex); } result.put("runtimeResult", runtimeResultSlug); result.put("usedTime", usedTime); result.put("usedMemory", usedMemory); return result; }
Runner { public Map<String, Object> getRuntimeResult(Submission submission, String workDirectory, String baseFileName, String inputFilePath, String outputFilePath) { String commandLine = getCommandLine(submission, workDirectory, baseFileName); int timeLimit = getTimeLimit(submission); int memoryLimit = getMemoryLimit(submission); Map<String, Object> result = new HashMap<>(4, 1); String runtimeResultSlug = "SE"; int usedTime = 0; int usedMemory = 0; try { LOGGER.info(String.format("[Submission #%d] Start running with command %s (TimeLimit=%d, MemoryLimit=%s)", new Object[] { submission.getSubmissionId(), commandLine, timeLimit, memoryLimit })); Map<String, Object> runtimeResult = getRuntimeResult(commandLine, systemUsername, systemPassword, inputFilePath, outputFilePath, timeLimit, memoryLimit); int exitCode = (Integer) runtimeResult.get("exitCode"); usedTime = (Integer) runtimeResult.get("usedTime"); usedMemory = (Integer) runtimeResult.get("usedMemory"); runtimeResultSlug = getRuntimeResultSlug(exitCode, timeLimit, usedTime, memoryLimit, usedMemory); } catch ( Exception ex ) { LOGGER.catching(ex); } result.put("runtimeResult", runtimeResultSlug); result.put("usedTime", usedTime); result.put("usedMemory", usedMemory); return result; } }
Runner { public Map<String, Object> getRuntimeResult(Submission submission, String workDirectory, String baseFileName, String inputFilePath, String outputFilePath) { String commandLine = getCommandLine(submission, workDirectory, baseFileName); int timeLimit = getTimeLimit(submission); int memoryLimit = getMemoryLimit(submission); Map<String, Object> result = new HashMap<>(4, 1); String runtimeResultSlug = "SE"; int usedTime = 0; int usedMemory = 0; try { LOGGER.info(String.format("[Submission #%d] Start running with command %s (TimeLimit=%d, MemoryLimit=%s)", new Object[] { submission.getSubmissionId(), commandLine, timeLimit, memoryLimit })); Map<String, Object> runtimeResult = getRuntimeResult(commandLine, systemUsername, systemPassword, inputFilePath, outputFilePath, timeLimit, memoryLimit); int exitCode = (Integer) runtimeResult.get("exitCode"); usedTime = (Integer) runtimeResult.get("usedTime"); usedMemory = (Integer) runtimeResult.get("usedMemory"); runtimeResultSlug = getRuntimeResultSlug(exitCode, timeLimit, usedTime, memoryLimit, usedMemory); } catch ( Exception ex ) { LOGGER.catching(ex); } result.put("runtimeResult", runtimeResultSlug); result.put("usedTime", usedTime); result.put("usedMemory", usedMemory); return result; }  }
Runner { public Map<String, Object> getRuntimeResult(Submission submission, String workDirectory, String baseFileName, String inputFilePath, String outputFilePath) { String commandLine = getCommandLine(submission, workDirectory, baseFileName); int timeLimit = getTimeLimit(submission); int memoryLimit = getMemoryLimit(submission); Map<String, Object> result = new HashMap<>(4, 1); String runtimeResultSlug = "SE"; int usedTime = 0; int usedMemory = 0; try { LOGGER.info(String.format("[Submission #%d] Start running with command %s (TimeLimit=%d, MemoryLimit=%s)", new Object[] { submission.getSubmissionId(), commandLine, timeLimit, memoryLimit })); Map<String, Object> runtimeResult = getRuntimeResult(commandLine, systemUsername, systemPassword, inputFilePath, outputFilePath, timeLimit, memoryLimit); int exitCode = (Integer) runtimeResult.get("exitCode"); usedTime = (Integer) runtimeResult.get("usedTime"); usedMemory = (Integer) runtimeResult.get("usedMemory"); runtimeResultSlug = getRuntimeResultSlug(exitCode, timeLimit, usedTime, memoryLimit, usedMemory); } catch ( Exception ex ) { LOGGER.catching(ex); } result.put("runtimeResult", runtimeResultSlug); result.put("usedTime", usedTime); result.put("usedMemory", usedMemory); return result; }  Map<String, Object> getRuntimeResult(Submission submission, String workDirectory,
		String baseFileName, String inputFilePath, String outputFilePath); Map<String, Object> getRuntimeResult(String commandLine,
			String inputFilePath, String outputFilePath, int timeLimit,
			int memoryLimit); native Map<String, Object> getRuntimeResult(String commandLine,
			String systemUsername, String systemPassword, String inputFilePath,
			String outputFilePath, int timeLimit, int memoryLimit); }
Runner { public Map<String, Object> getRuntimeResult(Submission submission, String workDirectory, String baseFileName, String inputFilePath, String outputFilePath) { String commandLine = getCommandLine(submission, workDirectory, baseFileName); int timeLimit = getTimeLimit(submission); int memoryLimit = getMemoryLimit(submission); Map<String, Object> result = new HashMap<>(4, 1); String runtimeResultSlug = "SE"; int usedTime = 0; int usedMemory = 0; try { LOGGER.info(String.format("[Submission #%d] Start running with command %s (TimeLimit=%d, MemoryLimit=%s)", new Object[] { submission.getSubmissionId(), commandLine, timeLimit, memoryLimit })); Map<String, Object> runtimeResult = getRuntimeResult(commandLine, systemUsername, systemPassword, inputFilePath, outputFilePath, timeLimit, memoryLimit); int exitCode = (Integer) runtimeResult.get("exitCode"); usedTime = (Integer) runtimeResult.get("usedTime"); usedMemory = (Integer) runtimeResult.get("usedMemory"); runtimeResultSlug = getRuntimeResultSlug(exitCode, timeLimit, usedTime, memoryLimit, usedMemory); } catch ( Exception ex ) { LOGGER.catching(ex); } result.put("runtimeResult", runtimeResultSlug); result.put("usedTime", usedTime); result.put("usedMemory", usedMemory); return result; }  Map<String, Object> getRuntimeResult(Submission submission, String workDirectory,
		String baseFileName, String inputFilePath, String outputFilePath); Map<String, Object> getRuntimeResult(String commandLine,
			String inputFilePath, String outputFilePath, int timeLimit,
			int memoryLimit); native Map<String, Object> getRuntimeResult(String commandLine,
			String systemUsername, String systemPassword, String inputFilePath,
			String outputFilePath, int timeLimit, int memoryLimit);  }