1 using SiliconStudio.Core.Diagnostics;
2 using SiliconStudio.Core.IO;
3 using SiliconStudio.Core.Serialization;
5 using System.Collections.Generic;
6 using System.Diagnostics;
8 using System.Reflection;
9 using System.Threading.Tasks;
11 namespace SiliconStudio.BuildEngine
16 public override string Title {
get {
return "Do nothing!"; } }
18 private static int commandCounter;
19 private readonly
int commandId;
33 commandId = ++commandCounter;
38 return GetType().Name +
" " + commandId;
43 base.ComputeParameterHash(stream);
46 writer.Write(commandId);
54 foreach (MethodInfo method
in typeof(
TestSession).GetMethods())
56 if (method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType == typeof(
Logger))
58 if (
string.Compare(method.Name, testName, StringComparison.OrdinalIgnoreCase) == 0)
59 method.Invoke(
this,
new object[] { logger });
67 if (curLevel == maxLevel)
70 for (var i = 0; i < stepsPerLevel; ++i)
73 if (curParent != null)
74 BuildStep.LinkBuildSteps(curParent, step);
75 BuildStepsRecursively(builder, steps, stepsPerLevel, maxLevel, step, curLevel + 1);
82 string appPath = VirtualFileSystem.GetAbsolutePath(
"/data/TestVeryLargeNumberOfEmptyCommands");
83 string dbPath = appPath +
"/TestVeryLargeNumberOfEmptyCommands";
85 if (Directory.Exists(dbPath))
86 Directory.Delete(dbPath,
true);
88 Directory.CreateDirectory(dbPath);
89 VirtualFileSystem.MountFileSystem(
"/data/db", dbPath);
90 logger.ActivateLog(LogMessageType.Debug);
92 var steps =
new List<BuildStep>();
93 const int StepsPerLevel = 5;
94 const int MaxLevel = 5;
96 BuildStepsRecursively(builder, steps, StepsPerLevel, MaxLevel);
98 for (var i = 0; i < MaxLevel; ++i)
100 stepCount += (int)Math.Pow(StepsPerLevel, i + 1);
102 Debug.Assert(steps.Count == stepCount);
104 logger.Info(stepCount +
" steps registered.");
105 logger.Info(
"Starting builder (logger disabled)");
106 logger.ActivateLog(LogMessageType.Fatal);
108 logger.ActivateLog(LogMessageType.Debug);
109 logger.Info(
"Build finished (logger re-enabled)");
113 Debug.Assert(step.Status == ResultStatus.Successful);
override void ComputeParameterHash(Stream stream)
Implements SerializationStream as a binary writer.
ResultStatus
Status of a command.
Base implementation for ILogger.
Mode
Indicate which mode to use with this builder
override Task< ResultStatus > DoCommandOverride(ICommandContext commandContext)
The method to override containing the actual command code. It is called by the DoCommand function ...
static void TestVeryLargeNumberOfEmptyCommands(Logger logger)
static void ResetCounter()
void RunTest(string testName, Logger logger)
override string ToString()