public MTKTestError RunTest(int TestIndex)
        {
            Log.PrintLog(this, "Running test program " + (TestIndex + 1).ToString() + "/" +
                         TestProgram.Count.ToString(), LogDetailLevel.LogRelevant);

            TestProgram[TestIndex].UpdateDUTPort(DUTSerialPort);
            TestProgram[TestIndex].DUTConnectionMode = MTKTest.GetConnectionModeFromText(DUTConnectionType);

            string       TestType = TestProgram[TestIndex].ToString();
            MTKTestError ReturnError;

            if (CheckPorts(TestType, out ReturnError) == false)
            {
                return(ReturnError);
            }

            if (TestType == "MTKTestProgramAll")
            {
                ((MTKTestProgramAll)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestProgramAll)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTProgrammers = DUTProgrammers;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTSerialPorts = DUTSerialPorts;
            }

            if (TestType == "MTKTestAnritsu")
            {
                ((MTKTestAnritsu)TestProgram[TestIndex]).AnritsuPort = AnritsuSerialPort;
            }

            MTKTestError RetVal;

            OnNextTest(TestIndex);
            if (TestType == "MTKPSoCProgrammer")
            {
                if (((MTKPSoCProgrammer)TestProgram[TestIndex]).GlobalProgrammerSelected)
                {
                    RetVal = DUTProgrammers[_CurrentDUT].RunTest();
                }
                else
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
            }
            else
            {
                RetVal = TestProgram[TestIndex].RunTest();
            }
            OnTestComplete();
            return(RetVal);
        }
        public MTKTestError RunTest(int TestIndex)
        {
            Stopwatch runtest_stopwatch = new Stopwatch();

            Log.PrintLog(this, "Running test program " + (TestIndex + 1).ToString() + "/" +
                         TestProgram.Count.ToString(), LogDetailLevel.LogRelevant);

            try
            {
                runtest_stopwatch.Restart();
            }
            catch (Exception)
            {
                throw;
            }

            TestProgram[TestIndex].UpdateDUTPort(DUTSerialPort);
            TestProgram[TestIndex].UpdateMTKHostPort(MTKSerialPort);
            TestProgram[TestIndex].DUTConnectionMode = MTKTest.GetConnectionModeFromText(DUTConnectionType);

            string TestType = TestProgram[TestIndex].ToString();

            CurrentMTKTestType = MTKTestType.MTKTest;

            MTKTestError ReturnError;

            if (CheckPorts(TestType, out ReturnError) == false)
            {
                return(ReturnError);
            }

            if (TestType == "MTKTestProgramAll")
            {
                ((MTKTestProgramAll)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestProgramAll)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTProgrammers = DUTProgrammers;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTSerialPorts = DUTSerialPorts;

                CurrentMTKTestType = MTKTestType.MTKTestProgramAll;
            }

            TestProgram[TestIndex].CurrentDUT = _CurrentDUT;
            if (TestType == "MTKTestDUTCurrentMeasure")
            {
                ((MTKTestDUTCurrentMeasure)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestDUTCurrentMeasure)TestProgram[TestIndex]).DUTSerialPorts = DUTSerialPorts;
                ((MTKTestDUTCurrentMeasure)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT + 1;

                CurrentMTKTestType = MTKTestType.MTKTestDUTCurrentMeasure;
            }

            if (TestType == "MTKTestAnritsu")
            {
                ((MTKTestAnritsu)TestProgram[TestIndex]).AnritsuPort = AnritsuSerialPort;

                CurrentMTKTestType = MTKTestType.MTKTestAnritsu;
            }

            MTKTestError RetVal;



            OnNextTest(TestIndex);
            if (TestType == "MTKPSoCProgrammer")
            {
                CurrentMTKTestType = MTKTestType.MTKPSoCProgrammer;

                if (((MTKPSoCProgrammer)TestProgram[TestIndex]).GlobalProgrammerSelected)
                {
                    RetVal = DUTProgrammers[_CurrentDUT].RunTest();
                }
                else
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
            }
            else
            {
                if (DUTSerialPorts[_CurrentDUT].IsOpen && CyBLE_MTK.DUTSerialPortsConfigured[CurrentDUT] == true)
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
                else
                {
                    if (CurrentMTKTestType == MTKTestType.MTKTestProgramAll)
                    {
                        RetVal = TestProgram[TestIndex].RunTest();
                    }
                    else
                    {
                        RetVal = MTKTestError.IgnoringDUT;
                    }
                }
            }

            runtest_stopwatch.Stop();

            if (TestProgram[TestIndex].CurrentMTKTestType == MTKTestType.MTKTestSTC && RetVal != MTKTestError.IgnoringDUT)
            {
                CyBLE_MTK.STCTestCycleTime[CurrentDUT] = runtest_stopwatch.Elapsed.TotalSeconds + " secs";
            }
            else if (TestProgram[TestIndex].CurrentMTKTestType == MTKTestType.MTKTestCUSReadGPIO && RetVal != MTKTestError.IgnoringDUT)
            {
                CyBLE_MTK.Result_CUSTOM_CMD_READ_GPIO_1[CurrentDUT] = runtest_stopwatch.Elapsed.TotalSeconds + " secs";
            }
            else if (TestProgram[TestIndex].CurrentMTKTestType == MTKTestType.MTKTestCUSReadOpenGPIO && RetVal != MTKTestError.IgnoringDUT)
            {
                CyBLE_MTK.Result_CUSTOM_CMD_READ_OPEN_GPIO_2[CurrentDUT] = runtest_stopwatch.Elapsed.TotalSeconds + " secs";
            }
            else if (TestProgram[TestIndex].CurrentMTKTestType == MTKTestType.MTKTestCUSReadFWVersion && RetVal != MTKTestError.IgnoringDUT)
            {
                CyBLE_MTK.Result_CUSTOM_CMD_READ_FW_VERSION_11[CurrentDUT] = runtest_stopwatch.Elapsed.TotalSeconds + " secs";
            }

            OnTestComplete();
            return(RetVal);
        }
