changeset 74:a5f3d4f24843 8.1.x

fixed TW-34285 - bundled new version of JetBrains.CommandLine.Symbols.exe; passed list of files via file
author Evgeniy.Koshkin
date Mon, 03 Mar 2014 12:58:24 +0400
parents fd2005a04e4e
children 737ef280a587
files .idea/modules.xml agent-tests/agent-tests.iml agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java tools/JetSymbols/JetBrains.CommandLine.Symbols.exe tools/JetSymbols/JetBrains.Platform.Symbols.Interop.WinApi.dll tools/JetSymbols/JetBrains.Platform.Symbols.Metadata.dll tools/JetSymbols/JetBrains.Platform.Symbols.Util.dll
diffstat 8 files changed, 224 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/.idea/modules.xml	Thu Feb 27 20:30:21 2014 +0400
+++ b/.idea/modules.xml	Mon Mar 03 12:58:24 2014 +0400
@@ -3,6 +3,7 @@
   <component name="ProjectModuleManager">
     <modules>
       <module fileurl="file://$PROJECT_DIR$/agent/agent.iml" filepath="$PROJECT_DIR$/agent/agent.iml" />
+      <module fileurl="file://$PROJECT_DIR$/agent-tests/agent-tests.iml" filepath="$PROJECT_DIR$/agent-tests/agent-tests.iml" />
       <module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
       <module fileurl="file://$PROJECT_DIR$/idea-resolve-helper.iml" filepath="$PROJECT_DIR$/idea-resolve-helper.iml" />
       <module fileurl="file://$PROJECT_DIR$/server/server.iml" filepath="$PROJECT_DIR$/server/server.iml" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent-tests/agent-tests.iml	Mon Mar 03 12:58:24 2014 +0400
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="true" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="agent" />
+    <orderEntry type="library" name="Test-Api" level="project" />
+    <orderEntry type="library" name="testng" level="project" />
+    <orderEntry type="library" name="jmock" level="project" />
+    <orderEntry type="library" name="Common-Api" level="project" />
+    <orderEntry type="library" name="Idea-OpenApi" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="TeamCity agent runtime" level="project" />
+  </component>
+</module>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent-tests/src/jetbrains/buildServer/symbols/JetSymbolsExeTest.java	Mon Mar 03 12:58:24 2014 +0400
@@ -0,0 +1,190 @@
+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;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+
+/**
+ * @author Evgeniy.Koshkin
+ */
+public class JetSymbolsExeTest extends BaseTestCase implements BuildProgressLogger {
+
+  private JetSymbolsExe myExe;
+
+  @Override
+  @BeforeMethod
+  public void setUp() throws Exception {
+    super.setUp();
+    File homeDir = new File("tools\\JetSymbols").getAbsoluteFile();
+    assertTrue(homeDir.isDirectory());
+    myExe = new JetSymbolsExe(homeDir);
+  }
+
+  @Test
+  public void testCmdParametersLengthLimit() throws Exception {
+    myExe.dumpGuidsToFile(getFilesCollection(500), FileUtil.createTempFile("testCmdParametersLengthLimit", ".out"), this);
+  }
+
+  private Collection<File> getFilesCollection(int count) throws IOException {
+    Collection<File> result = new HashSet<File>();
+    for (int i = 0; i < count; i++){
+      result.add(FileUtil.createTempFile("foo", "boo"));
+    }
+    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) {
+
+  }
+}
--- a/agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java	Thu Feb 27 20:30:21 2014 +0400
+++ b/agent/src/jetbrains/buildServer/symbols/tools/JetSymbolsExe.java	Mon Mar 03 12:58:24 2014 +0400
@@ -4,8 +4,10 @@
 import jetbrains.buildServer.ExecResult;
 import jetbrains.buildServer.SimpleCommandLineProcessRunner;
 import jetbrains.buildServer.agent.BuildProgressLogger;
+import jetbrains.buildServer.util.FileUtil;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Collection;
 
 /**
@@ -21,14 +23,12 @@
     myExePath = new File(homeDir, SYMBOLS_EXE);
   }
 
-  public void dumpGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger){
+  public void 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()));
-    for(File file : files){
-      commandLine.addParameter(file.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();
@@ -41,4 +41,14 @@
     buildLogger.warning("Stderr: " + execResult.getStderr());
     buildLogger.exception(execResult.getException());
   }
+
+  private File dumpPathsToFile(Collection<File> files) throws IOException {
+    final File result = FileUtil.createTempFile(DUMP_SYMBOL_SIGN_CMD, ".input");
+    StringBuilder contentBuilder = new StringBuilder();
+    for(File file : files){
+      contentBuilder.append(file.getPath()).append("\n");
+    }
+    FileUtil.writeToFile(result, contentBuilder.toString().getBytes());
+    return result;
+  }
 }
Binary file tools/JetSymbols/JetBrains.CommandLine.Symbols.exe has changed
Binary file tools/JetSymbols/JetBrains.Platform.Symbols.Interop.WinApi.dll has changed
Binary file tools/JetSymbols/JetBrains.Platform.Symbols.Metadata.dll has changed
Binary file tools/JetSymbols/JetBrains.Platform.Symbols.Util.dll has changed