Merge branch 'master' into ecb-master-targets

time-shift
Houtan Bastani 2018-09-25 15:51:18 +02:00
commit bd36a0c109
5 changed files with 165 additions and 110 deletions

View File

@ -1,5 +1,11 @@
variables:
GIT_SUBMODULE_STRATEGY: normal
TERM: linux
before_script:
- wget http://www.dynare.org/x13/x13.zip
- unzip x13.zip
- cp -r binaries/linux matlab/modules/dseries/externals/x13
build_binaries:
stage: build
@ -13,6 +19,7 @@ build_binaries:
- mex/octave/
- mex/matlab/
- dynare++/src/dynare++
expire_in: 1 week
build_doc:
stage: build
@ -25,3 +32,52 @@ build_doc:
- doc/dynare.info*
- doc/dynare.html
- doc/dynare.pdf
testsuite_matlab:
stage: test
script:
- autoreconf -si
- './configure --disable-octave --with-matlab=$(dirname $(dirname $(readlink -f `which matlab`))) MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | sed -En "/ans\ =/!d;n;n;s/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/;p")'
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
artifacts:
paths:
- tests/*.m.log
- tests/*.m.trs
- tests/*/*.m.log
- tests/*/*.m.trs
- tests/run_test_matlab_output.txt
when: always
dependencies:
- build_binaries
.testsuite_octave_template: &testsuite_octave_definition
stage: test
variables:
OPENBLAS_NUM_THREADS: 1
script:
- autoreconf -si
- ./configure --disable-matlab
- make -j $(nproc) -C tests check-octave
artifacts:
paths:
- tests/*.o.log
- tests/*.o.trs
- tests/*/*.o.log
- tests/*/*.o.trs
- tests/run_test_octave_output.txt
when: always
dependencies:
- build_binaries
testsuite_octave_auto:
<<: *testsuite_octave_definition
only:
- tags
- schedules
testsuite_octave_manual:
<<: *testsuite_octave_definition
except:
- tags
- schedules
when: manual

@ -1 +1 @@
Subproject commit eb74d48393c32f765a4adac8f723ef959f5b4aa9
Subproject commit fbeae9619ab9603410a11a11af92a7dfeea0af81

View File

@ -905,86 +905,74 @@ EXTRA_DIST = \
prior_posterior_function/posterior_function_demo.m
TARGETS =
TEXTOUT =
if HAVE_CMD_LINE_MATLAB
TARGETS += check-matlab
TEXTOUT += run_test_matlab_output.txt
check-local: check-matlab
endif
if HAVE_OCTAVE
TARGETS += check-octave
TEXTOUT += run_test_octave_output.txt
check-local: check-octave
endif
check-local: $(TEXTOUT)
@cat $(TEXTOUT)
$(TEXTOUT): $(TARGETS)
check-matlab: $(M_XFAIL_TRS_FILES) $(M_TRS_FILES)
./read_trs_files.sh "$(M_TRS_FILES)" "$(M_XFAIL_TRS_FILES)"
@echo 'Matlab Tests Done'
@./read_trs_files.sh "$(M_TRS_FILES)" "$(M_XFAIL_TRS_FILES)"
check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
./read_trs_files.sh "$(O_TRS_FILES)" "$(O_XFAIL_TRS_FILES)"
@echo 'Octave Tests Done'
@./read_trs_files.sh "$(O_TRS_FILES)" "$(O_XFAIL_TRS_FILES)"
%.m.trs %.m.log: %.mod
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_test_matlab > $*.m.log 2> /dev/null || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.m.trs
@if grep -q ":test-result: PASS" $*.m.trs; then \
echo "`tput bold``tput setaf 2`MATLAB: $(PWD)/$* PASSED!`tput sgr0`" ; \
echo "`tput bold``tput setaf 2`MATLAB: $(CURDIR)/$* PASSED!`tput sgr0`" ; \
else \
echo "`tput bold``tput setaf 1`MATLAB: $(PWD)/$* FAILED!`tput sgr0`" ; \
echo "`tput bold``tput setaf 1`MATLAB: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi
%.m.drs %.m.log: %.m.trs
@cat $*.m.log
%.m.trs %.m.log : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r $* > $*.m.log 2> /dev/null
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$* Done!`tput sgr0`"
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$* Done!`tput sgr0`"
%.o.trs %.o.log: %.mod
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(OCTAVE) --no-init-file --silent --no-history --path "$*.mod" run_test_octave.m > $*.o.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.mod\n:elapsed-time: 0.0\n" > $*.o.trs
@if grep -q ":test-result: PASS" $*.o.trs; then \
echo "`tput bold``tput setaf 2`OCTAVE: $(PWD)/$* PASSED!`tput sgr0`" ; \
echo "`tput bold``tput setaf 2`OCTAVE: $(CURDIR)/$* PASSED!`tput sgr0`" ; \
else \
echo "`tput bold``tput setaf 1`OCTAVE: $(PWD)/$* FAILED!`tput sgr0`" ; \
echo "`tput bold``tput setaf 1`OCTAVE: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi
%.o.drs %.o.log: %.mod %.o.trs
@cat $*.o.log
%.o.trs %.o.log : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
$(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \
printf ":test-result: FAIL\n:number-tests: 1\n:number-failed-tests: 1\n:list-of-failed-tests: $*.m\n:elapsed-time: 0.0\n" > $*.o.trs
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$* Done!`tput sgr0`"
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
%.m.tls : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
@echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_m_script 2> /dev/null
@touch $*.m.tls
@echo "`tput bold`MATLAB`tput setaf 8`: $(PWD)/$* Done!`tput sgr0`"
@echo "`tput bold`MATLAB`tput setaf 8`: $(CURDIR)/$* Done!`tput sgr0`"
%.o.tls : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1
@touch $*.o.tls
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$* Done!`tput sgr0`"
@echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$* Done!`tput sgr0`"
clean-local:
rm -f $(M_TRS_FILES)

View File

@ -54,6 +54,25 @@ phi = 0.1;
@#endif
@#define x = 1:3
@#define y = [ i in x ; i > 1 ]
@#if y != [ 2, 3 ]
@# error "One-dimensional comprehension problem"
@#endif
@#define z = [ (i,j) in x^2 ; i != j ]
@#if z != [ (1,2), (1,3), (2,1), (2,3), (3,1), (3,2) ]
@# error "Two-dimensional comprehension problem"
@#endif
@#define t = 2:4
@#define tt = [ (i,j) in t^2 ; (i,j) in [ (k,l) in x^2 ; k != l ] ]
@#if tt != [ (2,3), (3,2) ]
@# error "Nested comprehension problem"
@#endif
model;
c*theta*h^(1+psi)=(1-alpha)*y;

View File

@ -1,102 +1,94 @@
#!/bin/bash
declare -i total=0;
declare -i total_xfail=0;
declare -i failed=0;
declare -i xpassed=0;
declare -a failed_tests=("");
declare -a xpassed_tests=("");
declare -i total=0
declare -i total_xfail=0
declare -i failed=0
declare -i xpassed=0
declare -a failed_tests=()
declare -a xpassed_tests=()
# Parse TRS Files
tosort=""
for file in $1 ; do
# Find number of tests run in trs file
((total += `grep number-tests $file | cut -d: -f3`))
((total += $(grep ^:number-tests: "$file" | cut -d: -f3)))
# Find number of tests failed in trs file
numfailed=`grep number-failed-tests $file | cut -d: -f3`
if [ $numfailed -ne 0 ] ; then
((failed += $numfailed))
for failedfile in `grep list-of-failed-tests $file | cut -d: -f3` ; do
failed_tests=("${failed_tests[@]}" "$failedfile");
done
numfailed=$(grep ^:number-failed-tests: "$file" | cut -d: -f3)
if ((numfailed != 0)) ; then
((failed += numfailed))
failed_tests+=($(grep ^:list-of-failed-tests: "$file" | cut -d: -f3))
fi
time=`grep elapsed-time $file | cut -d: -f3`
tosort=`echo $tosort\| $file ' - ' $time:`
time=$(grep ^:elapsed-time: "$file" | cut -d: -f3)
tosort="$tosort| $file - $time:"
done
((passed=$total-$failed));
((passed = total - failed))
# Parse XFAIL TRS Files
for file in $2 ; do
# Find number of tests run in xfail trs file
((xfail = `grep number-tests $file | cut -d: -f3`))
((total_xfail += $xfail))
xfail=$(grep ^:number-tests: "$file" | cut -d: -f3)
((total_xfail += xfail))
# Find number of tests failed in trs file
numpassed=`grep number-failed-tests $file | cut -d: -f3`
if [ $numpassed -eq 0 ] ; then
((xpassed += (($xfail - $numpassed))))
for xpassedfile in `grep list-of-passed-tests $file | cut -d: -f3` ; do
xpassed_tests=("${xpassed_tests[@]}" "$xpassedfile");
done
numfailed=$(grep ^:number-failed-tests: "$file" | cut -d: -f3)
if ((numfailed != xfail)) ; then
((xpassed += xfail - numfailed))
xpassed_tests+=($(grep ^:list-of-passed-tests: "$file" | cut -d: -f3))
fi
time=`grep elapsed-time $file | cut -d: -f3`
tosort=`echo $tosort\| $file ' - ' $time:`
time=$(grep ^:elapsed-time: "$file" | cut -d: -f3)
tosort="$tosort| $file - $time:"
done
((xfailed=$total_xfail-$xpassed));
((total+=$total_xfail));
((xfailed = total_xfail - xpassed))
((total += total_xfail))
timing=`echo $tosort | tr ":" "\n" | sort -rn -k4 | sed -e 's/$/:/' | head -n10`
timing=$(echo "$tosort" | tr ":" "\n" | sort -rn -k4 | sed -e 's/$/:/' | head -n10)
# Determine if we are parsing Matlab or Octave trs files
if [ `grep -c '.m.trs' <<< $1` -eq 0 ]; then
prg='OCTAVE';
outfile='run_test_octave_output.txt'
if (($(grep -c '.m.trs' <<< "$1") == 0)); then
prg=OCTAVE
outfile=run_test_octave_output.txt
else
prg='MATLAB';
outfile='run_test_matlab_output.txt'
prg=MATLAB
outfile=run_test_matlab_output.txt
fi
# Print Output
echo '================================' > $outfile
echo 'DYNARE MAKE CHECK '$prg' RESULTS' >> $outfile
echo '================================' >> $outfile
echo '| TOTAL: '$total >> $outfile
echo '| PASS: '$passed >> $outfile
echo '| FAIL: '$failed >> $outfile
echo '| XFAIL: '$xfailed >> $outfile
echo '| XPASS: '$xpassed >> $outfile
if [ $failed -gt 0 ] ; then
echo '| LIST OF FAILED TESTS:' >> $outfile
for file in ${failed_tests[@]} ; do
if [ "$prg" == "MATLAB" ]; then
modfile=`sed 's/\.m\.trs/\.mod/g' <<< $file` >> $outfile
else
modfile=`sed 's/\.o\.trs/\.mod/g' <<< $file` >> $outfile
# Print Output (to stdout and to a file)
{
echo '================================'
echo "DYNARE MAKE CHECK $prg RESULTS"
echo '================================'
echo "| TOTAL: $total"
echo "| PASS: $passed"
echo "| FAIL: $failed"
echo "| XFAIL: $xfailed"
echo "| XPASS: $xpassed"
if ((failed > 0)) ; then
echo '|'
echo '| LIST OF FAILED TESTS:'
for file in "${failed_tests[@]}" ; do
echo "| * $file"
done
fi
echo '| * '$modfile >> $outfile
done
fi
if [ $xpassed -gt 0 ] ; then
echo '| LIST OF XPASSED TESTS:' >> $outfile
for file in ${xpassed_tests[@]} ; do
if [ "$prg" == "MATLAB" ]; then
modfile=`sed 's/\.m\.trs/\.mod/g' <<< $file` >> $outfile
else
modfile=`sed 's/\.o\.trs/\.mod/g' <<< $file` >> $outfile
if ((xpassed > 0)) ; then
echo '|'
echo '| LIST OF XPASSED TESTS:'
for file in "${xpassed_tests[@]}" ; do
echo "| * $file"
done
fi
echo '| * '$modfile >> $outfile
done
fi
echo '|' >> $outfile
echo '| LIST OF 10 SLOWEST TESTS:' >> $outfile
if [ "$prg" == "MATLAB" ]; then
timing=`sed 's/\.m\.trs/\.mod/g' <<< $timing`
else
timing=`sed 's/\.o\.trs/\.mod/g' <<< $timing`
fi
echo $timing | tr ':' '\n' | sed -e 's/^[ \t]*//' | \
sed '/^$/d' | sed -e 's/^|[ ]/| * /' >> $outfile
echo >> $outfile
echo '|'
echo '| LIST OF 10 SLOWEST TESTS:'
if [[ $prg == MATLAB ]]; then
timing=$(sed 's/\.m\.trs/\.mod/g' <<< "$timing")
else
timing=$(sed 's/\.o\.trs/\.mod/g' <<< "$timing")
fi
echo "$timing" | tr ':' '\n' | sed -e 's/^[ \t]*//;/^$/d;s/^|[ ]/| * /'
echo
} | tee $outfile
# Exit with error code if some tests failed
((failed + xpassed == 0))