diff --git a/.travis.yml b/.travis.yml index 5923331..3736045 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,67 +2,81 @@ # travis-ci.org definition for MOxUnit build (based on CoSMoMVPA, # which is based on PyMVPA, which is based on nipype configuration, # which in turn was based on nipy) -# -# We pretend to be java because we need GNU Octave which is not -# available (as of April 2015) -language: java +language: minimal +os: linux cache: - apt + env: - global: - - OCTAVE=octave - matrix: + matrix: - WITH_COVERAGE= - WITH_COVERAGE=true - RUN_DOC_TEST=true + before_install: - # to prevent IPv6 being used for APT - - sudo bash -c "echo 'Acquire::ForceIPv4 \"true\";' > /etc/apt/apt.conf.d/99force-ipv4" - - travis_retry sudo apt-get -y -qq update - - travis_retry sudo apt-get install -y -qq software-properties-common python-software-properties - - travis_retry sudo apt-add-repository -y ppa:octave/stable - - travis_retry sudo apt-get -y -qq update - # get Octave 4,0 - - travis_retry sudo apt-get -y -qq install octave liboctave-dev - # install MOcov - - cd .. - - rm -rf MOcov - - git clone https://github.com/MOcov/MOcov.git - - make -C MOcov install - # retrieve MOdox - - rm -rf MOdox - - travis_retry git clone -v git://github.com/MOdox/MOdox.git - - make -C MOdox install - # go back to original directory - - cd MOxUnit - # prevent shippable from re-using old test results - - if [[ "$SHIPPABLE" == "true" ]]; then - if [[ "$WITH_COVERAGE" != "true" ]]; then - rm -f ${SHIPPABLE_BUILD_DIR}/shippable/testresults/*.xml; - fi; - fi + # to prevent IPv6 being used for APT + - sudo bash -c "echo 'Acquire::ForceIPv4 \"true\";' > /etc/apt/apt.conf.d/99force-ipv4" + - travis_retry sudo apt-get -y -qq update + - travis_retry sudo apt-get install -y -qq software-properties-common python-software-properties + - travis_retry sudo apt-add-repository -y ppa:octave/stable + - travis_retry sudo apt-get -y -qq update + # get Octave 4,0 + - travis_retry sudo apt-get -y -qq install octave liboctave-dev + # install MOcov + - cd .. + - rm -rf MOcov + - git clone https://github.com/MOcov/MOcov.git + - make -C MOcov install + # retrieve MOdox + - rm -rf MOdox + - travis_retry git clone -v git://github.com/MOdox/MOdox.git + - make -C MOdox install + # go back to original directory + - cd MOxUnit + # prevent shippable from re-using old test results + - if [[ "$SHIPPABLE" == "true" ]]; then + if [[ "$WITH_COVERAGE" != "true" ]]; then + rm -f ${SHIPPABLE_BUILD_DIR}/shippable/testresults/*.xml; + fi; + fi script: - - if [[ "$WITH_COVERAGE" == "true" ]]; then - TEST_ARGS=WITH_COVERAGE=true; - COVER_ARGS=COVER=`pwd`/MOxUnit; + - if [[ "$WITH_COVERAGE" == "true" ]]; then + TEST_ARGS=WITH_COVERAGE=true; + COVER_ARGS=COVER=`pwd`/MOxUnit; - if [[ "$SHIPPABLE" == "true" ]]; then - OUTPUT_ARGS=COVER_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml; - AFTER_SCRIPT="find ${SHIPPABLE_BUILD_DIR}/shippable/;cat ${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml;which reports"; - elif [[ "$TRAVIS" == "true" ]]; then - OUTPUT_ARGS=COVER_JSON_FILE=`pwd`/coveralls.json; - AFTER_SCRIPT="curl --verbose -F json_file=@`pwd`/coveralls.json https://coveralls.io/api/v1/jobs"; - fi; - elif [[ "$SHIPPABLE" == "true" ]]; then - RESULT_ARGS=JUNIT_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/testresults/test_results.xml; - elif [[ "$RUN_DOC_TEST" == "true" ]]; then - TEST_ARGS=RUN_DOC_TEST=true; + if [[ "$SHIPPABLE" == "true" ]]; then + OUTPUT_ARGS=COVER_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml; + AFTER_SCRIPT="find ${SHIPPABLE_BUILD_DIR}/shippable/;cat ${SHIPPABLE_BUILD_DIR}/shippable/codecoverage/coverage.xml;which reports"; + elif [[ "$TRAVIS" == "true" ]]; then + OUTPUT_ARGS=COVER_JSON_FILE=`pwd`/coveralls.json; + AFTER_SCRIPT="curl --verbose -F json_file=@`pwd`/coveralls.json https://coveralls.io/api/v1/jobs"; fi; + elif [[ "$SHIPPABLE" == "true" ]]; then + RESULT_ARGS=JUNIT_XML_FILE=${SHIPPABLE_BUILD_DIR}/shippable/testresults/test_results.xml; + elif [[ "$RUN_DOC_TEST" == "true" ]]; then + TEST_ARGS=RUN_DOC_TEST=true; + fi; + + - echo Test arguments $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS + - make test $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS + - eval $AFTER_SCRIPT - - echo Test arguments $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS - - make test $TEST_ARGS $COVER_ARGS $OUTPUT_ARGS $RESULT_ARGS - - eval $AFTER_SCRIPT +jobs: + include: + - language: matlab + matlab: R2020a + # No need to do anything, but the 'before_install' key is inherited from teh enclosing scope and has to be reset to something insubstantial + before_install: + - echo 'noop' + # Could also clear 'env' but, as is, the only environment variable inhereted fromthe scope is $WITH_COVERAGE which does nothing here + + script: + - if [[ "$SHIPPABLE" == "true" ]]; then + echo 'No Matlab testing on Shippable'; + else + matlab -batch 'back=cd("./MOxUnit/"); moxunit_set_path(); cd(back); moxunit_runtests tests -verbose; exit(double(~ans))'; + fi; diff --git a/tests/test_moxunit_runtests.m b/tests/test_moxunit_runtests.m index ecefc19..52012e0 100644 --- a/tests/test_moxunit_runtests.m +++ b/tests/test_moxunit_runtests.m @@ -139,10 +139,6 @@ end - - - - function count=add_tests(test_dir,do_add,cell_with_tests) count=0; if do_add @@ -178,8 +174,6 @@ function assert_logfile_matches(log_fn,verbose_output,... labels=test_labels(labels_row,:); n_labels=numel(labels); - - for k=1:n_labels pat=regexptranslate('escape',labels{k}); count=numel(regexp(result,pat,'start')); @@ -277,7 +271,7 @@ function mkdir_recursively(dir_name) if moxunit_util_platform_is_octave() % GNU Octave requires, by defaualt, confirmation when % using rmdir - unless confirm_recursive_rmdir is set - % explicityly + % explicitly % Here the state of confirm_recursive_rmdir is stored, % and set back to its original value when leaving this % function. @@ -301,5 +295,3 @@ function mkdir_recursively(dir_name) otherwise assert(false,'illegal task') end - - diff --git a/tests/test_moxunit_set_path.m b/tests/test_moxunit_set_path.m index bc924af..686311b 100644 --- a/tests/test_moxunit_set_path.m +++ b/tests/test_moxunit_set_path.m @@ -28,8 +28,7 @@ function helper_test_with_subdir(subdir) % must be now in path directories_added_cell=func(); - new_path=path(); - assert(is_elem(new_path(),relative_dir,pathsep())); + assert(is_elem(path(),relative_dir,pathsep())); % directory must have been added and part of the output assert(numel(directories_added_cell)>0) @@ -40,6 +39,3 @@ function helper_test_with_subdir(subdir) function tf=is_elem(haystack, needle, sep) tf=~isempty(findstr([sep haystack sep], [sep needle sep])); - - - diff --git a/tests/test_moxunit_util_elem2str.m b/tests/test_moxunit_util_elem2str.m index 3b61ae5..70b1a37 100644 --- a/tests/test_moxunit_util_elem2str.m +++ b/tests/test_moxunit_util_elem2str.m @@ -55,7 +55,8 @@ % cell array aeq({'1x2 cell\n ''foo'' [1]',... - '1x2 cell\n\n{\n[1,1] = foo\n[1,2] = 1\n}'},... + '1x2 cell\n\n{\n[1,1] = foo\n[1,2] = 1\n}',... + '1x2 cell\n {''foo''} {[1]}'},... '1x2 cell',{'foo',1});