Can remote run command line tool show failures?

I'm starting to experiment with the remote run command line (tcc.jar). I can kick off personal builds just fine ... however, all i see in the output is,

Waiting for personal build....Running......Failing....Build failed run: error

Is there a way to show the failures in the output (preferrably as they occur)? It's suboptimall having to kick off the personal build via the command line but having to use the browser to figure out what failed.

Is the source for the tcc.jar available?

4 comments
Comment actions Permalink

Ok. I found the sources at http://svn.jetbrains.org/teamcity/plugins/commandline/branches/Eluru-6.0.x.

However, I'm having trouble locating the remote-server-proxy.jar which seems to be required by this plugin. Looking around...

0
Comment actions Permalink

With some decompiling and poking around I was able to make it work. The main change was in RemoteRun.java:

  String waitForSuccessResult(long changeListId, long timeOut, IProgressMonitor monitor) throws ECommunicationException, ERemoteError {
    UserChangeStatus prevCurrentStatus = UserChangeStatus.PENDING;
    monitor.worked(MessageFormat.format(getBuildStatusDescription(prevCurrentStatus), new Object[] {}));


    int msgOffet = 0;
    String statusDesc = null;
    long startTime = System.currentTimeMillis();
    while (System.currentTimeMillis() - startTime < timeOut) {
      TeamServerSummaryData summary = this.myServer.getSummary();
      for (UserChangeInfoData data : summary.getPersonalChanges())
        if ((data.getPersonalDesc() != null) && (data.getPersonalDesc().getId() == changeListId)) {          
          UserChangeStatus currentStatus = data.getChangeStatus();


          if (prevCurrentStatus == UserChangeStatus.PENDING && (currentStatus == UserChangeStatus.RUNNING_FAILED || currentStatus == UserChangeStatus.RUNNING_SUCCESSFULY)) {
            monitor.done("started");
          }


          if (currentStatus == UserChangeStatus.PENDING || currentStatus == UserChangeStatus.RUNNING_FAILED || currentStatus == UserChangeStatus.RUNNING_SUCCESSFULY) {
            monitor.worked(".");
          }
          
          prevCurrentStatus = currentStatus;


          BuildInstanceData buildInstance = (BuildInstanceData) data.getTypeToInstanceMap().values().toArray()[0];
          if (buildInstance != null) {
            long buildId = buildInstance.getBuildId();
            
            List<TestData> tests = this.myServer.getBuildFailedTests(buildId, msgOffet, -1);
            for (TestData test : tests) {
              if (test.getTestInfo().getStatus().isFailed()) {
                monitor.worked("\n");
                monitor.worked("\t" + (msgOffet + 1) + ") " + test.getTestInfo().getStatus().getText() + ":\n");
                monitor.worked(test.getTestInfo().getName() + "\n");
                monitor.worked(test.getTestInfo().getStacktraceMessage() + "\n");
                monitor.worked(test.getTestInfo().getErrOutput() + "\n");
                msgOffet += 1;
              }
            }
            
            statusDesc = buildInstance.getStatusDescriptor().getText();
          }


          if (UserChangeStatus.CANCELED == currentStatus) {
            monitor.done();
            throw new ERemoteError(MessageFormat.format(getBuildStatusDescription(currentStatus), new Object[] { statusDesc }));
          }
          
          if ((UserChangeStatus.FAILED_WITH_RESPONSIBLE == currentStatus) || (UserChangeStatus.FAILED == currentStatus) || (UserChangeStatus.CHECKED == currentStatus)) {
            monitor.done();
            return MessageFormat.format(getBuildStatusDescription(currentStatus), new Object[] { statusDesc });
          }
        }
      try
      {
        Thread.sleep(10000L);
      } catch (InterruptedException e) {
        throw new RuntimeException(e);
      }
    }


    throw new RuntimeException(MessageFormat.format(Messages.getString("RemoteRun.wait.for.build.timeout.exceed.error"), new Object[] { Long.valueOf(this.myTimeout), Long.valueOf(changeListId) }));
  }

Note, I changed the signature to return a String so minor tweak to execute is needed. Also, myServer, which is an instance of Server, did not expose getBuildFailedTests() which I copied in there from somewhere else,

  public List<TestData> getBuildFailedTests(long buildId, int startFromIdx, int maxTests) throws ECommunicationException {
    Vector result = getServerProxy().getBuildFailedTests(String.valueOf(buildId), startFromIdx, maxTests);
    return deserializeObjects(result);
  }
  
  private <T> List<T> deserializeObjects(Vector xmlVector) {
    return XStreamWrapper.deserializeObjects(xmlVector, ourXStreamHolder);
  }


The other thing to note is that you can pass in multiple build configurations on the command like (I mean the -c parameter). I never do that so the code above doesn't handle that case.
0
Comment actions Permalink

Hi,

Where did you find this jar file? I am about to do the same work as you did. Where can I find all the dependencies?

Thank You.

0
Comment actions Permalink

Hi guys,

We've created a feature request in our tracker https://youtrack.jetbrains.com/issue/TW-40383. Please watch and vote for it.

0

Please sign in to leave a comment.