/// <summary> /// Setting up the tool to execute through the list of INFs randomly or in order /// </summary> /// <param name="randomizeList"></param> /// <param name="loopCount"></param> /// <param name="startChoice"></param> /// <param name="stopOnErrorSTR"></param> /// <param name="groupFirmwareSTR"></param> internal static void RandomizeList(string randomizeList, string loopCount, string startChoice, string stopOnErrorSTR, string groupFirmwareSTR, string custom) { Console.WriteLine("randomizeList = " + randomizeList); bool randomize = Convert.ToBoolean(randomizeList); int executionCount = Convert.ToInt32(loopCount); string dumpFilePath = string.Empty; try { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("RandomizeList starting..."); Console.ForegroundColor = ConsoleColor.White; List <string> infsPathList = GetData.GetInfPathsList(Program.dirName); int infListCount = GetData.GetPathListCount(Program.dirName); Console.WriteLine("infListCount : " + infListCount); List <int> numbers = new List <int>(Enumerable.Range(1, infListCount)); switch (randomize) { case true: numbers.Shuffle(infListCount); string infIndexList = string.Join(",", numbers.GetRange(0, infListCount)); File.WriteAllText(Program.seedFilePath + executionCount + ".txt", infIndexList); Array list = infIndexList.Split(',').Select(Int32.Parse).ToArray <int>(); XMLWriter.CreateXML(Program.dirName, randomize, infIndexList, infIndexList, startChoice, executionCount, Program.supportFolderLOC, Program.InputTestFilePath, stopOnErrorSTR, groupFirmwareSTR, dumpFilePath, custom); Utilities.CopyFile(Program.InputTestFilePath, Program.InputTestFilePathBAK); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("...going to StartStress from TRUE next..."); Console.ForegroundColor = ConsoleColor.White; DriverStressInit.StartStress(Program.InputTestFilePath, Program.installer, Program.dirName, startChoice, Program.rollbackLine, infListCount = 0); break; case false: infIndexList = string.Join(",", numbers.GetRange(0, infListCount)); File.WriteAllText(Program.seedFilePath + executionCount + ".txt", infIndexList); Console.WriteLine("we'll just continue as normal and NOT randomize the list"); XMLWriter.CreateXML(Program.dirName, randomize, infIndexList, infIndexList, startChoice, executionCount, Program.supportFolderLOC, Program.InputTestFilePath, stopOnErrorSTR, groupFirmwareSTR, dumpFilePath, custom); Utilities.CopyFile(Program.InputTestFilePath, Program.InputTestFilePathBAK); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("...going to StartStress from FALSE next..."); Console.ForegroundColor = ConsoleColor.White; DriverStressInit.StartStress(Program.InputTestFilePath, Program.installer, Program.dirName, startChoice, Program.rollbackLine, infListCount = 0); break; } ExecuteFromList.ExecuteTheList(randomize, executionCount, startChoice); } catch (Exception ex) { GetData.GetExceptionMessage(ex); } }
/// <summary> /// attempt to move the devMgr window over to the left after it opens /// so it is easier to monitor when running locally if need be /// currently not moving though /// </summary> /// <param name="hWnd"></param> /// <param name="X"></param> /// <param name="Y"></param> /// <param name="nWidth"></param> /// <param name="nHeight"></param> /// <param name="bRepaint"></param> /// <returns></returns> internal static void Main(string[] args) { bool show_help = false; List <string> extra = new List <string>(); ShowWindow(ThisConsole, MAXIMIZE); try { // create the .bat file used by the runonce registry entry to start testing again post-reboot if (!File.Exists(reStartBAT)) { File.WriteAllText(reStartBAT, "cd " + dirName + Environment.NewLine + stressAppPath); } string stressLog = "DriverCapsuleStressLog.txt"; Logger.AppendToFile = true; Logger.LogFileName = stressLog; Logger.LogDirName = dirName; if (!File.Exists(stressLog)) { Logger.AddLogFile(stressLog); } //Logger.Verbose(); if (!File.Exists(InputTestFilePath)) { // get user input parameters if there is not already an XML file to run from var p = new OptionSet() { { "r|randomizeList", "True or False - randomize the execution of the INFs", v => randomizeList = v }, { "i|loopCount", "the number of {TIMES} to stress drivers\\capsules. this must be an integer.", v => loopCount = v }, { "s|startChoice", "Choose driver\\capsule to install first(default will be UEFI", v => startChoice = v }, { "e|stopOnErrorSTR", "Stop testing if there is an error or failure and collect logs", v => stopOnErrorSTR = v }, { "g|groupFirmwareSTR", "Install all firmware then reboot rather than install\reboot for each", v => groupFirmwareSTR = v }, { "c|custom", "Install all drivers in a custom order using comma seperated list of INF names (e.g. SurfaceUEFI.inf,IntcAudioBus.inf,IntcOED.inf) or enter 'none'", v => custom = v }, { "h|help", "show this message and exit", v => show_help = v != null }, }; if (show_help) { ShowHelp(p); return; } extra = p.Parse(args); if (extra.Count > 0) { // is the WTT service started. StartStopServices.StopService("wttsvc"); // start testing here if starting fresh CreateListOrder.RandomizeList(args[1], args[3], args[5], args[7], args[9], args[11]); } else { ShowHelp(p); return; } } else { // is the WTT service started. StartStopServices.StopService("wttsvc"); // starts here if there is already an XML file written to run from XDocument xdoc = XDocument.Load(InputTestFilePath); string infIndexListString = XMLReader.GetSeed(InputTestFilePathBAK); int executionCount = XMLReader.GetExecutionCount(InputTestFilePath); supportFolderLOC = xdoc.XPathSelectElement("/Tests/TestChoices/SupportFolder").Value.ToString(); Array infListFromXML = xdoc.XPathSelectElements("/Tests/InfDirectories/InfDir").ToArray(); bool randomize = GetData.GetRandomChoice(InputTestFilePath); ExecuteFromList.ExecuteTheList(randomize, executionCount, startChoice); } } catch (Exception ex) { GetData.GetExceptionMessage(ex); } }