当前位置: 首页 > news >正文

LIN-TestWait函数解析

目录

1.testWaitForAnyJoinedEvent

2.testWaitForTimeout

3.testWaitForTesterConfirmation


1.testWaitForAnyJoinedEvent


void Util_Setup_WaitForResponse(byte frameId)
{// The order of the join events below is important! It has to be consistent with the implementation of Util_WaitForValidResponse()!testJoinMessageEvent(frameId);testJoinLinReceiveErrorEvent(frameId);testJoinLinCSErrorEvent(frameId);testJoinLinTransmErrorEvent(frameId);}int SendHeaderAndEvaluateSlaveResponse(byte txFrameID, int64& currentInitializationTimeNs, int64 maxLengthOfResponseInNs, int64 timeOfPowerUpNs, int64 maxInitializationTimeNs)
{long resultOfWaitForResponse;linFrame 0x00 receivedFrame;linFrame 0x37 Frame;testWaitForTimeout(3);Util_Setup_WaitForResponse(txFrameID);Util_SendHeader(txFrameID);writeEx(-3,1,"%g",timeNowNS()/1000000);//resultOfWaitForResponse = testWaitForAnyJoinedEvent(maxLengthOfResponseInNs/1000000);writeEx(-3,1,"%d.",maxLengthOfResponseInNs/1000000);resultOfWaitForResponse = testWaitForAnyJoinedEvent(20);currentInitializationTimeNs = timeNowInt64() - timeOfPowerUpNs;if(resultOfWaitForResponse < 0){testStepFail("Unexpected error: could not evaluate IUT response.");return 0;}else if(resultOfWaitForResponse == 1){if(testGetWaitEventMsgData(receivedFrame) == 0){//IUT has answered correctlycurrentInitializationTimeNs = receivedFrame.EOH - timeOfPowerUpNs;testStep(Util_TestcasePhase, "IUT has responsed to the tx frame header after %5.2f ms", (currentInitializationTimeNs / 1000000.0));Util_GetWaitEventMsgData(receivedFrame.ID);if(currentInitializationTimeNs <= maxInitializationTimeNs){testStepPass(Util_TestcasePhase, "IUT has responded within the time limit (%d ms)", (maxInitializationTimeNs / 1000000));Util_ReportAddTraceData();    }else{
//        testStepFail(Util_TestcasePhase, "IUT has not responded within the time limit (%d ms)", (maxInitializationTimeNs / 1000000));// Util_OnTestStepFail();}return 0;}else{testStepFail(Util_TestcasePhase, "Unexpected error: could not access received frame data!");//Util_OnTestStepFail();return 1;}}else if(resultOfWaitForResponse == 4 || resultOfWaitForResponse == 0){writeEx(-3,1,"%d  resultOfWaitForResponse",resultOfWaitForResponse);testStep(Util_TestcasePhase, "IUT has not yet responsed to tx frame header. Time passed since power up: %d ms" ,(currentInitializationTimeNs / 1000000));if(currentInitializationTimeNs > maxInitializationTimeNs){testStepFail(Util_TestcasePhase, "IUT has not responded to the tx frame header after the maximum initialization time has passed (%d ms).", (maxInitializationTimeNs / 1000000));//Util_OnTestStepFail();return 2;}else{return 3;//do nothing and try again in the next iteration of the loop}}else{testStepFail(Util_TestcasePhase, "IUT has responded with an invalid response");Util_OnTestStepFail();return 2;}
}

函数以代码运行处开始计时,最小超时时间为一帧总时间

与testjoinxx函数配合使用

2.testWaitForTimeout

 timeOfPowerUpNs = timeNowNs();testWaitForTimeout(50);testStep(Util_TestcasePhase, "IUT has been powered up again. Send tx frame headers and wait for IUT response.");

空闲时间等待,用于发送间隙或者测试延时

3.testWaitForTesterConfirmation

enum _Bool Util_WakeupSignal_TriggerIUT(char testcaseNr[])
{testStep(Util_TestcasePhase, "Ask the tester to cause IUT to send wakeup signal in %d seconds", Util_IUTWakeupTimeout);snprintf(Util_UserMessage, elcount(Util_UserMessage),"Test %s;\nPlease stimulate IUT to send wakeup signal;\nPress 'Yes' when IUT is ready to transmit wakeup signal in %d seconds;\nPress 'No' to skip this test."  , testcaseNr, Util_IUTWakeupTimeout);if (!Util_IsAutoAnswer()){if (testWaitForTesterConfirmation(Util_UserMessage) == 2) {testStepFail(Util_TestcasePhase, "Test case skipped during execution by user!");return _False;}}else{setTimer(triggerWakeupTimer, 1000);}testStepPass(Util_TestcasePhase, "Tester confirmed that IUT will issue wakeup signal in %d seconds", Util_IUTWakeupTimeout);return _True;
}{
..if (_False == Util_WakeupSignal_TriggerIUT(testcaseNr)) {Util_Get3446_MeasurementOff();return; }// ######## Verification ################Util_SetTestcasePhase(_phaseVerification);testStep(Util_TestcasePhase, "IUT shall send the wakeup signal according to [WAKE UP 2.6.2] (250us < t < 5ms)");testStep(Util_TestcasePhase, "IUT shall transmit a new wakeup signal within 150 ms to 250 ms");testStep(Util_TestcasePhase, "IUT shall transmit a new block of wakeup signals not before 1,5s after the last wakeup signal");// wait for 3 retransmissions for (nRetryIndex=1; nRetryIndex <= 3; ++nRetryIndex){switch ( Util_WakeupSignal_WaitAndValidate(nRetryIndex) ){case _wakeupOK:// wakeup length was OK// check delay between retransmissions (tolerance of 100us!)if (nRetryIndex > 1 && (Util_MeasuredWakeupDelay < 149900000 || Util_MeasuredWakeupDelay > 250100000)) {testStepFail(Util_TestcasePhase, "Retransm. #%d: IUT has retransmitted wakeup signal with an invalid delay. T[retransm. delay]=%I64d ns", nRetryIndex, Util_MeasuredWakeupDelay);Util_OnTestStepFail();Util_Get3446_MeasurementOff();return;}testStepPass(Util_TestcasePhase, "Retransm. #%d: IUT has sent wakeup signal correctly. T[wakeup]=%I64d ns. Delay between retransm.: %I64d ns",  nRetryIndex, Util_MeasuredWakeupLength, (nRetryIndex == 1 ? 0 : Util_MeasuredWakeupDelay));break;case _wakeupLenFail:testStepFail(Util_TestcasePhase, "Retransm. #%d: IUT has sent wakeup signal with an invalid length. T[wakeup]=%I64d ns",  nRetryIndex, Util_MeasuredWakeupLength);Util_OnTestStepFail();Util_Get3446_MeasurementOff();return;case _wakeupNotExternal:testStepFail(Util_TestcasePhase, "Retransm. #%d: wakeup signal has been received, but not from the IUT", nRetryIndex);Util_OnTestStepFail();Util_Get3446_MeasurementOff();return;default:testStepFail(Util_TestcasePhase, "Retransm. #%d: No wakeup signal has been received", nRetryIndex);Util_OnTestStepFail();Util_Get3446_MeasurementOff();return;}}
...
}

留给测试者准备时间,在此时间内触发均可执行下述操作,适用于自测

http://www.xdnf.cn/news/1313479.html

相关文章:

  • 【Html网页模板】赛博朋克数据分析大屏网页
  • 【开发技巧】VS2022+QT5+OpenCV4.10开发环境搭建QT Creator
  • 如何解决pip安装报错ModuleNotFoundError: No module named ‘opencv-python’问题
  • 从希格斯玻色子到 QPU:C++ 的跨维度征服
  • 电路方案分析(二十二)适用于音频应用的25-50W反激电源方案
  • 从频繁告警到平稳发布:服务冷启动 CPU 风暴优化实践01
  • Centos7.9安装Dante
  • 深度解析Java synchronized关键字及其底层实现原理
  • python---包
  • 《WINDOWS 环境下32位汇编语言程序设计》第2章 准备编程环境
  • 深入剖析 TOTP 算法:基于时间的一次性密码生成机制
  • IOMMU多级页表查找的验证
  • 【计算机网络架构】混合型架构简介
  • 39.离散化与哈希
  • 模型训练监控:TensorBoard与Weights Biases (WB) 使用详解
  • 《A Practical Guide to Building Agents》文档学习
  • 写一个linux脚本,要求实现查找9010端口,如果端口存在则kill,否则不处理,返回对应的提示
  • 24. async await 原理是什么,会编译成什么
  • Linux系统top命令详细指南
  • 安卓11 12系统修改定制化_____如何去除安卓11 12的系统签名验证
  • 基于Transformer的机器翻译——模型篇
  • 《后室Backrooms》中文版,购物误入异空间,怪物追逐,第一人称冒险逃生
  • 安卓11 12系统修改定制化_____修改系统 解锁system分区 去除data加密 自由删减系统应用
  • 服务器配置开机自启动服务
  • 线程池与异步编程——语法归纳
  • 存算分离与云原生:数据平台的新基石
  • 机器学习的特征工程(特征构造、特征选择、特征转换和特征提取)详解
  • 探秘gRPC——gRPC原理详解
  • 胶质母细胞瘤对化疗的敏感性由磷脂酰肌醇3-激酶β选择性调控
  • 【CV 目标检测】Fast RCNN模型①——与R-CNN区别