public void ReadAndRewriteRebootCountInLogFile() { if (IsLogFileExists == false) { throw new Exception("File rebootLog.txt does not exist."); } try { string text = File.ReadAllText($"{ Constants.LogFileName}"); string rebootCountString = Regex.Match(text, @"(?<=\|)(.*?)(?=\|)").ToString(); int rebootCount = 0; if (!Int32.TryParse(rebootCountString, out rebootCount)) { throw new Exception("Cannot convert from string to int."); } text = text.Replace($@"|{rebootCount}|", $@"|{++rebootCount}|"); File.WriteAllText(LogFileFullPath, text); zTestSettingModel.NeedToRunTimes = rebootCount; _xmlService.EditZTestSetting(zTestSettingModel); } catch (Exception) { throw new Exception("Something went wrong!"); } }
public void SetTheEnvironment() { //1. Enable complete memory dump _testEnvironment.EnableCompleteMemoryDump(); //2. Create XML file ZTestSettingModel testSettingModel = new ZTestSettingModel() { TestName = TestType.KernelStressTest.ToString(), NeedToRunTimes = 1, IsSettedEnvironment = true }; string targetXMLPath = _fileService.AppPath + "\\" + Constants.ZTestSettingConfigName; Console.WriteLine("Please select from RS1 to RS5:"); string windowsBuild = _inputService.ReadRSVersion().ToUpper(); string operatingSystem = Environment.Is64BitOperatingSystem ? SystemType.AMD64.ToString().ToLower() : SystemType.x86.ToString(); string KSKfilePath = $@"\\winbuilds\release\Milestone\{windowsBuild}\RTM\{operatingSystem}fre\bin\kernel\kstress"; testSettingModel.TestFileFullPath = KSKfilePath; _xmlService.EditZTestSetting(testSettingModel); //3. reboot the system _logInService.EnableAutoLogIn(); _fileService.CreateShortcutInStartupFolder(); _rebootSystem.ShutDownTheSystem(); }
public void SetTheEnvironment() { ZTestSettingModel testSetting = new ZTestSettingModel() { TestName = TestType.SleepTest.ToString(), NeedToRunTimes = 1, IsSettedEnvironment = true }; _xmlService.EditZTestSetting(testSetting); StartTest(); }
public void SetTheEnvironment() { ZTestSettingModel testSetting = new ZTestSettingModel() { TestName = TestType.DebuggerSetting.ToString(), NeedToRunTimes = 1, IsSettedEnvironment = true }; Console.WriteLine("Please open new CMD window as Administrator and run following commands to set the Environment and after that press any key"); Console.WriteLine(" bcdedit /set {bootmgr} testsigning on"); Console.WriteLine(" bcdedit /set {bootmgr} bootdebug on"); Console.WriteLine(" bcdedit /set testsigning on"); Console.WriteLine(" bcdedit /bootdebug on"); Console.WriteLine(" bcdedit /debug on"); Console.WriteLine("press any key:"); Console.ReadKey(); _xmlService.EditZTestSetting(testSetting); StartTest(); }