我正在为Azure DevOps上的Matlab/Simulink项目制作CI管道。构建管道是稳定的,并再现与本地计算机执行相同的输出。然而,测试管道出现了问题。欢迎任何解决方案!
操作:
我的项目使用Modelon FMI工具箱来运行工厂模型。我的本地计算机运行所有的matlab单元测试,它运行一个Simulink文件,包括我的Modelon FMU,没有任何问题,并生成一个jUnitTest报告xml。我使用azure-pipeline.yml文件调用了相同的文件来运行。
预期:
我期望得到与本地运行相同的结果,作业运行CLI上显示的通过/失败结果相同。
结果:
在Azure Pipeline执行时,那些FMU工厂导致我的所有测试失败。这是29次相同的错误
https://www.modelon.com/products-services/modelon-deployment-suite/fmi-toolbox/
Error occurred in TestSim/testSim(File=****************_slx) and it did not run to completion.
---------
Error ID:
---------
'Simulink:modelReference:NormalModeSimulationError'
--------------
Error Details:
--------------
Error using testRunner (line 18)
An error occurred during simulation of Model block '*******************/PLANT_*****'.
Error in TestSim/testSim (line 31)
simOutRes = testRunner(File,duration);
Caused by:
Error using testRunner (line 18)
An error occurred during simulation of Model block 'PLANT_*****/*****/************'.
Error using testRunner (line 18)
Error reported by S-function 'sfun_fmu_cs_********' in 'PLANT_******************/******************************':
Error: FMI Toolbox running in DEMO mode: Only examples included in the FMI Toolbox distribution can be run.
Please contact sales@modelon.com in order to obtain an evaluation license or to purchase FMI Toolbox for MATLAB.
================================================================================
信息:
这就是我尝试过的。
- 我已验证我拥有适当的许可证:
Version of the Licensing toolkit client library
v11.10.0.0 build 95001 x64_n6
---------------------
Performing test for feature: FMI_TOOLBOX
Feature: 'FMI_TOOLBOX'
Feature version: '2021.0625'
Feature is checked out
License type:
Server license IP: ******.******.***.***
2/2 licenses in use
Expiration date:
25-jun-2021
Number of days until expiration:
246
Start date:
10-jun-2020
License number:
****-****-****-****-****-****-****-****
Daemon name:
modelon
Notice:
Customer ************* Product FMI ToolBox for Matlab
Issuer:
Modelon AB
我将运行的Azure管道代理服务的用户帐户更改为自己的帐户,一切正常。它构建&像在本地一样测试我的所有FMU块,然后在Azure Pipelines上发布报告。我看到这个错误只发生在Azure默认网络服务帐户上。出于安全和其他原因,我也希望它能在网络服务方面工作。
我在网上做了一些快速讲座。
解决方案:
我发现网络服务帐户和我的用户帐户使用不同的%APPDATA%文件夹。
C:Users*******AppDataRoamingModelonLicensesServer
和
C:WindowsServiceProfilesNetworkServiceAppDataRoamingModelonLicensesServer
在网络服务文件夹中,我什么都没有,但在我的文件夹中,有一个fmi_license.lic文件,内容是:
SERVER **************.com ANY *****
USE_SERVER
将该文件添加到我的网络服务%APPDATA%,并将这些行添加到Azure Pipeline YMAL文件后,许可证被检查为有效的网络许可证,并且我的项目在网络服务帐户上运行时停止在DEMO模式下工作。
#Making FMI Toolbox licence check
- script: |
echo fmitoolbox_license; > fmitoolboxLicenseCheck.m
displayName: 'Making FMI Toolbox licence check'
#FMI Toolbox licence check Action
- task: RunMATLABCommand@0
inputs:
command: fmitoolboxLicenseCheck
displayName: 'FMI Toolbox Licence Check Action'
更多阅读:
是否查找用户网络服务的临时文件夹?
https://superuser.com/questions/197576/network-service-account-password