Beispiel #1
0
        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();
        }
Beispiel #2
0
        public ZTestSettingModel GetZTestSetting(TestType testType)
        {
            List <ZTestSettingModel> testSettingList = new List <ZTestSettingModel>();

            testSettingList = GetZTestSettingsList();
            ZTestSettingModel networkSettings = testSettingList.Find(n => n.TestName == testType.ToString());

            return(networkSettings);
        }
Beispiel #3
0
        public void SetTheEnvironment()
        {
            ZTestSettingModel testSetting = new ZTestSettingModel()
            {
                TestName            = TestType.SleepTest.ToString(),
                NeedToRunTimes      = 1,
                IsSettedEnvironment = true
            };

            _xmlService.EditZTestSetting(testSetting);
            StartTest();
        }
Beispiel #4
0
        public void StartTest()
        {
            zTestSettingModel = _xmlService.GetZTestSetting(TestType.RebootSystemTest);
            if (RebootCount > 10)
            {
                return;
            }

            if (IsLogFileExists)
            {
                Reboot();
            }
        }
Beispiel #5
0
        public void EditZTestSetting(ZTestSettingModel updatedTestSetting)
        {
            List <ZTestSettingModel> testSettingList = new List <ZTestSettingModel>();

            testSettingList = GetZTestSettingsList();
            foreach (var item in testSettingList)
            {
                if (item.TestName == updatedTestSetting.TestName)
                {
                    item.NeedToRunTimes      = updatedTestSetting.NeedToRunTimes;
                    item.IsSettedEnvironment = updatedTestSetting.IsSettedEnvironment;
                }
            }
            SerializeToXML(testSettingList);
        }
Beispiel #6
0
        public static void SetConfiguration()
        {
            List <ZTestSettingModel> testConfigurationList = _xmlService.GetZTestSettingsList();

            ZTestSettingModel testSetting = testConfigurationList.Aggregate((seed, t) => t.Priority < seed.Priority ? t : seed);
            TestType          testType    = (TestType)Enum.Parse(typeof(TestType), testSetting.TestName);

            switch (testType)
            {
            case TestType.None:
                break;

            case TestType.RebootSystemTest:
                zTester = new RebootSystemTest();
                break;

            case TestType.SleepTest:
                zTester = new SleepTest();
                break;

            case TestType.DebuggerSetting:
                zTester = new DebuggerSettingTest();
                break;

            case TestType.WSHTest:
                zTester = new WSHTester();
                break;

            case TestType.KernelStressTest:
                zTester = new KernelStressTest();
                break;

            default:
                break;
            }

            if (testSetting.IsSettedEnvironment)
            {
                zTester.StartTest();
            }
            else
            {
                zTester.SetTheEnvironment();
            }
        }
Beispiel #7
0
        static void CreateZTestSettingList(List <int> testList)
        {
            int priority = 0;

            List <ZTestSettingModel> zTestSettingModels = new List <ZTestSettingModel>();

            foreach (var item in testList)
            {
                ZTestSettingModel zTestSettingModel = new ZTestSettingModel()
                {
                    TestName            = ((TestType)item).ToString(),
                    Priority            = ++priority,
                    IsSettedEnvironment = false
                };
                zTestSettingModels.Add(zTestSettingModel);
            }
            _xmlService.SafeTestSettings(zTestSettingModels);
        }
Beispiel #8
0
        public void StartTest()
        {
            Console.WriteLine("KernelStress running...");
            Thread.Sleep(1500);
            _fileService.RemoveShortcutFromStartup();

            ZTestSettingModel testSettingModel = new ZTestSettingModel();

            testSettingModel = _xmlService.GetZTestSetting(TestType.KernelStressTest);
            string KSKfilePath = testSettingModel.TestFileFullPath;

            NetworkSettingsModel networkSetting = _xmlService.GetNetworkSettings(TestType.KernelStressTest);

            bool result = _remoteConnectionService.MapDrive("M", KSKfilePath, networkSetting.Domain + @"\" + networkSetting.UserName, networkSetting.Password);

            if (result)
            {
                Console.WriteLine("cmd.exe", @"/c M:\ksk.cmd");
                Process.Start("cmd.exe", @"/c M:\ksk.cmd");
            }
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
        public void SetTheEnvironment()
        {
            int rebootCount = CheckHowManyTimesReboot();

            ZTestSettingModel testSetting = new ZTestSettingModel()
            {
                TestName            = TestType.RebootSystemTest.ToString(),
                NeedToRunTimes      = rebootCount,
                IsSettedEnvironment = true
            };

            _xmlService.EditZTestSetting(testSetting);

            if (rebootCount > 0 && rebootCount <= 10)
            {
                CreateLogFile(rebootCount);
                if (!IsShortcutOfRebootLoopExists)
                {
                    _fileService.CreateShortcut(_fileService.AppPath, Constants.RebootLoopShortcutName, IsShortcutOfRebootLoopExists);
                    _fileService.MoveFileToFolder(_fileService.AppPath + "\\" + Constants.RebootLoopShortcutName + ".lnk", StartupDirectoryFullPath + "\\" + Constants.RebootLoopShortcutName + ".lnk");
                }
                Reboot();
            }
        }
Beispiel #11
0
        public void StartTest()
        {
            Console.WriteLine("SlelepTest running...");
            Thread.Sleep(1500);

            if (_fileService.IsShortcutOfRebootLoopExists)
            {
                _fileService.RemoveShortcutFromStartup();
            }

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=_U24PBWOpjM", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=jj_Mei27E7Q", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("https://www.youtube.com/watch?v=5TcOvHigjYE", fileName: "iexplore.exe", waitForExit: false);
            Thread.Sleep(30000);


            ZTestSettingModel testSettingModel = new ZTestSettingModel();

            testSettingModel = _xmlService.GetZTestSetting(TestType.SleepTest);
            string TestfilePath = testSettingModel.TestFileFullPath;

            NetworkSettingsModel networkSetting = _xmlService.GetNetworkSettings(TestType.KernelStressTest);

            if (TestfilePath == null || TestfilePath == "")
            {
                Console.WriteLine("The TestFileFullPath property does not setted, please open ZTester.config file and set TestFileLocation for SleepTest section");
                return;
            }

            bool result = _remoteConnectionService.MapDrive("M", networkSetting.TestFileLocation, networkSetting.Domain + @"\" + networkSetting.UserName, networkSetting.Password);



            string systemDrive          = _fileService.GetPathRoot(Environment.SystemDirectory);
            string testBinPath          = systemDrive + "TestBin";
            bool   isTestBinExist       = _fileService.CheckIfDirectoryExists(testBinPath);
            bool   isSleepTestFileExist = false;

            if (!isTestBinExist)
            {
                _fileService.CreateDirectory(Constants.TestBinPath);
                Process.Start("cmd.exe", @"/c xcopy M:\pwrtest.exe c:\TestBin\* /s /y");
            }
            else
            {
                isSleepTestFileExist = _fileService.CheckIfFileExists(testBinPath);
                if (!isSleepTestFileExist)
                {
                    Process.Start("cmd.exe", @"/c xcopy M:\pwrtest.exe c:\TestBin\* /s /y");
                }
            }



            Thread.Sleep(30000);

            _cmdService.RunCMDCommand("/sleep /c:4 /p:120 /d:150 /s:all", "pwrtest.exe", testBinPath);

            FinishTest();
        }