Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/all-tests-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
steps:
- run: echo "Triggered by WEC-Sim commit ${{ fromJSON(inputs.client_payload).sha }}"
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
lfs: true
ref: ${{ fromJSON(inputs.client_payload).branch }}
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
uses: matlab-actions/setup-matlab@v3
with:
release: R2024b
- name: Get test target folder
uses: matlab-actions/run-command@v2
uses: matlab-actions/run-command@v3
with:
command: getTestTargets
- name: Save output
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/changed-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ jobs:
if: github.event_name != 'repository_dispatch'
steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
lfs: true
fetch-depth: 0
- name: Generate git diff
uses: GrantBirki/git-diff-action@v2
uses: GrantBirki/git-diff-action@v3
id: git-diff-action
with:
json_diff_file_output: diff.json
file_output_only: "true"
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
uses: matlab-actions/setup-matlab@v3
with:
release: R2024b
- name: Get test target folder
uses: matlab-actions/run-command@v2
uses: matlab-actions/run-command@v3
with:
command: getTestTargets("diff.json")
- name: Save output
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-tests-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ jobs:
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
lfs: true
ref: ${{ inputs.head_ref }}
repository: ${{ inputs.repository }}
- name: Checkout LFS objects
run: git lfs checkout
- name: Check out WEC-Sim
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: WEC-Sim/WEC-Sim
ref: ${{ inputs.base_ref }}
path: './WEC-Sim'
- name: Check out MoorDyn
if: matrix.folder == 'Mooring' || matrix.folder == 'OWC' || matrix.folder == 'Paraview_Visualization'
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: WEC-Sim/MoorDyn
path: './MoorDyn'
Expand All @@ -60,7 +60,7 @@ jobs:
shell: bash
working-directory: './MoorDyn'
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
uses: matlab-actions/setup-matlab@v3
with:
products: ${{ matrix.products }}
release: ${{ matrix.release }}
Expand All @@ -71,7 +71,7 @@ jobs:
Xvfb :99 &
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Install WEC-Sim, run tests and generate artifacts
uses: matlab-actions/run-command@v2
uses: matlab-actions/run-command@v3
with:
command: |
addpath(genpath('WEC-Sim/source'));
Expand Down
8 changes: 8 additions & 0 deletions Body-to-Body_Interactions/TestB2B.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ function killPlots (~)
end

methods(TestClassSetup)
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
Expand Down
13 changes: 9 additions & 4 deletions Cable/TestCable.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ function killPlots (~)
end

methods(TestClassSetup)

function captureVisibility(testCase)
testCase.OriginalDefault = get(0, 'DefaultFigureVisible');
end

function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand All @@ -40,18 +46,17 @@ function runBemio(testCase)
end

methods(TestClassTeardown)

function checkVisibilityRestored(testCase)
set(0, 'DefaultFigureVisible', testCase.OriginalDefault);
testCase.assertEqual(get(0, 'DefaultFigureVisible'), ...
testCase.OriginalDefault);
end

end

methods(Test)
function testCable(testCase)
wecSim
close_system('MBARI_cable',0)
end
end

Expand Down
14 changes: 14 additions & 0 deletions Controls/TestControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ function killPlots (~)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand Down Expand Up @@ -53,26 +61,32 @@ function checkVisibilityRestored(testCase)
function testPassive(testCase)
cd('Passive (P)')
wecSim
close_system('passive',0)
end
function testReactive(testCase)
cd('Reactive (PI)')
wecSim
close_system('reactive',0)
end
function testLatching(testCase)
cd('Latching')
wecSim
close_system('latchTime',0)
end
function testDeclutching(testCase)
cd('Declutching')
wecSim
close_system('declutch',0)
end
function testMPC(testCase)
cd('MPC')
wecSim
close_system('sphereMPC',0)
end
function testReactiveWithPTO(testCase)
cd('ReactiveWithPTO')
wecSim
close_system('reactiveWithPTO',0)
end
end
end
13 changes: 11 additions & 2 deletions Desalination/TestDesalination.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
% Check for Simscape Fluids
assumeEqual(testCase, ...
Expand All @@ -38,7 +46,7 @@ function runBemio(testCase)
end
cd(testCase.testDir)
testCase.hasH5 = true;
end
end
end

methods(TestClassTeardown)
Expand All @@ -52,6 +60,7 @@ function checkVisibilityRestored(testCase)
methods(Test)
function testDesalination(testCase)
wecSim
close_system('OSWEC_RO',0)
end
end
end
13 changes: 11 additions & 2 deletions End_Stops/TestEndStops.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand All @@ -34,7 +42,7 @@ function runBemio(testCase)
cd(testCase.testDir)
end
end

methods(TestClassTeardown)
function checkVisibilityRestored(testCase)
set(0,'DefaultFigureVisible',testCase.OriginalDefault);
Expand All @@ -46,6 +54,7 @@ function checkVisibilityRestored(testCase)
methods(Test)
function testEnd_Stops(testCase)
wecSim
close_system('RM3',0)
end
end
end
10 changes: 9 additions & 1 deletion Free_Decay/TestFreeDecay.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand Down
13 changes: 11 additions & 2 deletions Full_Directional_Waves/TestFullDirectionalWaves.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand Down Expand Up @@ -52,6 +60,7 @@ function checkVisibilityRestored(testCase)
methods(Test)
function testFullDirectionalWaves(testCase)
wecSim
end
close_system('OSWEC',0)
end
end
end
11 changes: 10 additions & 1 deletion Generalized_Body_Modes/TestGeneralizedBodyModes.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand All @@ -46,6 +54,7 @@ function checkVisibilityRestored(testCase)
methods(Test)
function testGeneralized_Body_Modes(testCase)
wecSim
close_system('GBM',0)
end
end
end
13 changes: 12 additions & 1 deletion Load_Mitigating_Controls/TestLoadMitigatingControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ function killPlots (~)
methods(TestClassSetup)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBemio(testCase)
cd(testCase.h5Dir);
if isfile(testCase.h5Name)
Expand Down Expand Up @@ -52,14 +60,17 @@ function checkVisibilityRestored(testCase)
function testLoad_Mitigating_Control_ControlTests(testCase)
cd('ControlTests')
wecSim
close_system('WaveBot3Dof_Control',0)
end
function testLoad_Mitigating_Control_CalcImpedance(testCase)
cd('CalcImpedance')
wecSim
close_system('WaveBot3Dof_ID',0)
end
function testLoad_Mitigating_Control_CalcImpedance_MCR(testCase)
cd('CalcImpedance')
wecSimMCR
close_system('WaveBot3Dof_ID',0)
end
end
end
9 changes: 9 additions & 0 deletions MOST/tests/TestMOST.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ function killPlots (~)
function captureVisibility(testCase)
testCase.OriginalDefault = get(0,'DefaultFigureVisible');
end
function removeProjectFolder(~)
d = dir('**');
d = d([d.isdir]);
d = d(string({d.name})=="slprj");
for i = 1:length(d)
rmdir(fullfile(d(i).folder, d(i).name), 's')
end
end
function runBEMIO(testCase)
cd(fullfile(testCase.testDir, testCase.hydroDataDir));
if isfile(testCase.h5Name)
Expand All @@ -52,6 +60,7 @@ function runMOSTIO(testCase)
function runTurbulentTest(testCase)
cd(fullfile(testCase.testDir,'turbulent'))
runLoadTurbulent;
close_system('SModel_VolturnUS',0)
testCase.turbulent = load('turbulent.mat').("turbulent");
cd(testCase.testDir);
end
Expand Down
Loading
Loading