Esempio n. 1
0
        protected virtual void InitializeTestResult()
        {
            CurrentMTKTestType = MTKTestType.MTKTest;

            TestResult            = new MTKTestResult();
            TestResult.TestName   = this.ToString();
            TestResult.Parameters = new string[TestParameterCount];
            TestResult.Value      = new string[TestParameterCount];
            for (int i = 0; i < TestParameterCount; i++)
            {
                TestResult.Parameters[i] = GetTestParameterName(i);
                TestResult.Value[i]      = GetTestParameter(i);
            }

            MTKTestTmplSFCSErrCode = ECCS.ERRORCODE_DUT_NOT_TEST;
        }
        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);
        }
        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();

            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)
                {
                    RetVal = TestProgram[TestIndex].RunTest();
                }
                else
                {
                    RetVal = MTKTestError.IgnoringDUT;
                }
            }



            OnTestComplete();
            return(RetVal);
        }