コード例 #1
0
 public void submitTestRun(final String testBinaryPath, final Collection<String> testNames) {
   final String testFilterFlag =
       testNames.isEmpty() ? "" : "--gtest_filter=" + String.join(":", testNames);
   final String[] command = new String[] {testBinaryPath, testFilterFlag};
   parser.clearState();
   processRunner = new ProcessRunner();
   executorService.submit(() -> runTests(command));
 }
コード例 #2
0
  private void readBinary(final String[] command) {
    LOGGER.fine(
        () -> "Starting reading binary with command: " + String.join(" ", Arrays.asList(command)));
    final Collection<String> lines = new ArrayList<>();

    boolean hasSucceed = false;
    Collection<String> testNames = Collections.emptyList();
    try {
      final int exitCode = processRunner.start(command, lines::add);
      if (exitCode == 0) {
        testNames = parser.parseTestList(lines);
        hasSucceed = true;
        LOGGER.fine("Reading binary process exits with normal code");
      } else {
        LOGGER.warning("Reading binary process exits with " + exitCode + " code");
      }
    } catch (IOException | ParseException e) {
      LOGGER.warning("Reading binary process throws exception: " + e.getMessage());
    } finally {
      for (TestRunnerHandler handler : testRunnerHandlers) {
        handler.onTestsLoadingFinished(hasSucceed, testNames);
      }
    }
  }
コード例 #3
0
 public void submitReadBinary(final String testBinaryPath) {
   final String[] command = new String[] {testBinaryPath, "--gtest_list_tests"};
   parser.clearState();
   processRunner = new ProcessRunner();
   executorService.submit(() -> readBinary(command));
 }