-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Travis testing #37
Travis testing #37
Conversation
Whilst creating this PR I have come across the following issue. The below command I believe should run the testing suite for the SPM viewer in a docker container on my machine.
This appears to run the code as required. However, Octave throws an error saying it doesn't have the import function (which is used to load the matlab unittesting framework library).
I found a fix on stack overflow here but this has given no luck as it has just transformed the error to this:
This PR may be put on hold until the next Octave release. |
The matlab.unittest framework is not available in Octave and it would be a rather big task to implement it in its entirety. From what I can see in the tests here, you don't use many of its functionalities though so I wonder whether we could have a small workaround or use something like MOdox instead. |
Ah I see - Thank you for clarifying this! Do you know of any example repositories than currently contain a MOdox-based testing suite? |
Thank you @gllmflndn! @TomMaullin: Does this help: https://github.com/MOdox/MOdox#use-with-travis-ci-and-shippable ? |
I am a little confused by this |
That's because I gave you a link to the wrong project, have a look at MOxUnit instead. Sorry! If you were OK to use function-based unit tests instead of class-based ones, we could otherwise write a little wrapper for Octave. |
Ah - no worries! Yes, this is exactly what I was looking for - Thank you! I see no reason why these tests couldn't be function based instead of class based... I believe, if I remember correctly, I actually wrote these as functions first before plugging them into the matlab unit testing framework. I think this is why they barely make use of the class structure. @cmaumet what do you think of this suggestion? I quite like the look of the MOxUnit tests and I don't believe it would be too much work to convert the current tests into this format. |
@TomMaullin: I would vote for the option that is the easiest to implement so pretty much up to you :) |
Okay great! I'll give the MOxUnit tests a go and let you know how they go! |
I have been using Octave a bit more recently and realized that the NIDMResults viewer itself does not run on Octave (many of the functions it uses are not currently implemented in Octave). As the tests themselves run the viewer, I am unsure we will be able to test this repository on Travis using dockers with Octave unless the viewer itself is also Octave-friendly. An example of the issue is given by running the command below in the
This results in:
I at first tried making temporary files to replace the missing functions but I think there are quite a lot of missing functions. I'm honestly not sure how to move on from here. @cmaumet I was wondering, how did you get SPM running in Octave? Is SPM octave-friendly? |
The NIDM-Results export from SPM should work with Octave 4.4. Could you list the missing functions that you are trying to use? You mention contains (endsWith would be more adequate here but is not yet available either) but it is only available since R2016b so you would anyway be better off checking the file extension with fileparts/strncmp. |
@TomMaullin: can you rebase on master in order to include the octave-compatibility updates from #38? And then we can check if the tests pass? |
Thanks @TomMaullin! I've just enabled Travis CI for this repository and created a dummy commit to trigger the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Thanks for making this work!! I only have a couple of comments of external files you have included in the repo.
Regarding your question on keeping the test suite that is using unittest for Matlab testing, could you let us know what is your preferred option?
test/bug_patches/chi2inv.m
Outdated
@@ -0,0 +1,71 @@ | |||
## Copyright (C) 2012 Rik Wehbring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomMaullin: is it normal that you have included this chi2inv.m file in the version-control?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah apologies... I thought I had removed this! I'll remove it now!
test/bug_patches/spm_file_template.m
Outdated
@@ -0,0 +1,204 @@ | |||
classdef spm_file_template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we patch on-the-fly as suggested by Guillaume in #38 (comment)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Right! I had misunderstood here, yes I will change this! I thought this was intended to go in the docker image eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully it's only temporary as SPM dev includes the workaround and there is a patch submitted for Octave.
Hi @cmaumet , My preference would be to keep both versions of the testing framework, both MOxUnit and matlab unittesting framework. The reason for this is that MOxUnit works on Travis whereas matlab unittesting framework does not, but while developing and making changes locally I find the matlab unittesting framework tests are much faster and convenient than MOxUnit as they involve no setup or bug fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! The Octave statistics package should probably be installed through pkg()
but do you actually need it? From what I can see, you could just use the spm_*pdf.m
and spm_*cdf.m
functions from SPM.
Hi @gllmflndn , Oh right! Yes, I hadn't thought of that - that would make life a lot easier! I'll give this a go and let you know how smoothly it goes on Octave! |
Quick update: The SPM functions worked and the |
.gitignore
Outdated
@@ -11,6 +11,8 @@ Data/*.png | |||
|
|||
# Test data (if missing will be downloaded from NeuroVault) | |||
test/data | |||
test/MOxUnit | |||
test/octave-statistics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this from .gitignore, now that the code is not depending anymore on octave-statistics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, yes this is now done!
@TomMaullin: Great!! And let's keep both versions of the tests then! Could you document alternative ways to run the tests using: 2/ Octave and 3/ Octave+docker in the README? Also, do we need to put back
Once this is done, +1 to merge. |
@cmaumet , great! I will do this! Yes, currently the Matlab unittests have been removed so the original way of calling the tests no longer works. But I will add them back in and document everything! |
Hi @cmaumet , Both testing suites are now available and documented in the |
Thanks! +1 to merge. |
This PR aims to implement Travis Testing for the SPM html viewer using Docker containers and Octave.