Beispiel #3
0
        public MTKTestError RunTest(int TestIndex)
        {
            Log.PrintLog(this, "Running test program " + (TestIndex + 1).ToString() + "/" +
                         TestProgram.Count.ToString(), LogDetailLevel.LogRelevant);

            TestProgram[TestIndex].UpdateDUTPort(DUTSerialPort);
            TestProgram[TestIndex].DUTConnectionMode = MTKTest.GetConnectionModeFromText(DUTConnectionType);

            string TestType = TestProgram[TestIndex].ToString();

            if ((TestType == "MTKTestTXP") || (TestType == "MTKTestTXPER") || (TestType == "MTKTestRXP") ||
                (TestType == "MTKTestRXPER") || (TestType == "MTKTestTXCW") || (TestType == "MTKTestAnritsu") ||
                (TestType == "MTKTestCUS") || (TestType == "MTKTestSTC"))
            {
                if (CheckPorts(TestType))
                {
                    if (MTKSerialPort.IsOpen == false)
                    {
                        return(MTKTestError.MissingMTKSerialPort);
                    }

                    if ((DUTSerialPort.IsOpen == false) && (DUTConnectionType == "UART"))
                    {
                        if (_IgnoreDUT)
                        {
                            return(MTKTestError.IgnoringDUT);
                        }
                        else
                        {
                            return(MTKTestError.MissingDUTSerialPort);
                        }
                    }

                    if ((AnritsuSerialPort.IsOpen == false) && (TestType == "MTKTestAnritsu"))
                    {
                        return(MTKTestError.MissingAnritsuSerialPort);
                    }
                }
            }

            if (TestType == "MTKTestProgramAll")
            {
                ((MTKTestProgramAll)TestProgram[TestIndex]).NumberOfDUTs   = NumberOfDUTs;
                ((MTKTestProgramAll)TestProgram[TestIndex]).CurrentDUT     = _CurrentDUT;
                ((MTKTestProgramAll)TestProgram[TestIndex]).DUTProgrammers = DUTProgrammers;
            }

            if (TestType == "MTKTestAnritsu")
            {
                ((MTKTestAnritsu)TestProgram[TestIndex]).AnritsuPort = AnritsuSerialPort;
            }

            MTKTestError RetVal;

            OnNextTest(TestIndex);
            if (TestType == "MTKPSoCProgrammer")
            {
                if (((MTKPSoCProgrammer)TestProgram[TestIndex]).GlobalProgrammerSelected)
                {
                    RetVal = DUTProgrammers[_CurrentDUT].RunTest();
                }
                else
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
            }
            else
            {
                RetVal = TestProgram[TestIndex].RunTest();
            }
            OnTestComplete();
            return(RetVal);
        }