Skip to content

Testing: Travis specific

Agah edited this page Mar 16, 2018 · 6 revisions

What is Travis?

Travis is a continuous integration service. Each push, on any branch, triggers a test:

Travis servers will clone the branch, install octave, and start the test scripts.
Developer will receive an email indicating whether Travis is failed or fixed.



Travis configuration can be found here: .travis.ylm

Walking you through the Travis Configuration (.travis.yml)

These lines constitute a codeblock that is required to define build environment for Travis. Unless you need to make additions, please avoid modifying this section.

Octave installation is evoked by this line.

We need certain Octave Packages such as io optim struct image and statistics. One way to obtain this is using pkg install with -forge argument. However, with this option we faced problems many times because of server response errors. As a solution, Octave packages are downloaded from their host using wget into the /home/travis/build/neuropoly/qMRLab:

    - travis_retry wget http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/struct-1.0.14.tar.gz -P /home/travis/build/neuropoly/qMRLab
    - travis_retry wget http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/optim-1.5.2.tar.gz -P /home/travis/build/neuropoly/qMRLab
    - travis_retry wget https://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/io-2.4.10.tar.gz -P /home/travis/build/neuropoly/qMRLab
    - travis_retry wget http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/statistics-1.3.0.tar.gz -P /home/travis/build/neuropoly/qMRLab
    - travis_retry wget http://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/image-2.6.1.tar.gz -P /home/travis/build/neuropoly/qMRLab

These files are then used by startup.m to install and load each package. There is an interesting bug in installing and loading these packages:

If you execute package installation by pkg('installl','package_name_ver.tar.gz') then octave will fail to load packages properly. Use pkg install package_name_ver.tar.gz instead.

How do we trigger MoxUnit tests?

Part of this operation is handled by startup.m, governing package installation and load. Then, moxunit_runtests are called to perform all defined test in the Test/MoxUnitCompatible directory recursively.

script:
    travis_wait 80 octave --no-gui --eval "startup;cd('Test/MoxUnitCompatible');res=moxunit_runtests('-recursive');exit(~res);"

**Notes: **

  • travis_wait 80 allocates 80min to the testing function. This is because, commands taking longer than 10 minutes evokes <exit 1, failure> state of travis.

  • In the testing scripts, environment variables are used (e.g. setenv('ISTRAVIS','1')). Use these variables to make test faster. For instance in FitData.m, the variable ISTRAVIS is used to prevent fitting more than 2 voxels.

Test travis w/o pushing a commit

  • If you sign up for an account to TRAVIS (or link it to your Github account?), you can refresh builds there without pushing a commit. Please visit here for further details.

  • Or you can use Docker. Details can be found here.