From bd82aed385d65fc73c9235cd74a3ada2c0a02be6 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sat, 4 Nov 2023 18:39:59 +0100 Subject: [PATCH 1/8] Skip class teardown if bossdevice object is empty. --- tests/commonSetupTests.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/commonSetupTests.m b/tests/commonSetupTests.m index cdfa975..cd8c075 100644 --- a/tests/commonSetupTests.m +++ b/tests/commonSetupTests.m @@ -33,9 +33,11 @@ function resetSgPath(testCase) end function rebootTarget(testCase) - disp('Rebooting bossdevice to teardown test class.'); - testCase.bd.targetObject.reboot; - pause(30); + if ~isempty(testCase.bd) + disp('Rebooting bossdevice to teardown test class.'); + testCase.bd.targetObject.reboot; + pause(30); + end end end From 8a1bd75b5f866e4186db9757d6373b806b2b8840 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sat, 4 Nov 2023 18:51:25 +0100 Subject: [PATCH 2/8] Run testTask on MATLAB R2022b too. --- .github/workflows/main.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76bd58f..4e137c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,8 +60,10 @@ jobs: strategy: fail-fast: false # Run with every MATLAB version independently matrix: - matlabVer: [R2023a, R2023b] # List of MATLAB releases to test + matlabVer: [R2022b, R2023a, R2023b] # List of MATLAB releases to test + runs-on: matlab + # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Setup Python @@ -76,12 +78,12 @@ jobs: submodules: 'recursive' token: ${{ secrets.REPO_READ_TOKEN }} - - name: Cache MATLAB build files - uses: actions/cache@v3 - with: - key: matlab-buildtool - path: | - buildUtilities/.buildtool + #- name: Cache MATLAB build files + # uses: actions/cache@v3 + # with: + # key: matlab-buildtool + # path: | + # buildUtilities/.buildtool - name: Download firmware artifact uses: dawidd6/action-download-artifact@v2 @@ -97,7 +99,10 @@ jobs: - name: Run MATLAB command run: | - &"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test({'noHW','bdConnected'})" + &"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); updateSGdeps; testTask({'noHW','bdConnected'});" + # MATLAB R2022b does not support input arguments to buildtool + #run: | + # &"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); cd('buildUtilities'); buildtool test({'noHW','bdConnected'});" - name: Publish Test Results uses: EnricoMi/publish-unit-test-result-action/composite@v2 From 26fdf9f4a68a4933d560a171f18a074e79a3afc1 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 01:40:01 +0100 Subject: [PATCH 3/8] Add timeout of 30 minutes for MATLAB test execution. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4e137c8..410bc15 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,6 +98,7 @@ jobs: if_no_artifact_found: fail - name: Run MATLAB command + timeout-minutes: 30 run: | &"$env:ProgramFiles\MATLAB\${{ matrix.matlabVer }}\bin\matlab.exe" -batch "openProject(pwd); updateSGdeps; testTask({'noHW','bdConnected'});" # MATLAB R2022b does not support input arguments to buildtool From 1b3dd77b837eeb1c5572659d9268bcb23b52a415 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 01:54:50 +0100 Subject: [PATCH 4/8] Fix UDP mrk instrument by using non-virtual bus element. --- toolbox/examples/demo_measure_loop_latency.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toolbox/examples/demo_measure_loop_latency.m b/toolbox/examples/demo_measure_loop_latency.m index c360c97..4a63b5c 100644 --- a/toolbox/examples/demo_measure_loop_latency.m +++ b/toolbox/examples/demo_measure_loop_latency.m @@ -10,10 +10,10 @@ bd.start; % Prepare instrument object with signals to stream -inst = slrealtime.Instrument; -inst.addSignal('mainmodel/UDP/Decode UDP Packet',3); % Former UDP/raw_mrk -inst.addSignal('mainmodel/Unit Delay',1); % Former gen_running -bd.addInstrument(inst); +instObj = slrealtime.Instrument; +instObj.addSignal('biosignal','BusElement','mrk'); % Former UDP/raw_mrk +instObj.addSignal('mainmodel/Unit Delay',1); % Former gen_running +bd.addInstrument(instObj); %% Configure scopes in SDI @@ -26,7 +26,7 @@ runObj = Simulink.sdi.Run.getLatest; % Get signal objects and add to subplot -mrkSig = runObj.getSignalsByName('mrk'); +mrkSig = runObj.getSignalsByName('biosignal.mrk'); mrkSig.plotOnSubPlot(1,1,true); genRunSig = runObj.getSignalsByName('gen_running'); From 0889558deda5d567e2dc18c732f4914435e0551d Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 02:11:33 +0100 Subject: [PATCH 5/8] Only upload SG dependencies when executing in master branch. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 410bc15..a01b33a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -115,6 +115,7 @@ jobs: results.xml - name: Upload Speedgoat dependencies as artifacts + if: ${{ github.ref == 'refs/heads/master' }} uses: actions/upload-artifact@v3 with: name: speedgoat-deps-${{ matrix.matlabVer }} From 2a4b040f37f468a6ec2de8c06ae87cafe9d9f5ec Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 02:24:15 +0100 Subject: [PATCH 6/8] Update MATLAB version requirements. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60dceb4..3faf9d3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml/badge.svg)](https://github.com/sync2brain/bossdevice-api-matlab/actions/workflows/main.yml) [![GitHub issues by-label](https://img.shields.io/github/issues-raw/sync2brain/bossdevice-api-matlab/bug)](https://github.com/sync2brain/bossdevice-api-matlab/issues?q=is%3Aissue+is%3Aopen+label%3Abug) ![GitHub](https://img.shields.io/github/license/sync2brain/bossdevice-api-matlab) [![View bossdevice-api-matlab on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/133972-bossdevice-api-matlab) [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=sync2brain/bossdevice-api-matlab&project=Bossdeviceapimatlab.prj) ## Requirements -- MATLAB® Supported releases are R2023a and R2023b in their latest update available. +- MATLAB® R2022b or newer in their latest update available. - Simulink Real-Time® - [Simulink Real-Time Target Support Package](https://www.mathworks.com/matlabcentral/fileexchange/76387-simulink-real-time-target-support-package) - [bossdevice](https://sync2brain.com/) hardware From 205f343ff0c94500348897476ebd0413f517ce77 Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 02:25:36 +0100 Subject: [PATCH 7/8] Set minimum MATLAB release to R2022b. --- buildUtilities/releaseTask.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildUtilities/releaseTask.m b/buildUtilities/releaseTask.m index c828906..843049a 100644 --- a/buildUtilities/releaseTask.m +++ b/buildUtilities/releaseTask.m @@ -30,7 +30,7 @@ end toolboxOptions.OutputFile = fullfile(projObj.RootFolder,"releases/bossdevice-api-installer.mltbx"); -toolboxOptions.MinimumMatlabRelease = "R2023a"; +toolboxOptions.MinimumMatlabRelease = "R2022b"; % toolboxOptions.MaximumMatlabRelease = "R2023a"; % Won't limit maximum MATLAB release toolboxOptions.SupportedPlatforms.Glnxa64 = true; toolboxOptions.SupportedPlatforms.Maci64 = false; From 15c8f587e1bd693d9c644ba6b56feca6c26c973c Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 5 Nov 2023 02:28:07 +0100 Subject: [PATCH 8/8] Increase wait time up to 40s after target upgrade. --- tests/commonSetupTests.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commonSetupTests.m b/tests/commonSetupTests.m index cd8c075..7464ae3 100644 --- a/tests/commonSetupTests.m +++ b/tests/commonSetupTests.m @@ -17,8 +17,8 @@ function setupBossdevice(testCase) testCase.bd = bossdevice; testCase.bd.targetObject.update; - fprintf('Wait 30s for target to reboot after update and set IP address in secondary interface.\n'); - pause(30); + fprintf('Wait 40s for target to reboot after update and set IP address in secondary interface.\n'); + pause(40); % Set Ethernet IP in secondary interface bossapi.setEthernetInterface(testCase.bd.targetObject,'wm1','192.168.200.255/24'); end