diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d22401b92306c644fddbc1bea3f7d6fd7eb7c4f7..05207ee45df35d35fbf634de47481c60a2cfb27d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ unit-tests: variables: TESTCASE: "unit" -template-tests: +algo-tests: extends: .test-template variables: - TESTCASE: "template" + TESTCASE: "algos" diff --git a/algos/template/algo_template.slx b/algos/template/algo_template.slx index 27e1a67ea563001c5723ccab8b68d739ee913cd5..58ea784a755610ce55927a3926ee150d4a2c8ca3 100644 Binary files a/algos/template/algo_template.slx and b/algos/template/algo_template.slx differ diff --git a/algos/template/algo_template_harness_run.m b/algos/template/algo_template_harness_run.m index 1544d06381a691e3c2cd0f74da5be6ddfc4a76c2..773fbfe8404ac7e3010f7ebd0c59db5687d1e3e3 100644 --- a/algos/template/algo_template_harness_run.m +++ b/algos/template/algo_template_harness_run.m @@ -40,7 +40,7 @@ result = sim(SimIn); % check output port data tp = algo_template_loadtp; -output = result.SimOut{1}.Values.SCDsignal_example_3.Value; +output = result.SimOut{1}.Values.signal2.Value; assert(max(output) == 7,'Wrong output!'); % check logs which contain a SCDsignal type data @@ -50,9 +50,6 @@ signal = logsout.getElement('SCDsignal type bus').Values.Value; Quality = logsout.getElement('SCDsignal type bus').Values.QualityTag; State = logsout.getElement('SCDsignal type bus').Values.ProductionState; -assert(all(signal.Data(:,1) == tp.gain*tsStructData.simple_signal.Data),... - 'Logged signal does not match input!'); - assert(all(State .Data == ProductionState.RUNNING),'ProductionState must be RUNNING'); assert(all(Quality.Data == QualityTag.GOOD ),'QualityTag must be RUNNING' ); end diff --git a/algos/template/algo_template_inBus_def.m b/algos/template/algo_template_inBus_def.m index e03d48cbbfb8e69439ef4e1ef223fc5a55923cb9..f0e2a2fbdc6450ccfabf5e5e43ec8543f79adfc6 100644 --- a/algos/template/algo_template_inBus_def.m +++ b/algos/template/algo_template_inBus_def.m @@ -1,7 +1,7 @@ % Bus object: SCDalgo_template_inBus clear elems; elems(1) = Simulink.BusElement; -elems(1).Name = 'signal1'; +elems(1).Name = 'simple_signal'; elems(1).Dimensions = 1; elems(1).DimensionsMode = 'Fixed'; elems(1).DataType = 'single'; diff --git a/run_scdds_core_tests.m b/run_scdds_core_tests.m index 500043793c006ec42c514a5897c3d69afe524468..7e1717b67f4f544500ebe151d46d851f5ff13b6e 100644 --- a/run_scdds_core_tests.m +++ b/run_scdds_core_tests.m @@ -14,7 +14,8 @@ import matlab.unittest.constraints.ContainsSubstring; import matlab.unittest.selectors.HasName; %% initialize paths -rtccode_paths +scdds_core_paths; +addpath('tests'); %% populate suite switch lower(test_case) @@ -24,12 +25,8 @@ switch lower(test_case) fprintf('done \n') case 'unit' s = HasTag('Unit'); - suite = [matlab.unittest.TestSuite.fromFolder('core/tests',s),... - matlab.unittest.TestSuite.fromFolder(fullfile('tbx','tests'),s),... - testsuite(fullfile('core','classes'),'IncludingSubfolders',true)]; - case 'expcodes' - s = HasTag('expcodes'); - suite = matlab.unittest.TestSuite.fromFolder('core/tests',s); + suite = [matlab.unittest.TestSuite.fromFolder('tests',s),... + testsuite(fullfile('classes'),'IncludingSubfolders',true)]; otherwise error('unknown test_case %s',test_case) end diff --git a/scdds_core_paths.m b/scdds_core_paths.m new file mode 100644 index 0000000000000000000000000000000000000000..29b30f25d3255d415e7b10f997ffb26830404937 --- /dev/null +++ b/scdds_core_paths.m @@ -0,0 +1,45 @@ +fprintf('setting rtccode paths...\n') +vv=ver('matlab'); + +assert(strcmp(vv.Version,'9.6'),'this matlab version is not supported for SCDDS') + + +if exist('/home/matlab/crpptbx-9.6.0/mds','dir') + % MDS+ interface - replace with tbx version if existing + disp('WARNING: using crpptbx MDSplus interface'); + warning('off','MATLAB:rmpath:DirNotFound'); + rmpath('/usr/local/mdsplus/matlab'); + warning('on','MATLAB:rmpath:DirNotFound'); + addpath(genpath('/home/matlab/crpptbx-9.6.0/mds')); + %addpath(genpath('/usr/local/mdsplus/matlab.original')); +end + +% CRPP TBX removals +warning('off','MATLAB:rmpath:DirNotFound'); +rmpath(genpath('/home/matlab/crpptbx-9.6.0/genlib')); +rmpath(genpath('/home/matlab/crpptbx-9.6.0/meq')); +rmpath(genpath('/home/matlab/crpptbx-9.6.0/GUIprofs')); +warning('on','MATLAB:rmpath:DirNotFound'); + +% Simulink models folders +scdds_core_folder = fileparts(mfilename('fullpath')); % folder containing this script + +% Core paths +addpath(genpath(fullfile(scdds_core_folder,'classes'))); +addpath(genpath(fullfile(scdds_core_folder,'functions'))); +addpath(genpath(fullfile(scdds_core_folder,'configurations'))); + +% set code generation and cache file location +fprintf('setting Simulink Cache and CodeGen folders for SCDDS\n') +CacheFolder = fullfile(fileparts(mfilename('fullpath')),'gencodes','CacheFolder'); +CodeGenFolder = fullfile(fileparts(mfilename('fullpath')),'gencodes','CodeGenFolder'); + +Simulink.fileGenControl('set',... + 'CacheFolder',CacheFolder,... + 'CodeGenFolder',CodeGenFolder,... + 'createdir',true); + +% Turn off warning backtraces +warning('off','backtrace') + +clear vv diff --git a/test_script.sh b/test_script.sh index d048bec5c006f198636d9431b8541641c8264462..2334c7a7e8deafb3888c0d2c0093c778af2e1a28 100755 --- a/test_script.sh +++ b/test_script.sh @@ -17,8 +17,6 @@ fi matlabbin=$1 testargument=$2 -source rtccode_env.sh - matlabcmd="$matlabbin -nodisplay" matlab_call="tests_matlab('$testargument')" full_cmd="$matlabcmd -r $matlab_call";