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: variables:
GIT_SUBMODULE_STRATEGY: normal 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: build_binaries:
stage: build stage: build
@ -13,6 +19,7 @@ build_binaries:
- mex/octave/ - mex/octave/
- mex/matlab/ - mex/matlab/
- dynare++/src/dynare++ - dynare++/src/dynare++
expire_in: 1 week
build_doc: build_doc:
stage: build stage: build
@ -25,3 +32,52 @@ build_doc:
- doc/dynare.info* - doc/dynare.info*
- doc/dynare.html - doc/dynare.html
- doc/dynare.pdf - 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 prior_posterior_function/posterior_function_demo.m
TARGETS =
TEXTOUT =
if HAVE_CMD_LINE_MATLAB if HAVE_CMD_LINE_MATLAB
TARGETS += check-matlab check-local: check-matlab
TEXTOUT += run_test_matlab_output.txt
endif endif
if HAVE_OCTAVE if HAVE_OCTAVE
TARGETS += check-octave check-local: check-octave
TEXTOUT += run_test_octave_output.txt
endif endif
check-local: $(TEXTOUT)
@cat $(TEXTOUT)
$(TEXTOUT): $(TARGETS)
check-matlab: $(M_XFAIL_TRS_FILES) $(M_TRS_FILES) check-matlab: $(M_XFAIL_TRS_FILES) $(M_TRS_FILES)
./read_trs_files.sh "$(M_TRS_FILES)" "$(M_XFAIL_TRS_FILES)" @./read_trs_files.sh "$(M_TRS_FILES)" "$(M_XFAIL_TRS_FILES)"
@echo 'Matlab Tests Done'
check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES) check-octave: $(O_XFAIL_TRS_FILES) $(O_TRS_FILES)
./read_trs_files.sh "$(O_TRS_FILES)" "$(O_XFAIL_TRS_FILES)" @./read_trs_files.sh "$(O_TRS_FILES)" "$(O_XFAIL_TRS_FILES)"
@echo 'Octave Tests Done'
%.m.trs %.m.log: %.mod %.m.trs %.m.log: %.mod
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \ @DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_test_matlab > $*.m.log 2> /dev/null || \ $(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 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 \ @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 \ else \
echo "`tput bold``tput setaf 1`MATLAB: $(PWD)/$* FAILED!`tput sgr0`" ; \ echo "`tput bold``tput setaf 1`MATLAB: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi fi
%.m.drs %.m.log: %.m.trs %.m.drs %.m.log: %.m.trs
@cat $*.m.log @cat $*.m.log
%.m.trs %.m.log : %.m %.m.trs %.m.log : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \ @DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r $* > $*.m.log 2> /dev/null $(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 %.o.trs %.o.log: %.mod
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \ @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 || \ $(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 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 \ @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 \ else \
echo "`tput bold``tput setaf 1`OCTAVE: $(PWD)/$* FAILED!`tput sgr0`" ; \ echo "`tput bold``tput setaf 1`OCTAVE: $(CURDIR)/$* FAILED!`tput sgr0`" ; \
fi fi
%.o.drs %.o.log: %.mod %.o.trs %.o.drs %.o.log: %.mod %.o.trs
@cat $*.o.log @cat $*.o.log
%.o.trs %.o.log : %.m %.o.trs %.o.log : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \ @DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(CURDIR)" \
$(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1 || \ $(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 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 %.m.tls : %.m
@echo "`tput bold``tput setaf 8`MATLAB: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`MATLAB: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \ @TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -r run_m_script 2> /dev/null $(MATLAB)/bin/matlab -nosplash -nodisplay -r run_m_script 2> /dev/null
@touch $*.m.tls @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 %.o.tls : %.m
@echo "`tput bold``tput setaf 8`OCTAVE: $(PWD)/$*... `tput sgr0`" @echo "`tput bold``tput setaf 8`OCTAVE: $(CURDIR)/$*... `tput sgr0`"
@TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \ @TOP_TEST_DIR="$(CURDIR)" FILESTEM="$*" \
$(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1 $(OCTAVE) --no-init-file --silent --no-history run_o_script.m 2>&1
@touch $*.o.tls @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: clean-local:
rm -f $(M_TRS_FILES) rm -f $(M_TRS_FILES)

View File

@ -54,6 +54,25 @@ phi = 0.1;
@#endif @#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; model;
c*theta*h^(1+psi)=(1-alpha)*y; c*theta*h^(1+psi)=(1-alpha)*y;

View File

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