Skip to content

Commit

Permalink
Cumulative merge of branch 'mk-wip' into mulilang-testing
Browse files Browse the repository at this point in the history
    - Added matlab testing of MOxUnit
    - Had to add one more case to `...elem2str.m` for Matlab 2020a
    - Fixed a warning in `...set_path.m`
    - Fixed a typo
  • Loading branch information
MarcinKonowalczyk committed Oct 22, 2020
1 parent 6360d77 commit f387215
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 64 deletions.
112 changes: 63 additions & 49 deletions .travis.yml
Expand Up @@ -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;
10 changes: 1 addition & 9 deletions tests/test_moxunit_runtests.m
Expand Up @@ -139,10 +139,6 @@
end






function count=add_tests(test_dir,do_add,cell_with_tests)
count=0;
if do_add
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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.
Expand All @@ -301,5 +295,3 @@ function mkdir_recursively(dir_name)
otherwise
assert(false,'illegal task')
end


6 changes: 1 addition & 5 deletions tests/test_moxunit_set_path.m
Expand Up @@ -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)
Expand All @@ -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]));



3 changes: 2 additions & 1 deletion tests/test_moxunit_util_elem2str.m
Expand Up @@ -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});


Expand Down

0 comments on commit f387215

Please sign in to comment.