Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Complied matlab code issue with matlab unit testing framwork runtest.m

40 views
Skip to first unread message

Arthur

unread,
Mar 2, 2017, 7:44:08 PM3/2/17
to
I just copied the example here for function-based unit test
https://www.mathworks.com/help/matlab/matlab_prog/write-simple-test-case-with-functions.html

As a result, I have two files
quadraticSolver.m
solverTest.m

In addition, I wrote a simple wrapper code testmain.m, which is nothing but

function testmain()
result = runtests('solverTest.m')
rt = table(result);
sortrows(rt, 'Duration');
writetable(rt, 'TestResults.csv', 'QuoteStrings', true);
end


Then, I compiled it using the following command:
mcc -m testmain.m -a solverTest.m quadraticSolver.m

I got an executable named testmain together with run_testmain.sh after compilation completes. So far so good...

However, when I tried to run the executable with MATLAB run time using the following command
./run_testmain.sh /data/Research/Projects/../MATLAB_Runtime/v91/

I got the error below:

Setting up environment variables
---
LD_LIBRARY_PATH is .:/data/Research/Projects/Project018_OncoPipe/OncoPipe_v1.7/MATLAB_Runtime/v91//runtime/glnxa64:/data/Research/Projects/Project018_OncoPipe/OncoPipe_v1.7/MATLAB_Runtime/v91//bin/glnxa64:/data/Research/Projects/Project018_OncoPipe/OncoPipe_v1.7/MATLAB_Runtime/v91//sys/os/glnxa64:/data/Research/Projects/Project018_OncoPipe/OncoPipe_v1.7/MATLAB_Runtime/v91//sys/opengl/lib/glnxa64
Error: File: /data/Research/Projects/Project018_OncoPipe/OncoPipe_v1.7/MATLAB_Runtime/v91/mcr/toolbox/matlab/testframework/core/runtests.m Line: 84 Column: 8
Arguments to IMPORT must either end with ".*" or else specify a fully qualified class name: "matlab.internal.parallel.canUseParallelPool" fails this test.

Error in testmain (line 3)

MATLAB:mir_illegal_import_argument


No idea what happens. Any help would be highly appreciated.

Thanks,
Arthur

Bruno Luong

unread,
Mar 3, 2017, 2:25:07 AM3/3/17
to
"Arthur" wrote in message <o9ae8j$9qp$1...@newscl01ah.mathworks.com>...

>
> function testmain()
...

> ./run_testmain.sh /data/Research/Projects/../MATLAB_Runtime/v91/

Why you run with a path argument ? Your testfmain m-function does not declared with any input argument.

Arthur

unread,
Mar 3, 2017, 2:11:08 PM3/3/17
to
"Bruno Luong" wrote in message <o9b5of$33v$1...@newscl01ah.mathworks.com>...
Path argument is required by Matlab, which contains the runtime environment

Andy Campbell

unread,
May 3, 2017, 4:33:08 PM5/3/17
to
Hi Arthur,

have you tried using a MATLAB Unit TestRunner instead of runtests? For example, this might look like this:

function testmain()
% Create a runner that runs completely silently but still produces a valid TestResult
runner = matlab.unittest.TestRunner.withNoPlugins;

% OR

% Create a runner that produces familiar text output.
runner = matlab.unittest.TestRunner.withTextOutput;


result = runner.run(testsuite('solverTest.m'))
rt = table(result);
sortrows(rt, 'Duration');
writetable(rt, 'TestResults.csv', 'QuoteStrings', true);
end

Does that help?

Also, curious to hear more about what you are doing and why you are interested in running tests in the compiled environment. Definitely would like to hear more and gain some insight into your workflow!

Thanks,
Andy


"Arthur" wrote in message <o9ae8j$9qp$1...@newscl01ah.mathworks.com>...
0 new messages