changeset 77:b3f951ab16eb 8.1.x

fixed TW-36764
author Evgeniy.Koshkin
date Tue, 23 Dec 2014 19:02:47 +0300
parents 737ef280a587
children 64eaa82c4529
files agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java agent-tests/testData/TeamCityAPI.IDE.dll agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java
diffstat 3 files changed, 24 insertions(+), 157 deletions(-) [+]
line wrap: on
line diff
--- a/agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java	Mon Mar 03 13:50:57 2014 +0400
+++ b/agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java	Tue Dec 23 19:02:47 2014 +0300
@@ -1,11 +1,7 @@
 package jetbrains.buildServer.symbols;
 
 import jetbrains.buildServer.BaseTestCase;
-import jetbrains.buildServer.BuildProblemData;
-import jetbrains.buildServer.agent.BuildProgressLogger;
-import jetbrains.buildServer.agent.FlowLogger;
 import jetbrains.buildServer.agent.NullBuildProgressLogger;
-import jetbrains.buildServer.messages.BuildMessage1;
 import jetbrains.buildServer.symbols.tools.JetSymbolsExe;
 import jetbrains.buildServer.util.FileUtil;
 import org.testng.annotations.BeforeMethod;
@@ -14,13 +10,13 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
-import java.util.Date;
+import java.util.Collections;
 import java.util.HashSet;
 
 /**
  * @author Evgeniy.Koshkin
  */
-public class JetSymbolsExeTest extends BaseTestCase implements BuildProgressLogger {
+public class JetSymbolsExeTest extends BaseTestCase {
 
   private JetSymbolsExe myExe;
 
@@ -35,7 +31,17 @@
 
   @Test
   public void testCmdParametersLengthLimit() throws Exception {
-    myExe.dumpGuidsToFile(getFilesCollection(500), FileUtil.createTempFile("testCmdParametersLengthLimit", ".out"), this);
+    final File output = FileUtil.createTempFile("testCmdParametersLengthLimit", ".out");
+    final int dumpExitCode = myExe.dumpGuidsToFile(getFilesCollection(500), output, new NullBuildProgressLogger());
+    assertEquals(0, dumpExitCode);
+  }
+
+  @Test
+  public void testSpacesInPaths() throws Exception {
+    final File output = FileUtil.createTempFile("test spaces in paths", ".out");
+    final File input = FileUtil.createTempFile("test spaces in paths", ".in");
+    final int exitCode = myExe.dumpGuidsToFile(Collections.singleton(input), output, new NullBuildProgressLogger());
+    assertEquals(0, exitCode);
   }
 
   private Collection<File> getFilesCollection(int count) throws IOException {
@@ -45,146 +51,4 @@
     }
     return result;
   }
-
-  public void activityStarted(String activityName, String activityType) {
-
-  }
-
-  public void activityStarted(String activityName, String activityDescription, String activityType) {
-
-  }
-
-  public void activityFinished(String activityName, String activityType) {
-
-  }
-
-  public void targetStarted(String targetName) {
-
-  }
-
-  public void targetFinished(String targetName) {
-
-  }
-
-  public void buildFailureDescription(String message) {
-
-  }
-
-  public void internalError(String type, String message, Throwable throwable) {
-
-  }
-
-  public void progressStarted(String message) {
-
-  }
-
-  public void progressFinished() {
-
-  }
-
-  public void logMessage(BuildMessage1 message) {
-
-  }
-
-  public void logTestStarted(String name) {
-
-  }
-
-  public void logTestStarted(String name, Date timestamp) {
-
-  }
-
-  public void logTestFinished(String name) {
-
-  }
-
-  public void logTestFinished(String name, Date timestamp) {
-
-  }
-
-  public void logTestIgnored(String name, String reason) {
-
-  }
-
-  public void logSuiteStarted(String name) {
-
-  }
-
-  public void logSuiteStarted(String name, Date timestamp) {
-
-  }
-
-  public void logSuiteFinished(String name) {
-
-  }
-
-  public void logSuiteFinished(String name, Date timestamp) {
-
-  }
-
-  public void logTestStdOut(String testName, String out) {
-
-  }
-
-  public void logTestStdErr(String testName, String out) {
-
-  }
-
-  public void logTestFailed(String testName, Throwable e) {
-
-  }
-
-  public void logComparisonFailure(String testName, Throwable e, String expected, String actual) {
-
-  }
-
-  public void logTestFailed(String testName, String message, String stackTrace) {
-
-  }
-
-  public void flush() {
-
-  }
-
-  public void ignoreServiceMessages(Runnable runnable) {
-
-  }
-
-  public FlowLogger getFlowLogger(String flowId) {
-    return null;
-  }
-
-  public FlowLogger getThreadLogger() {
-    return null;
-  }
-
-  public String getFlowId() {
-    return null;
-  }
-
-  public void logBuildProblem(BuildProblemData buildProblem) {
-
-  }
-
-  public void message(String message) {
-
-  }
-
-  public void error(String message) {
-    fail(message);
-  }
-
-  public void warning(String message) {
-
-  }
-
-  public void exception(Throwable th) {
-    if(th != null) {
-      fail(th.toString());
-    }
-  }
-
-  public void progressMessage(String message) {
-
-  }
 }
Binary file agent-tests/testData/TeamCityAPI.IDE.dll has changed
--- a/agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java	Mon Mar 03 13:50:57 2014 +0400
+++ b/agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java	Tue Dec 23 19:02:47 2014 +0300
@@ -23,23 +23,26 @@
     myExePath = new File(homeDir, SYMBOLS_EXE);
   }
 
-  public void dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
+  public int dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
     final GeneralCommandLine commandLine = new GeneralCommandLine();
     commandLine.setExePath(myExePath.getPath());
     commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
-    commandLine.addParameter(String.format("/o=\"%s\"", output.getPath()));
-    commandLine.addParameter(String.format("/i=\"%s\"", dumpPathsToFile(files).getPath()));
+    commandLine.addParameter(String.format("/o=%s", output.getPath()));
+    commandLine.addParameter(String.format("/i=%s", dumpPathsToFile(files).getPath()));
     buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
     final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
     final String stdout = execResult.getStdout();
     if(!stdout.isEmpty()){
       buildLogger.message("Stdout: " + stdout);
     }
-    if (execResult.getExitCode() == 0) return;
-    buildLogger.warning(String.format("%s ends with non-zero exit code.", SYMBOLS_EXE));
-    buildLogger.warning("Stdout: " + stdout);
-    buildLogger.warning("Stderr: " + execResult.getStderr());
-    buildLogger.exception(execResult.getException());
+    final int exitCode = execResult.getExitCode();
+    if (exitCode != 0) {
+      buildLogger.warning(String.format("%s ends with non-zero exit code.", SYMBOLS_EXE));
+      buildLogger.warning("Stdout: " + stdout);
+      buildLogger.warning("Stderr: " + execResult.getStderr());
+      buildLogger.exception(execResult.getException());
+    }
+    return exitCode;
   }
 
   private File dumpPathsToFile(Collection<File> files) throws IOException {