From 757b9f39dd6e5f55cf84dfa66002da1edb07ad0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= <stephane.adjemian@univ-lemans.fr> Date: Tue, 24 Nov 2015 22:06:33 +0100 Subject: [PATCH] Added configuration file for travis-ci. Also adapted runalltests script (saves an empty file called failed iff one of the unit tests fails). --- .travis.yml | 11 +++++++++++ success.sh | 5 +++++ tests/runalltests.m | 25 +++++++++++++++---------- 3 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 .travis.yml create mode 100755 success.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3ad8982 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: python + +install: + - export + - sudo add-apt-repository ppa:octave/stable -y + - sudo apt-get update -qq + - sudo apt-get install -qq octave liboctave-dev + +script: + - make check-octave + - ./success.sh diff --git a/success.sh b/success.sh new file mode 100755 index 0000000..125cc1b --- /dev/null +++ b/success.sh @@ -0,0 +1,5 @@ +#!/bin/sh +if [ -f ./tests/failed ] +then + exit 1 +fi diff --git a/tests/runalltests.m b/tests/runalltests.m index cd561e0..144cf57 100644 --- a/tests/runalltests.m +++ b/tests/runalltests.m @@ -1,19 +1,20 @@ opath = path(); -% Check that the m-unit-tests module is available. +system('rm -f failed'); +% Check that the m-unit-tests module is available. install_unit_test_toolbox = false; try initialize_unit_tests_toolbox; catch urlwrite('https://github.com/DynareTeam/m-unit-tests/archive/master.zip','master.zip'); - warning('off','MATLAB:MKDIR:DirectoryExists') - mkdir('../externals') - warning('on','MATLAB:MKDIR:DirectoryExists') - unzip('master.zip','../externals') - delete('master.zip') - addpath([pwd() '/../externals/m-unit-tests-master/src']) + warning('off','MATLAB:MKDIR:DirectoryExists'); + mkdir('../externals'); + warning('on','MATLAB:MKDIR:DirectoryExists'); + unzip('master.zip','../externals'); + delete('master.zip'); + addpath([pwd() '/../externals/m-unit-tests-master/src']); initialize_unit_tests_toolbox; install_unit_test_toolbox = true; end @@ -28,16 +29,20 @@ catch end if isoctave - more off + more off; end tmp = dates_src_root; tmp = tmp(1:end-1); % Remove trailing slash. -run_unitary_tests_in_directory(tmp); +report = run_unitary_tests_in_directory(tmp); delete('*.log'); if install_unit_test_toolbox rmdir('../externals/m-unit-tests-master','s'); end -path(opath); \ No newline at end of file +path(opath); + +if any(~[report{:,3}]) + system('touch failed'); +end \ No newline at end of file -- GitLab