Skip to content

Commit 74f9a9b

Browse files
authored
Merge pull request #37 from sync2brain/dev-R2023b
Add compatibility with R2023b
2 parents bfd37b4 + 17ce07a commit 74f9a9b

File tree

7 files changed

+76
-110
lines changed

7 files changed

+76
-110
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false # Run with every MATLAB version independently
2424
matrix:
25-
matlabVer: [R2023a] # List of MATLAB releases to test
25+
matlabVer: [R2023a, R2023b] # List of MATLAB releases to test
2626
runs-on: matlab
2727
# Steps represent a sequence of tasks that will be executed as part of the job
2828
steps:
@@ -55,7 +55,7 @@ jobs:
5555
strategy:
5656
fail-fast: false # Run with every MATLAB version independently
5757
matrix:
58-
matlabVer: [R2023a] # List of MATLAB releases to test
58+
matlabVer: [R2023a, R2023b] # List of MATLAB releases to test
5959
runs-on: matlab
6060
# Steps represent a sequence of tasks that will be executed as part of the job
6161
steps:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info>
3+
<Category UUID="FileClassCategory">
4+
<Label UUID="test"/>
5+
</Category>
6+
</Info>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Info location="commonSetupTests.m" type="File"/>

tests/commonSetupTests.m

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
classdef commonSetupTests < matlab.unittest.TestCase
2+
3+
properties (Constant)
4+
firmwarePath = fullfile(getenv('firmwareSharePath'),matlabRelease.Release)
5+
end
6+
7+
properties
8+
bd bossdevice
9+
sgPath
10+
isSGinstalled
11+
end
12+
13+
methods (TestClassSetup)
14+
function setupBossdevice(testCase)
15+
[testCase.isSGinstalled, testCase.sgPath] = bossapi.isSpeedgoatBlocksetInstalled;
16+
if testCase.isSGinstalled
17+
% If local installation of Speedgoat blockset is present, update toolbox dependencies and work with them
18+
bossapi.removeSpeedgoatBlocksetFromPath(testCase.sgPath);
19+
end
20+
21+
testCase.bd = bossdevice;
22+
testCase.bd.targetObject.update;
23+
24+
fprintf('Wait 30s for target to reboot after update and set IP address in secondary interface.\n');
25+
pause(30);
26+
% Set Ethernet IP in secondary interface
27+
bossapi.setEthernetInterface(testCase.bd.targetObject,'wm1','192.168.200.255/24');
28+
end
29+
30+
function addFirmwarePath(testCase)
31+
import matlab.unittest.fixtures.PathFixture
32+
if isfolder(testCase.firmwarePath)
33+
testCase.applyFixture(PathFixture(testCase.firmwarePath));
34+
end
35+
end
36+
end
37+
38+
methods (TestClassTeardown)
39+
function resetSgPath(testCase)
40+
if testCase.isSGinstalled
41+
% If local installation of Speedgoat blockset is present, restore default paths
42+
bossapi.addSpeedgoatBlocksetToPath(testCase.sgPath);
43+
end
44+
end
45+
46+
function rebootTarget(testCase)
47+
disp('Rebooting bossdevice to teardown test class.');
48+
testCase.bd.targetObject.reboot;
49+
pause(30);
50+
end
51+
end
52+
53+
methods (TestMethodTeardown)
54+
function clearBossdeviceObj(testCase)
55+
if ~isempty(testCase.bd) && testCase.bd.isConnected
56+
testCase.bd.stop;
57+
testCase.bd.targetObject.disconnect;
58+
end
59+
end
60+
end
61+
62+
end

tests/exampleTests.m

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,13 @@
1-
classdef exampleTests < matlab.unittest.TestCase
1+
classdef exampleTests < commonSetupTests
22
%EXAMPLETESTS Execute all shipping examples
33

4-
properties (Constant)
5-
firmwarePath = fullfile(getenv('firmwareSharePath'),matlabRelease.Release)
6-
end
7-
84
properties (TestParameter)
95
exName = {'demo_jittered_open_loop_stimulation'}
106
end
117

