public boolean isOk() { return this.equals(OK); }
private static void correctResultForProcessExitCode( final MutationStatusMap mutations, final ExitCode exitCode) { if (!exitCode.isOk()) { final Collection<MutationDetails> unfinishedRuns = mutations .getUnfinishedRuns(); final DetectionStatus status = DetectionStatus .getForErrorExitCode(exitCode); LOG.warning("Minion exited abnormally due to " + status); LOG.fine("Setting " + unfinishedRuns.size() + " unfinished runs to " + status + " state"); mutations.setStatusForMutations(unfinishedRuns, status); } else { LOG.fine("Minion exited ok"); } }
public synchronized void end(final ExitCode exitCode) { this.dos.writeByte(Id.DONE); this.dos.writeInt(exitCode.getCode()); this.dos.flush(); }
private ExitCode receiveResults(final SafeDataInputStream is) { byte control = is.readByte(); while (control != Id.DONE) { this.receive.apply(control, is); control = is.readByte(); } return ExitCode.fromCode(is.readInt()); }
@Override public synchronized void done(final ExitCode exitCode) { this.w.writeByte(Id.DONE); this.w.writeInt(exitCode.getCode()); this.w.flush(); }
System.exit(exitCode.getCode());
/** * Converts a process exit code to a mutation status * * @param exitCode * Exit code to convert * @return The status corresponding to the exit code */ public static DetectionStatus getForErrorExitCode(final ExitCode exitCode) { if (exitCode.equals(ExitCode.OUT_OF_MEMORY)) { return DetectionStatus.MEMORY_ERROR; } else if (exitCode.equals(ExitCode.TIMEOUT)) { return DetectionStatus.TIMED_OUT; } else { return DetectionStatus.RUN_ERROR; } }
private void gatherCoverageData(final Collection<ClassInfo> tests, final CoverageData coverage) throws IOException, InterruptedException, ExecutionException { final List<String> filteredTests = FCollection .map(tests, classInfoToName()); final SideEffect1<CoverageResult> handler = resultProcessor(coverage); final SocketFinder sf = new SocketFinder(); final ServerSocket socket = sf.getNextAvailableServerSocket(); final CoverageProcess process = new CoverageProcess(ProcessArgs .withClassPath(this.code.getClassPath()).andBaseDir(this.workingDir) .andLaunchOptions(this.launchOptions).andStderr(logInfo()) .andStdout(captureStandardOutIfVerbose()), this.coverageOptions, socket, filteredTests, handler); process.start(); final ExitCode exitCode = process.waitToDie(); if (exitCode == ExitCode.JUNIT_ISSUE) { LOG.severe("Error generating coverage. Please check that your classpath contains JUnit 4.6 or above."); throw new PitError( "Coverage generation minion exited abnormally. Please check the classpath."); } else if (!exitCode.isOk()) { LOG.severe("Coverage generator Minion exited abnormally due to " + exitCode); throw new PitError("Coverage generation minion exited abnormally!"); } else { LOG.fine("Coverage generator Minion exited ok"); } }
private void mockClientSocketToSendExitCode(final ExitCode timeout) throws IOException { final SafeDataOutputStream dos = new SafeDataOutputStream(this.o); dos.writeByte(Id.DONE); dos.writeInt(timeout.getCode()); mockClientSocketInputStream(); }
public boolean isOk() { return this.equals(OK); }
@Test public void shouldPassCommandsToReceiver() throws Exception { final SafeDataOutputStream dos = new SafeDataOutputStream(this.o); dos.writeByte(Id.DESCRIBE); dos.writeByte(Id.DONE); dos.writeInt(ExitCode.OK.getCode()); mockClientSocketInputStream(); this.testee.call(); verify(this.receiveStrategy, times(1)).apply(anyByte(), any(SafeDataInputStream.class)); }
/** * Converts a process exit code to a mutation status * * @param exitCode * Exit code to convert * @return The status corresponding to the exit code */ public static DetectionStatus getForErrorExitCode(final ExitCode exitCode) { if (exitCode.equals(ExitCode.OUT_OF_MEMORY)) { return DetectionStatus.MEMORY_ERROR; } else if (exitCode.equals(ExitCode.TIMEOUT)) { return DetectionStatus.TIMED_OUT; } else { return DetectionStatus.RUN_ERROR; } }
@Test public void shouldSendExitCode() { this.testee.done(ExitCode.TIMEOUT); final SafeDataInputStream is = resultToStream(); assertEquals(Id.DONE, is.readByte()); assertEquals(is.readInt(), ExitCode.TIMEOUT.getCode()); }
public synchronized void end(final ExitCode exitCode) { this.dos.writeByte(Id.DONE); this.dos.writeInt(exitCode.getCode()); this.dos.flush(); }
@Override public synchronized void done(final ExitCode exitCode) { this.w.writeByte(Id.DONE); this.w.writeInt(exitCode.getCode()); this.w.flush(); }
System.exit(exitCode.getCode());