public void RunTest(ref ATFReturnResult results)
        {
            string strError = string.Empty;
            // ReSharper disable once JoinDeclarationAndInitializer
            long testTime;

            TestCount = 0; //reset to start
            _speedo.Reset();
            _speedo.Start();

            foreach (SparamTestCase.TestCaseAbstract tc in objFBar.TestCases)
            {
                tc.RunTest();
                tc.BuildResults();
            }

            #region Create FmTrace file
            if (SnpFile.FileOutputEnable & TmpUnitNo <= SnpFile.FileOutputCount)
            {
                for (int i = 0; i < objFBar.SparamRaw.Length; i++)
                {
                    if (SnpFile.ADSFormat)
                    {
                        LibEqmtDriver.NA.SParam tsSparam = _eqNa.ConvertTourchStone(_traceSetting[i], objFBar.SparamRaw[i]);
                        _eqNa.ExportSnpFile(tsSparam, SnpFile.FileSourcePath, SnpFile.FileOutputFileName, TmpUnitNo.ToString(), i + 1);
                    }
                    else
                    {
                        _eqNa.ExportSnpFile(objFBar.SparamRaw[i], SnpFile.FileSourcePath, SnpFile.FileOutputFileName, TmpUnitNo.ToString(), i + 1);
                    }
                }
            }
            #endregion

            #region Add Result to Clotho
            for (int i = 0; i < objFBar.Result.Length; i++)
            {
                if (objFBar.Result[i].Enable)
                {
                    for (int iRst = 0; iRst < objFBar.Result[i].Header.Length; iRst++)
                    {
                        ATFResultBuilder.AddResult(ref results, objFBar.Result[i].Header[iRst], "", objFBar.Result[i].Result[iRst]);
                    }
                }
            }
            #endregion

            _speedo.Stop();
            testTime = _speedo.ElapsedMilliseconds;

            ATFResultBuilder.AddResult(ref results, "SparamTestTime", "mS", testTime);
        }
