# HG changeset patch # User Evgeniy.Koshkin # Date 1419350567 -10800 # Node ID b3f951ab16ebc92e2e6b597cbad8871f626624f9 # Parent 737ef280a5871499b7d3b173ca9a6cdfe4a1de97 fixed TW-36764 diff -r 737ef280a587 -r b3f951ab16eb agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java --- 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 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) { - - } } diff -r 737ef280a587 -r b3f951ab16eb agent-tests/testData/TeamCityAPI.IDE.dll Binary file agent-tests/testData/TeamCityAPI.IDE.dll has changed diff -r 737ef280a587 -r b3f951ab16eb agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java --- 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 files, File output, BuildProgressLogger buildLogger) throws IOException { + public int dumpGuidsToFile(Collection 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 files) throws IOException {