12-
properties
13-
bd bossdevice
14-
sgPath
15-
isSGinstalled
16-
end
17-
18-
methods (TestClassSetup)
19-
function setupBossdevice(testCase)
20-
[testCase.isSGinstalled, testCase.sgPath] = bossapi.isSpeedgoatBlocksetInstalled;
21-
if testCase.isSGinstalled
22-
% If local installation of Speedgoat blockset is present, update toolbox dependencies and work with them
23-
bossapi.removeSpeedgoatBlocksetFromPath(testCase.sgPath);
24-
end
25-
import matlab.unittest.fixtures.PathFixture
26-
if isfolder(testCase.firmwarePath)
27-
testCase.applyFixture(PathFixture(testCase.firmwarePath));
28-
end
29-
testCase.bd = bossdevice;
30-
testCase.bd.targetObject.update;
31-
end
32-
end
33-
34-
methods (TestClassTeardown)
35-
function resetSgPath(testCase)
36-
if testCase.isSGinstalled
37-
% If local installation of Speedgoat blockset is present, restore default paths
38-
bossapi.addSpeedgoatBlocksetToPath(testCase.sgPath);
39-
end
40-
end
41-
42-
function rebootTarget(testCase)
43-
disp('Rebooting bossdevice to teardown test class.');
44-
testCase.bd.targetObject.reboot;
45-
pause(30);
46-
end
47-
end
48-
49-
methods (TestMethodTeardown)
50-
function stopBossdevice(testCase)
51-
if testCase.bd.isConnected && testCase.bd.isRunning
52-
testCase.bd.stop;
53-
pause(5);
54-
end
55-
end
56-
end
57-
588
methods (Test, TestTags = {'bdConnected'})
599
function runExampleScript(~, exName)
6010
run(exName);
6111
end
6212
end
63-
end
13+
end

tests/smokeTests.m

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,4 @@
1-
classdef smokeTests < matlab.unittest.TestCase
2-
3-
properties (Constant)
4-
firmwarePath = fullfile(getenv('firmwareSharePath'),matlabRelease.Release)
5-
end
6-
7-
properties
8-
bd bossdevice
9-
sgPath
10-
isSGinstalled
11-
end
12-
13-
methods (TestClassSetup)
14-
function setupBossdevice(testCase)
15-
[testCase.isSGinstalled, testCase.sgPath] = bossapi.isSpeedgoatBlocksetInstalled;
16-
if testCase.isSGinstalled
17-
% If local installation of Speedgoat blockset is present, update toolbox dependencies and work with them
18-
bossapi.removeSpeedgoatBlocksetFromPath(testCase.sgPath);
19-
end
20-
21-
testCase.bd = bossdevice;
22-
testCase.bd.targetObject.update;
23-
end
24-
25-
function addFirmwarePath(testCase)
26-
import matlab.unittest.fixtures.PathFixture
27-
if isfolder(testCase.firmwarePath)
28-
testCase.applyFixture(PathFixture(testCase.firmwarePath));
29-
end
30-
end
31-
end
32-
33-
methods (TestClassTeardown)
34-
function resetSgPath(testCase)
35-
if testCase.isSGinstalled
36-
% If local installation of Speedgoat blockset is present, restore default paths
37-
bossapi.addSpeedgoatBlocksetToPath(testCase.sgPath);
38-
end
39-
end
40-
41-
function rebootTarget(testCase)
42-
disp('Rebooting bossdevice to teardown test class.');
43-
testCase.bd.targetObject.reboot;
44-
pause(30);
45-
end
46-
end
47-
48-
methods (TestMethodTeardown)
49-
function clearBossdeviceObj(testCase)
50-
if ~isempty(testCase.bd) && testCase.bd.isConnected
51-
testCase.bd.stop;
52-
testCase.bd.targetObject.disconnect;
53-
end
54-
end
55-
end
1+
classdef smokeTests < commonSetupTests
562

573
methods (Test, TestTags = {'noHW'})
584
% Test methods that do not require bossdevice or any target connected

toolbox/dependencies/+bossapi

0 commit comments

Comments
 (0)