Index: project/core/sourcecontrol/RobocopySourceControl.cs
===================================================================
--- project/core/sourcecontrol/RobocopySourceControl.cs (revision 6495)
+++ project/core/sourcecontrol/RobocopySourceControl.cs (working copy)
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
@@ -54,7 +55,7 @@
builder.AddArgument("/L");
- Modification[] modifications = GetModifications(new ProcessInfo(Executable, builder.ToString(), null, successExitCodes), from.StartTime, to.StartTime);
+ Modification[] modifications = GetModifications(new ProcessInfo(Executable, builder.ToString(), null, ProcessPriorityClass.Normal, successExitCodes), from.StartTime, to.StartTime);
return modifications;
}
@@ -72,7 +73,7 @@
AddStandardArguments(builder, destinationDirectory);
- Execute(new ProcessInfo(Executable, builder.ToString(), null, successExitCodes));
+ Execute(new ProcessInfo(Executable, builder.ToString(), null, ProcessPriorityClass.Normal, successExitCodes));
}
}
Index: project/core/tasks/BaseExecutableTask.cs
===================================================================
--- project/core/tasks/BaseExecutableTask.cs (revision 6495)
+++ project/core/tasks/BaseExecutableTask.cs (working copy)
@@ -1,4 +1,5 @@
using System.Collections;
+using System.Diagnostics;
using System.IO;
using ThoughtWorks.CruiseControl.Core.Util;
@@ -12,6 +13,7 @@
protected abstract string GetProcessFilename();
protected abstract string GetProcessArguments(IIntegrationResult result);
protected abstract string GetProcessBaseDirectory(IIntegrationResult result);
+ protected abstract ProcessPriorityClass GetProcessPriorityClass();
protected abstract int GetProcessTimeout();
protected virtual int[] GetProcessSuccessCodes()
@@ -21,7 +23,7 @@
protected virtual ProcessInfo CreateProcessInfo(IIntegrationResult result)
{
- ProcessInfo info = new ProcessInfo(GetProcessFilename(), GetProcessArguments(result), GetProcessBaseDirectory(result), GetProcessSuccessCodes());
+ ProcessInfo info = new ProcessInfo(GetProcessFilename(), GetProcessArguments(result), GetProcessBaseDirectory(result),GetProcessPriorityClass(), GetProcessSuccessCodes());
info.TimeOut = GetProcessTimeout();
IDictionary properties = result.IntegrationProperties;
Index: project/core/tasks/DevenvTask.cs
===================================================================
--- project/core/tasks/DevenvTask.cs (revision 6495)
+++ project/core/tasks/DevenvTask.cs (working copy)
@@ -2,6 +2,7 @@
{
using System;
using System.Collections;
+ using System.Diagnostics;
using System.IO;
using System.Text;
using Exortech.NetReflector;
@@ -61,6 +62,7 @@
public const int DEFAULT_BUILD_TIMEOUT = 600;
public const string DEFAULT_BUILDTYPE = "rebuild";
public const string DEFAULT_PROJECT = "";
+ public const ProcessPriorityClass DEFAULT_PRIORITY = ProcessPriorityClass.Normal;
private readonly IRegistry registry;
private readonly ProcessExecutor executor;
@@ -231,6 +233,14 @@
[ReflectorProperty("project", Required = false)]
public string Project = DEFAULT_PROJECT;
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = DEFAULT_PRIORITY;
+
protected override bool Execute(IIntegrationResult result)
{
result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : string.Format("Executing Devenv :{0}", GetArguments()));
@@ -246,7 +256,7 @@
private ProcessResult TryToRun(IIntegrationResult result)
{
- ProcessInfo processInfo = new ProcessInfo(Executable, GetArguments(), result.WorkingDirectory);
+ ProcessInfo processInfo = new ProcessInfo(Executable, GetArguments(), result.WorkingDirectory, Priority);
processInfo.TimeOut = BuildTimeoutSeconds * 1000;
IDictionary properties = result.IntegrationProperties;
Index: project/core/tasks/DupFinderTask.cs
===================================================================
--- project/core/tasks/DupFinderTask.cs (revision 6495)
+++ project/core/tasks/DupFinderTask.cs (working copy)
@@ -7,12 +7,13 @@
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
+ using System.Collections.Generic;
+ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
+ using System.Xml;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
- using System.Xml;
- using System.Collections.Generic;
///
///
@@ -69,6 +70,9 @@
#region Private consts
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Private constant")]
private const string DefaultExecutable = "dupfinder";
+
+ /// Default priority class
+ private const ProcessPriorityClass DefaultPriority = ProcessPriorityClass.Normal;
#endregion
#region Private fields
@@ -109,6 +113,16 @@
public string Executable { get; set; }
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+ #endregion
+
#region InputDir
///
/// The input directory to scan. If relative, this will be relative to the project working directory.
@@ -369,6 +383,16 @@
}
#endregion
+ #region GetProcessPriorityClass()
+ ///
+ /// Gets the requested priority class value for this Task.
+ ///
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
+ #endregion
+
#region RemoveInputDir()
///
/// Removes the input directory from the filenames.
Index: project/core/tasks/ExecutableTask.cs
===================================================================
--- project/core/tasks/ExecutableTask.cs (revision 6495)
+++ project/core/tasks/ExecutableTask.cs (working copy)
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.Diagnostics;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
-using System.Diagnostics;
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
@@ -82,6 +82,7 @@
: BaseExecutableTask
{
public const int DEFAULT_BUILD_TIMEOUT = 600;
+ public const ProcessPriorityClass DEFAULT_PRIORITY = ProcessPriorityClass.Normal;
public ExecutableTask() : this(new ProcessExecutor())
{}
@@ -102,6 +103,14 @@
public string Executable = string.Empty;
///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = DEFAULT_PRIORITY;
+
+ ///
/// The directory to run the process in. If relative, is a subdirectory of the Project Working
/// Directory.
///
@@ -239,6 +248,11 @@
return BuildTimeoutSeconds*1000;
}
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
+
public override string ToString()
{
return string.Format(@" BaseDirectory: {0}, Executable: {1}", ConfiguredBaseDirectory, Executable);
Index: project/core/tasks/GendarmeTask.cs
===================================================================
--- project/core/tasks/GendarmeTask.cs (revision 6495)
+++ project/core/tasks/GendarmeTask.cs (working copy)
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.IO;
using System.Text;
using Exortech.NetReflector;
@@ -56,6 +57,7 @@
public const bool defaultVerbose = false;
public const bool defaultFailBuildOnFoundDefects = false;
public const int defaultVerifyTimeout = 0;
+ public const ProcessPriorityClass defaultPriority = ProcessPriorityClass.Normal;
private readonly IFileDirectoryDeleter fileDirectoryDeleter = new IoService();
@@ -85,6 +87,14 @@
[ReflectorProperty("baseDirectory", Required = false)]
public string ConfiguredBaseDirectory = string.Empty;
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = defaultPriority;
+
///
/// Specify the configuration file.
///
@@ -238,6 +248,11 @@
return VerifyTimeoutSeconds * 1000;
}
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
+
protected override bool Execute(IIntegrationResult result)
{
string gendarmeOutputFile = GetGendarmeOutputFile(result);
Index: project/core/tasks/MsBuildTask.cs
===================================================================
--- project/core/tasks/MsBuildTask.cs (revision 6495)
+++ project/core/tasks/MsBuildTask.cs (working copy)
@@ -1,12 +1,13 @@
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
+ using System;
using System.Collections;
+ using System.Diagnostics;
using System.IO;
+ using System.Reflection;
using System.Text;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
- using System.Reflection;
- using System;
///
///
@@ -136,8 +137,19 @@
[ReflectorProperty("timeout", Required = false)]
public int Timeout = DefaultTimeout;
#endregion
+
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public string Priority = ProcessPriorityClass.Normal.ToString();
#endregion
+ #endregion
+
protected override string GetProcessFilename()
{
return string.IsNullOrEmpty(Executable) ? GetDefaultExecutable() : Executable;
@@ -179,6 +191,14 @@
return Timeout * 1000;
}
+ ///
+ /// Gets the requested priority class value for this Task.
+ ///
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), this.Priority);
+ }
+
protected override bool Execute(IIntegrationResult result)
{
result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description :
Index: project/core/tasks/NAntTask.cs
===================================================================
--- project/core/tasks/NAntTask.cs (revision 6495)
+++ project/core/tasks/NAntTask.cs (working copy)
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using System.Diagnostics;
using System.IO;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
@@ -119,6 +120,7 @@
public const string DefaultLogger = "NAnt.Core.XmlLogger";
public const string DefaultListener = "NAnt.Core.DefaultLogger";
public const bool DefaultNoLogo = true;
+ public const ProcessPriorityClass DefaultPriority = ProcessPriorityClass.Normal;
private readonly IFileDirectoryDeleter fileDirectoryDeleter = new IoService();
@@ -154,6 +156,16 @@
public string Executable = defaultExecutable;
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = DefaultPriority;
+ #endregion
+
#region BuildFile
///
/// The name of the build file to run, relative to the baseDirectory.
@@ -283,6 +295,11 @@
{
return result.BaseFromWorkingDirectory(ConfiguredBaseDirectory);
}
+
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
private static void AppendIntegrationResultProperties(ProcessArgumentBuilder buffer, IIntegrationResult result)
{
Index: project/core/tasks/NCoverProfileTask.cs
===================================================================
--- project/core/tasks/NCoverProfileTask.cs (revision 6495)
+++ project/core/tasks/NCoverProfileTask.cs (working copy)
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
using System.Text;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
-using System.IO;
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
@@ -114,6 +115,16 @@
public string Executable { get; set; }
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+ #endregion
+
#region TimeOut
///
/// The time-out period in seconds. If the task does no finish running in this time it will be terminated.
@@ -613,7 +624,17 @@
return buffer.ToString();
}
#endregion
+
+ #region GetProcessPriorityClass()
+ ///
+ /// Gets the requested priority class value for this Task.
+ ///
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
#endregion
+ #endregion
#region Private methods
#region RootPath()
Index: project/core/tasks/NCoverReportTask.cs
===================================================================
--- project/core/tasks/NCoverReportTask.cs (revision 6495)
+++ project/core/tasks/NCoverReportTask.cs (working copy)
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
using System.Text;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
-using System.IO;
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
@@ -122,6 +123,16 @@
public string WorkingDirectory { get; set; }
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+ #endregion
+
#region CoverageFile
///
/// The location to read the coverage date from. If relative, this will be relative to baseDir.
@@ -499,7 +510,17 @@
return buffer.ToString();
}
#endregion
+
+ #region GetProcessPriorityClass()
+ ///
+ /// Gets the requested priority class value for this Task.
+ ///
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
#endregion
+ #endregion
#region Private methods
#region RootPath()
Index: project/core/tasks/NDependTask.cs
===================================================================
--- project/core/tasks/NDependTask.cs (revision 6495)
+++ project/core/tasks/NDependTask.cs (working copy)
@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
using System.Text;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
-using System.IO;
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
@@ -79,6 +80,9 @@
{
#region Private consts
private const string defaultExecutable = "NDepend.Console";
+
+ /// Default priority class
+ private const ProcessPriorityClass DefaultPriority = ProcessPriorityClass.Normal;
#endregion
#region Private fields
@@ -131,6 +135,16 @@
public string Executable { get; set; }
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+ #endregion
+
#region EmitXml
///
/// Whether to emit the XML report data or not.
@@ -358,7 +372,17 @@
return buffer.ToString();
}
#endregion
+
+ #region GetProcessPriorityClass()
+ ///
+ /// Gets the requested priority class value for this Task.
+ ///
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
#endregion
+ #endregion
#region Private methods
#region RootPath()
Index: project/core/tasks/NUnitTask.cs
===================================================================
--- project/core/tasks/NUnitTask.cs (revision 6495)
+++ project/core/tasks/NUnitTask.cs (working copy)
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.IO;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
@@ -98,9 +99,19 @@
/// 1.0
/// 600
[ReflectorProperty("timeout", Required = false)]
- public int Timeout = DefaultTimeout;
+ public int Timeout = DefaultTimeout;
#endregion
+ #region Priority
+ ///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+ #endregion
+
#region ExcludedCategories
///
/// List of the test categories to be excluded from the NUnit run. The tests need to have the CategoryAttribute set.
@@ -150,7 +161,7 @@
Log.Debug(string.Format("Running unit tests: {0} {1}", NUnitPath, args));
- ProcessInfo info = new ProcessInfo(NUnitPath, args, result.WorkingDirectory);
+ ProcessInfo info = new ProcessInfo(NUnitPath, args, result.WorkingDirectory, Priority);
info.TimeOut = Timeout * 1000;
return info;
}
Index: project/core/tasks/PowerShellTask.cs
===================================================================
--- project/core/tasks/PowerShellTask.cs (revision 6495)
+++ project/core/tasks/PowerShellTask.cs (working copy)
@@ -3,6 +3,7 @@
using System;
using System.Collections;
using System.Collections.Specialized;
+ using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
@@ -92,6 +93,14 @@
}
///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = ProcessPriorityClass.Normal;
+
+ ///
/// The directory that the PowerShell scripts are stored in.
///
/// 1.5
@@ -206,7 +215,7 @@
private ProcessInfo NewProcessInfoFrom(IIntegrationResult result)
{
- ProcessInfo info = new ProcessInfo( executable, Args(result), BaseDirectory(result), successExitCodes);
+ ProcessInfo info = new ProcessInfo( executable, Args(result), BaseDirectory(result), this.Priority, successExitCodes);
info.TimeOut = BuildTimeoutSeconds*1000;
SetConfiguredEnvironmentVariables(info.EnvironmentVariables, this.EnvironmentVariables);
IDictionary properties = result.IntegrationProperties;
Index: project/core/tasks/RakeTask.cs
===================================================================
--- project/core/tasks/RakeTask.cs (revision 6495)
+++ project/core/tasks/RakeTask.cs (working copy)
@@ -1,5 +1,6 @@
namespace ThoughtWorks.CruiseControl.Core.Tasks
{
+ using System.Diagnostics;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core.Util;
@@ -61,6 +62,7 @@
{
public const int DefaultBuildTimeout = 600;
public const string DefaultExecutable = @"rake";
+ public const ProcessPriorityClass DefaultPriority = ProcessPriorityClass.Normal;
///
/// Any arguments to pass through to Rake (e.g to specify build properties).
@@ -105,6 +107,14 @@
public string Executable = DefaultExecutable;
///
+ /// The priority class of the spawned process.
+ ///
+ /// 1.5
+ /// Normal
+ [ReflectorProperty("priority", Required = false)]
+ public ProcessPriorityClass Priority = DefaultPriority;
+
+ ///
/// The name of the Rakefile to run, relative to the baseDirectory.
///
/// None
@@ -215,6 +225,11 @@
return Executable;
}
+ protected override ProcessPriorityClass GetProcessPriorityClass()
+ {
+ return this.Priority;
+ }
+
public string TargetsForPresentation
{
get
Index: project/core/util/ProcessExecutor.cs
===================================================================
--- project/core/util/ProcessExecutor.cs (revision 6495)
+++ project/core/util/ProcessExecutor.cs (working copy)
@@ -142,14 +142,36 @@
process.EnableRaisingEvents = true;
supervisingThread = Thread.CurrentThread;
- try
+ string filename = Path.Combine(process.StartInfo.WorkingDirectory, process.StartInfo.FileName);
+
+ try
{
bool isNewProcess = process.Start();
if (!isNewProcess) Log.Warning("Reusing existing process...");
+
+ // avoid useless setting of the default
+ if (processInfo.Priority != System.Diagnostics.Process.GetCurrentProcess().PriorityClass)
+ {
+ try
+ {
+ Log.Debug(string.Format("Setting PriorityClass on [{0}] to {1}", filename, processInfo.Priority));
+ process.PriorityClass = processInfo.Priority;
+ }
+ catch (Exception ex)
+ {
+ if (!process.HasExited)
+ {
+ Log.Info(string.Format("Unable to set PriorityClass on [{0}]: {1}", filename, ex.ToString()));
+ }
+ }
+ }
+ else
+ {
+ Log.Debug(string.Format("Not setting PriorityClass on [{0}] to default {1}", filename, processInfo.Priority));
+ }
}
catch (Win32Exception e)
{
- string filename = Path.Combine(process.StartInfo.WorkingDirectory, process.StartInfo.FileName);
string msg = string.Format("Unable to execute file [{0}]. The file may not exist or may not be executable.", filename);
throw new IOException(msg, e);
}
Index: project/core/util/ProcessInfo.cs
===================================================================
--- project/core/util/ProcessInfo.cs (revision 6495)
+++ project/core/util/ProcessInfo.cs (working copy)
@@ -11,6 +11,10 @@
public const int DefaultTimeout = 120000;
public const int InfiniteTimeout = 0;
+ public const ProcessPriorityClass DEFAULT_PRIORITY = ProcessPriorityClass.Normal;
+
+ public ProcessPriorityClass Priority;
+
private readonly ProcessStartInfo startInfo = new ProcessStartInfo();
private string standardInputContent;
private int timeout = DefaultTimeout;
@@ -24,13 +28,17 @@
this(filename, arguments, null){}
public ProcessInfo(string filename, string arguments, string workingDirectory) :
- this(filename, arguments, workingDirectory, null){}
+ this(filename, arguments, workingDirectory, DEFAULT_PRIORITY){}
- public ProcessInfo(string filename, string arguments, string workingDirectory, int[] successExitCodes)
+ public ProcessInfo(string filename, string arguments, string workingDirectory, ProcessPriorityClass priority) :
+ this(filename, arguments, workingDirectory, priority, null) { }
+
+ public ProcessInfo(string filename, string arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes)
{
- startInfo.FileName = StringUtil.StripQuotes(filename);
+ startInfo.FileName = StringUtil.StripQuotes(filename);
startInfo.Arguments = arguments;
startInfo.WorkingDirectory = StringUtil.StripQuotes(workingDirectory);
+ this.Priority = priority;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
Index: project/UnitTests/Core/Tasks/ExecutableTaskTest.cs
===================================================================
--- project/UnitTests/Core/Tasks/ExecutableTaskTest.cs (revision 6495)
+++ project/UnitTests/Core/Tasks/ExecutableTaskTest.cs (working copy)
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.IO;
using Exortech.NetReflector;
using NMock.Constraints;
@@ -42,6 +43,7 @@
name2
value3
+ BelowNormal
0,1,3,5
";
@@ -58,6 +60,7 @@
Assert.AreEqual("name3", task.EnvironmentVariables[2].name, "Checking name3 environment variable.");
Assert.AreEqual("value3", task.EnvironmentVariables[2].value, "Checking name3 environment value.");
Assert.AreEqual("0,1,3,5", task.SuccessExitCodes);
+ Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
Verify();
}
@@ -75,6 +78,7 @@
Assert.AreEqual("", task.BuildArgs, "Checking BuildArgs property.");
Assert.AreEqual(0, task.EnvironmentVariables.Length, "Checking environment variable array size.");
Assert.AreEqual("", task.SuccessExitCodes);
+ Assert.AreEqual(ProcessPriorityClass.Normal, task.Priority);
Verify();
}
Index: project/UnitTests/Core/Tasks/MsBuildTaskTest.cs
===================================================================
--- project/UnitTests/Core/Tasks/MsBuildTaskTest.cs (revision 6495)
+++ project/UnitTests/Core/Tasks/MsBuildTaskTest.cs (working copy)
@@ -1,3 +1,4 @@
+using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Exortech.NetReflector;
@@ -2,7 +3,7 @@
using NUnit.Framework;
+using Rhino.Mocks;
using ThoughtWorks.CruiseControl.Core;
using ThoughtWorks.CruiseControl.Core.Tasks;
using ThoughtWorks.CruiseControl.Core.Util;
using ThoughtWorks.CruiseControl.Remote;
-using Rhino.Mocks;
@@ -178,6 +179,7 @@
Build;Test
15
Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll;buildresult.xml
+ BelowNormal
";
task = (MsBuildTask) NetReflector.Read(xml);
Assert.AreEqual(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe", task.Executable);
@@ -186,7 +188,8 @@
Assert.AreEqual("Build;Test", task.Targets);
Assert.AreEqual("/p:Configuration=Debug /v:diag", task.BuildArgs);
Assert.AreEqual(15, task.Timeout);
- Assert.AreEqual("Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll;buildresult.xml", task.Logger);
+ Assert.AreEqual("Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll;buildresult.xml", task.Logger);
+ Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
}
[Test]
Index: project/UnitTests/Core/Util/ProcessExecutorTest.cs
===================================================================
--- project/UnitTests/Core/Util/ProcessExecutorTest.cs (revision 6495)
+++ project/UnitTests/Core/Util/ProcessExecutorTest.cs (working copy)
@@ -184,28 +184,28 @@
{
int[] successExitCodes = { 1, 3, 5 };
- ProcessInfo processInfo1 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 1", null, successExitCodes);
+ ProcessInfo processInfo1 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 1", null, ProcessPriorityClass.AboveNormal, successExitCodes);
ProcessResult result1 = executor.Execute(processInfo1);
Assert.AreEqual("Hello World", result1.StandardOutput.Trim());
Assert.AreEqual(1, result1.ExitCode, "Process did not exit successfully");
AssertFalse("process should not return an error", result1.Failed);
- ProcessInfo processInfo2 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 3", null, successExitCodes);
+ ProcessInfo processInfo2 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 3", null, ProcessPriorityClass.AboveNormal, successExitCodes);
ProcessResult result2 = executor.Execute(processInfo2);
Assert.AreEqual("Hello World", result2.StandardOutput.Trim());
Assert.AreEqual(3, result2.ExitCode, "Process did not exit successfully");
AssertFalse("process should not return an error", result2.Failed);
- ProcessInfo processInfo3 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 5", null, successExitCodes);
+ ProcessInfo processInfo3 = new ProcessInfo("cmd.exe", "/C @echo Hello World & exit 5", null, ProcessPriorityClass.AboveNormal, successExitCodes);
ProcessResult result3 = executor.Execute(processInfo3);
Assert.AreEqual("Hello World", result3.StandardOutput.Trim());
Assert.AreEqual(5, result3.ExitCode, "Process did not exit successfully");
AssertFalse("process should not return an error", result3.Failed);
- ProcessInfo processInfo4 = new ProcessInfo("cmd.exe", "/C @echo Hello World", null, successExitCodes);
+ ProcessInfo processInfo4 = new ProcessInfo("cmd.exe", "/C @echo Hello World", null, ProcessPriorityClass.AboveNormal, successExitCodes);
ProcessResult result4 = executor.Execute(processInfo4);
Assert.AreEqual("Hello World", result4.StandardOutput.Trim());
Index: project/UnitTests/Core/Util/ProcessInfoTest.cs
===================================================================
--- project/UnitTests/Core/Util/ProcessInfoTest.cs (revision 6495)
+++ project/UnitTests/Core/Util/ProcessInfoTest.cs (working copy)
@@ -52,7 +52,7 @@
{
int[] successExitCodes = { 1, 3, 5 };
- ProcessInfo info = new ProcessInfo(@"""c:\nant\nant.exe""", null, string.Format(@"""{0}""", Path.GetTempPath()), successExitCodes);
+ ProcessInfo info = new ProcessInfo(@"""c:\nant\nant.exe""", null, string.Format(@"""{0}""", Path.GetTempPath()), ProcessPriorityClass.Normal, successExitCodes);
Assert.IsFalse(info.ProcessSuccessful(0));
Assert.IsTrue(info.ProcessSuccessful(1));