Beispiel #2
0
        /// <summary>
        /// Rule Relevant
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonStartTestPlan_Click(object sender, EventArgs e)
        {
            int loopcnt = (int)numericUpDownLoopCnt.Value;

            ATFReturnResult testplanRet = null;
            string          ruleRet     = "";

            listBoxRunResult.Items.Add("****************************************");
            listBoxRunResult.Items.Add("");
            listBoxRunResult.SelectedIndex = listBoxRunResult.Items.Count - 1;


            this.Cursor = Cursors.WaitCursor;
            try
            {
                for (int idx = 0; idx < loopcnt; idx++)
                {
                    listBoxRunResult.Items.Add(string.Format("{0}:     #{1}/{2} Run ({3})", DateTime.Now.ToString(), idx + 1, loopcnt, textBoxTestArgString.Text.Trim()));

                    if (checkBoxAdaptiveSamplingOnOff.Checked)
                    {
                        Dictionary <string, bool> tempMask = ATFSharedData.Instance.ASRuleBitMask;
                        StringBuilder             sbTemp   = new StringBuilder("BitMask: ");
                        foreach (string key in tempMask.Keys)
                        {
                            sbTemp.AppendFormat("{0}: {1}; ", key, tempMask[key] ? "1" : "0");
                        }
                        listBoxRunResult.Items.Add(sbTemp.ToString());
                    }

                    listBoxRunResult.SelectedIndex = listBoxRunResult.Items.Count - 1;


                    testplanRet = _theRunner.Test(textBoxTestArgString.Text.Trim(), checkBoxAdaptiveSamplingOnOff.Checked, ref ruleRet, _m_1StTimeRunTestPlan);
                    listBoxRunResult.Items.Add(string.Format("{0}:     TestPlan Return: {1}", DateTime.Now.ToString(),
                                                             StringProcessHelper.ConvertFullResultToStringWithLengthLimit(testplanRet, 500)));


                    if (checkBoxAdaptiveSamplingOnOff.Checked)
                    {
                        listBoxRunResult.Items.Add(string.Format("{0}:     Rule Return: {1}", DateTime.Now.ToString(), ruleRet));

                        Dictionary <string, bool> tempMask = ATFSharedData.Instance.ASRuleBitMask;
                        StringBuilder             sbTemp   = new StringBuilder("BitMask: ");
                        foreach (string key in tempMask.Keys)
                        {
                            sbTemp.AppendFormat("{0}: {1}; ", key, tempMask[key] ? "1" : "0");
                        }
                        listBoxRunResult.Items.Add(sbTemp.ToString());
                    }
                    listBoxRunResult.SelectedIndex = listBoxRunResult.Items.Count - 1;

                    // After 1st time run complete
                    if (_m_1StTimeRunTestPlan)
                    {
                        _m_1StTimeRunTestPlan = false;
                    }

                    Thread.Sleep((int)numericUpDownLoopDelay.Value);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Test Plan Execution Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
    public ATFReturnResult DoATFTest(string args)
    {
        //Debugger.Break();

        string          err    = "";
        StringBuilder   sb     = new StringBuilder();
        ATFReturnResult result = new ATFReturnResult();

        // ----------- Example for Argument Parsing --------------- //
        Dictionary <string, string> dict = new Dictionary <string, string>();

        if (!ArgParser.parseArgString(args, ref dict))
        {
            err = "Invalid Argument String" + args;
            MessageBox.Show(err, "Exit Test Plan Run", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(new ATFReturnResult(err));
        }


        int simHw;

        try
        {
            simHw = ArgParser.getIntItem(ArgParser.TagSimMode, dict);
        }
        catch (Exception ex)
        {
            err = ex.Message;
            MessageBox.Show(err, "Exit Test Plan Run", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(new ATFReturnResult(err));
        }
        // ----------- END of Argument Parsing Example --------------- //


        #region Custom Test Coding Section
        //////////////////////////////////////////////////////////////////////////////////
        // ----------- ONLY provide your Custom Test Coding here --------------- //
        // Example for build TestPlan Result (Single Site)

        if (_firstTest == true)
        {
            string[] resultFileName = ATFCrossDomainWrapper.GetClothoCurrentResultFileFullPath().Split('_');

            if (_guiEnable == true)
            {
                if (resultFileName[0] != _initProTag)
                {
                    _programLoadSuccess = false;
                    MessageBox.Show("Product Tag accidentally changed to: " + resultFileName[0] + "\nPlease re-load program!");
                    err = "Product Tag accidentally changed to: " + resultFileName[0];
                    return(new ATFReturnResult(err));;
                }
            }
        }

        if (!_programLoadSuccess)
        {
            MessageBox.Show("Program was not loaded successfully.\nPlease resolve errors and reload program.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            err = "Program was not loaded successfully.\nPlease resolve errors and reload program";
            return(new ATFReturnResult(err));
        }

        GU.DoTest_beforeCustomCode();

        #region Retrieve lot ID# (for Datalog)
        //Retrieve lot ID#
        _tPVersion      = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TP_VER, "");
        _productTag     = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_PACKAGE_TAG, "").ToUpper();
        _lotId          = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_LOT_ID, "").ToUpper();
        _sublotId       = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_SUB_LOT_ID, "").ToUpper();
        _waferId        = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_WAFER_ID, "");
        _opId           = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_OP_ID, "");
        _handlerSn      = ATFCrossDomainWrapper.GetStringFromCache(PublishTags.PUBTAG_HANDLER_SN, "");
        _testerHostName = System.Net.Dns.GetHostName();
        _ipEntry        = System.Net.Dns.GetHostEntry(_testerHostName);
        _testerIp       = NetworkHelper.GetStaticIPAddress().Replace(".", ""); //Use Clotho method , original code has issue with IPv6 - 12/03/2015 Shaz

        if (_myDut.TmpUnitNo == 0)                                             //do this for the 1st unit only
        {
            _dt = DateTime.Now;

            if (_productTag != "")
            {
                _newPath = System.IO.Path.Combine(_activeDir, _productTag + "_" + _lotId + "_" + _sublotId + "_" + _testerIp + "\\");
            }
            else
            {
                string tempname = "DebugMode_" + _dt.ToString("yyyyMMdd" + "_" + "HHmmss");
                _newPath    = System.IO.Path.Combine(_activeDir, tempname + "\\");
                _productTag = "Debug";
                _lotId      = "1";
            }

            //Parse information to LibFbar
            _myDut.SnpFile.FileSourcePath     = _newPath;
            _myDut.SnpFile.FileOutputFileName = _productTag;
            _myDut.SnpFile.LotID = _lotId;
            // Added variable to solve issue with datalog when Inari operator using
            //Tally Generator to close lot instead of unload test plan
            //WaferId,OpId and HandlerSN are null when 2nd Lot started - make assumption that this 3 param are similar 1st Lot
            _tempWaferId         = _waferId;
            _tempOpId            = _opId;
            _tempHandlerSn       = _handlerSn;
            _previousLotSubLotId = _currentLotSubLotId;
        }

        DateTime      DT           = DateTime.Now;
        List <string> FileContains = new List <string>();
        FileContains.Add("DATE_START=" + DT.ToString("yyyyMMdd"));
        FileContains.Add("TIME_START=" + DT.ToString("HHmmss"));
        FileContains.Add("ENTITY=NA");
        FileContains.Add("SOURCE=FBAR");
        FileContains.Add("GROUP=DUPLEXER");
        FileContains.Add("PRODUCT_TAG=" + _productTag);
        FileContains.Add("LOT_NUMBER=" + _lotId + "_" + _sublotId);
        FileContains.Add("WAFER_ID=" + _waferId);
        FileContains.Add("OPERATOR_NAME=" + _opId);
        FileContains.Add("TESTER_NAME=FBAR");
        FileContains.Add("TESTER_HOST_NAME=" + _testerHostName);
        FileContains.Add("HANLDER_NAME=" + _handlerSn);
        FileContains.Add("TEST_PLAN_VERSION=" + _tPVersion);

        _myDut.FileFileContain = FileContains;
        #endregion

#if (!DEBUG)
        _myDut.TmpUnitNo = Convert.ToInt32(ATFCrossDomainWrapper.GetClothoCurrentSN());
#else
        _myDut.TmpUnitNo++;      // Need to enable this during debug mode
#endif

        for (GU.runLoop = 1; GU.runLoop <= GU.numRunLoops; GU.runLoop++)
        {
            ATFResultBuilder.Reset();
            _firstTest = false;
            _myDut.RunTest(ref result);

            GU.DoTest_afterCustomCode(ref result);
        }

        // ----------- END of Custom Test Coding --------------- //
        //////////////////////////////////////////////////////////////////////////////////
        #endregion Custom Test Coding Section

        //ATFReturnResult result = new ATFReturnResult();
        //ATFResultBuilder.AddResult(ref result, "PARAM", "X", 0.01);
        return(result);
    }
 public void BuildResults(ref ATFReturnResult results, string paraName, string unit, double value)
 {
     ATFResultBuilder.AddResult(ref results, paraName, unit, value);
 }