From e886e2ddb20f640b0023b9a1cbde3c4ad7cf2939 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 28 Apr 2023 22:20:17 +0200 Subject: [PATCH] use test scripts for performing tests This exploits the automake parallel test harness, which takes care of collecting the test scripts output and only prints a summary of the results. The parallel test harness uses the test-driver helper program, which now gets installed by autoreconf and should therefore be ignored. Signed-off-by: Sven Verdoolaege --- .gitignore | 1 + Makefile.am | 154 +----------------------------------------------- check_approx.sh.in | 10 ++++ check_enumerate.sh.in | 25 ++++++++ check_enumerate_e.sh.in | 31 ++++++++++ check_euler.sh.in | 32 ++++++++++ check_iscc.sh.in | 11 ++++ check_lexmin.sh.in | 14 +++++ check_pwqp.sh.in | 16 +++++ check_test.sh.in | 27 +++++++++ check_union.sh.in | 14 +++++ configure.ac | 12 ++++ 12 files changed, 196 insertions(+), 151 deletions(-) create mode 100644 check_approx.sh.in create mode 100644 check_enumerate.sh.in create mode 100644 check_enumerate_e.sh.in create mode 100644 check_euler.sh.in create mode 100644 check_iscc.sh.in create mode 100644 check_lexmin.sh.in create mode 100644 check_pwqp.sh.in create mode 100644 check_test.sh.in create mode 100644 check_union.sh.in diff --git a/.gitignore b/.gitignore index 9a2b3d7..9a49d90 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 tags +test-driver *.bak *~ *.lo diff --git a/Makefile.am b/Makefile.am index 4825ed6..45c2ef0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -387,157 +387,9 @@ dist-hook: isl.py dist-git: dist mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz -BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib - -check: check-testlib check-enumerate check-enumerate_e check-test \ - check-lexmin check-approx check-pwqp check-euler check-iscc \ - check-union -check-testlib: testlib$(EXEEXT) - ./testlib$(EXEEXT) -check-approx: test_approx$(EXEEXT) - @for i in $(top_srcdir)/tests/ehrhart/*; do \ - if test -f $$i; then \ - echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \ - fi \ - done -check-pwqp: barvinok_bound$(EXEEXT) test_bound$(EXEEXT) barvinok_summate$(EXEEXT) - @for i in $(top_srcdir)/tests/pwqp/*; do \ - if test -f $$i; then \ - echo $$i; \ - ./barvinok_bound$(EXEEXT) -T -r30 < $$i || exit; \ - echo $$i | ./test_bound$(EXEEXT) -q -r30 || exit; \ - ./barvinok_summate$(EXEEXT) -T -r30 < $$i || exit; \ - fi \ - done - @echo $(top_srcdir)/tests/pwqp/hong1.pwqp --iterate - @./barvinok_bound$(EXEEXT) --iterate -T -r30 < \ - $(top_srcdir)/tests/pwqp/hong1.pwqp || exit -check-euler: barvinok_summate$(EXEEXT) - @for i in $(top_srcdir)/tests/euler/*; do \ - if test -f $$i; then \ - for method in 'euler' 'laurent_old' 'laurent'; do \ - opt="--summation=$$method"; \ - echo $$i $$opt; \ - ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \ - done \ - fi \ - done - @for t in dull EML_p EML-product EML line square square_p square_p2 \ - square_p3 triangle triangle2 triangle_p quasi; do \ - i=$(top_srcdir)/tests/euler/$$t.pwqp; \ - if test -f $$i; then \ - opt="--summation=box"; \ - echo $$i $$opt; \ - ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \ - fi \ - done - @for t in dull dull_p EML line square square_p square_p2 \ - square_p3 triangle triangle2 triangle_p; do \ - i=$(top_srcdir)/tests/euler/$$t.pwqp; \ - if test -f $$i; then \ - opt="--summation=bernoulli"; \ - echo $$i $$opt; \ - ./barvinok_summate$(EXEEXT) -T $$opt < $$i || exit; \ - fi \ - done -if HAVE_TOPCOM - TOPCOM_CD = '--chamber-decomposition=topcom' -endif -ISL_CD = '--chamber-decomposition=isl' -check-enumerate: barvinok_enumerate$(EXEEXT) - @for i in $(top_srcdir)/tests/ehrhart/*; do \ - if test -f $$i; then \ - echo $$i; \ - for options in '' '--series' '--series --primal' $(TOPCOM_CD) $(ISL_CD); do \ - for spec in 'random' 'bf' 'df'; do \ - opt="--specialization=$$spec $$options"; \ - echo " $$opt"; \ - ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \ - done \ - done; \ - opt="--index=4"; \ - echo " $$opt"; \ - ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \ - opt="--summation=bernoulli"; \ - echo " $$opt"; \ - ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \ - fi \ - done -check-enumerate_e: barvinok_enumerate_e$(EXEEXT) - @for dir in $(BEE_TESTDIRS); do \ - for i in $(top_srcdir)/tests/$$dir/*; do \ - if test -f $$i; then \ - for options in '' '--isl'; do \ - for spec in 'random' 'bf' 'df'; do \ - opt="--specialization=$$spec $$options"; \ - echo $$i $$opt; \ - ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \ - done \ - done \ - fi \ - done \ - done - @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \ - if test -f $$i; then \ - for spec in 'random' 'bf' 'df'; do \ - opt="--specialization=$$spec --scarf"; \ - echo $$i $$opt; \ - ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \ - done; \ - echo $$i --series; \ - ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \ - fi \ - done -check-test: iscc$(EXEEXT) - @failed=0; \ - for i in $(top_srcdir)/tests/iscc/count/*; do \ - if test -f $$i; then \ - for options in '--index=10' '--primal --index=10'; do \ - for spec in 'random' 'bf' 'df' 'todd'; do \ - opt="--specialization=$$spec $$options"; \ - echo -n $$i $$opt; \ - ./iscc$(EXEEXT) $$opt < $$i; \ - if test "$$?" -ne "0"; then \ - failed=`expr $$failed + 1`; \ - echo " NOT ok"; \ - else \ - echo " ok"; \ - fi; \ - done \ - done \ - fi \ - done; \ - if test $$failed != 0; then \ - echo "$$failed tests failed"; \ - exit -1; \ - fi -check-lexmin: lexmin$(EXEEXT) - @for i in $(top_srcdir)/tests/lexmin/*; do \ - if test -f $$i; then \ - for spec in 'random' 'bf' 'df'; do \ - opt="--specialization=$$spec"; \ - echo $$i $$opt; \ - ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \ - done \ - fi \ - done -check-iscc: iscc$(EXEEXT) - @for i in $(top_srcdir)/tests/iscc/*; do \ - if test -f $$i; then \ - echo $$i; \ - ./iscc$(EXEEXT) < $$i || exit; \ - fi \ - done -check-union: barvinok_union$(EXEEXT) - @for i in $(top_srcdir)/tests/ehrhart_union/*; do \ - if test -f $$i; then \ - for spec in 'random' 'bf' 'df'; do \ - opt="--specialization=$$spec $$options"; \ - echo $$i $$opt; \ - ./barvinok_union$(EXEEXT) -c $$opt < $$i || exit; \ - done \ - fi \ - done +TESTS = testlib check_enumerate.sh check_enumerate_e.sh check_test.sh \ + check_lexmin.sh check_approx.sh check_pwqp.sh check_euler.sh \ + check_iscc.sh check_union.sh version.h: @GIT_HEAD@ echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@ diff --git a/check_approx.sh.in b/check_approx.sh.in new file mode 100644 index 0000000..7feca09 --- /dev/null +++ b/check_approx.sh.in @@ -0,0 +1,10 @@ +#!/bin/sh + +EXEEXT=@EXEEXT@ +top_srcdir=@top_srcdir@ + +for i in "$top_srcdir"/tests/ehrhart/*; do + if test -f $i; then + echo $i | ./test_approx$EXEEXT -q -r 10 || exit; + fi +done diff --git a/check_enumerate.sh.in b/check_enumerate.sh.in new file mode 100644 index 0000000..519d7b4 --- /dev/null +++ b/check_enumerate.sh.in @@ -0,0 +1,25 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" +TOPCOM_CD=@TOPCOM_CD@ + +ISL_CD='--chamber-decomposition=isl' +for i in "$top_srcdir"/tests/ehrhart/*; do + if test -f $i; then + echo $i; + for options in '' '--series' '--series --primal' $TOPCOM_CD $ISL_CD; do + for spec in 'random' 'bf' 'df'; do + opt="--specialization=$spec $options"; + echo " $opt"; + ./barvinok_enumerate$EXEEXT --verify $opt < $i || exit; + done + done; + opt="--index=4"; + echo " $opt"; + ./barvinok_enumerate$EXEEXT --verify $opt < $i || exit; + opt="--summation=bernoulli"; + echo " $opt"; + ./barvinok_enumerate$EXEEXT --verify $opt < $i || exit; + fi +done diff --git a/check_enumerate_e.sh.in b/check_enumerate_e.sh.in new file mode 100644 index 0000000..cb8d6ae --- /dev/null +++ b/check_enumerate_e.sh.in @@ -0,0 +1,31 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +BEE_TESTDIRS="ehrhart_e ehrhart_e/scarf ehrhart_e/piplib" + +for dir in $BEE_TESTDIRS; do + for i in "$top_srcdir"/tests/$dir/*; do + if test -f $i; then + for options in '' '--isl'; do + for spec in 'random' 'bf' 'df'; do + opt="--specialization=$spec $options"; + echo $i $opt; + ./barvinok_enumerate_e$EXEEXT --verify $opt < $i || exit; + done + done + fi + done +done +for i in "$top_srcdir"/tests/ehrhart_e/scarf/*; do + if test -f $i; then + for spec in 'random' 'bf' 'df'; do + opt="--specialization=$spec --scarf"; + echo $i $opt; + ./barvinok_enumerate_e$EXEEXT --verify $opt < $i || exit; + done; + echo $i --series; + ./barvinok_enumerate_e$EXEEXT --verify --series < $i || exit; + fi +done diff --git a/check_euler.sh.in b/check_euler.sh.in new file mode 100644 index 0000000..9f62601 --- /dev/null +++ b/check_euler.sh.in @@ -0,0 +1,32 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +for i in "$top_srcdir"/tests/euler/*; do + if test -f $i; then + for method in 'euler' 'laurent_old' 'laurent'; do + opt="--summation=$method"; + echo $i $opt; + ./barvinok_summate$EXEEXT -T $opt < $i || exit; + done + fi +done +for t in dull EML_p EML-product EML line square square_p square_p2 \ + square_p3 triangle triangle2 triangle_p quasi; do + i="$top_srcdir"/tests/euler/$t.pwqp; + if test -f $i; then + opt="--summation=box"; + echo $i $opt; + ./barvinok_summate$EXEEXT -T $opt < $i || exit; + fi +done +for t in dull dull_p EML line square square_p square_p2 \ + square_p3 triangle triangle2 triangle_p; do + i="$top_srcdir"/tests/euler/$t.pwqp; + if test -f $i; then + opt="--summation=bernoulli"; + echo $i $opt; + ./barvinok_summate$EXEEXT -T $opt < $i || exit; + fi +done diff --git a/check_iscc.sh.in b/check_iscc.sh.in new file mode 100644 index 0000000..8d33339 --- /dev/null +++ b/check_iscc.sh.in @@ -0,0 +1,11 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +for i in "$top_srcdir"/tests/iscc/*; do + if test -f $i; then + echo $i; + ./iscc$EXEEXT < $i || exit; + fi +done diff --git a/check_lexmin.sh.in b/check_lexmin.sh.in new file mode 100644 index 0000000..128b6f3 --- /dev/null +++ b/check_lexmin.sh.in @@ -0,0 +1,14 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +for i in "$top_srcdir"/tests/lexmin/*; do + if test -f $i; then + for spec in 'random' 'bf' 'df'; do + opt="--specialization=$spec"; + echo $i $opt; + ./lexmin$EXEEXT --verify $opt < $i || exit; + done + fi +done diff --git a/check_pwqp.sh.in b/check_pwqp.sh.in new file mode 100644 index 0000000..383f900 --- /dev/null +++ b/check_pwqp.sh.in @@ -0,0 +1,16 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +for i in "$top_srcdir"/tests/pwqp/*; do + if test -f $i; then + echo $i; + ./barvinok_bound$EXEEXT -T -r30 < $i || exit; + echo $i | ./test_bound$EXEEXT -q -r30 || exit; + ./barvinok_summate$EXEEXT -T -r30 < $i || exit; + fi +done +echo "$top_srcdir"/tests/pwqp/hong1.pwqp --iterate +./barvinok_bound$EXEEXT --iterate -T -r30 < \ + "$top_srcdir"/tests/pwqp/hong1.pwqp || exit diff --git a/check_test.sh.in b/check_test.sh.in new file mode 100644 index 0000000..5f9f550 --- /dev/null +++ b/check_test.sh.in @@ -0,0 +1,27 @@ +#!/bin/sh + +EXEEXT=@EXEEXT@ +top_srcdir="@top_srcdir@" + +failed=0; +for i in "$top_srcdir"/tests/iscc/count/*; do + if test -f $i; then + for options in '--index=10' '--primal --index=10'; do + for spec in 'random' 'bf' 'df' 'todd'; do + opt="--specialization=$spec $options"; + echo -n $i $opt; + ./iscc$EXEEXT $opt < $i; + if test "$?" -ne "0"; then + failed=`expr $failed + 1`; + echo " NOT ok"; + else + echo " ok"; + fi; + done + done + fi +done +if test $failed != 0; then + echo "$failed tests failed"; + exit -1; +fi diff --git a/check_union.sh.in b/check_union.sh.in new file mode 100644 index 0000000..dbe3f93 --- /dev/null +++ b/check_union.sh.in @@ -0,0 +1,14 @@ +#!/bin/sh + +EXEEXT="@EXEEXT@" +top_srcdir="@top_srcdir@" + +for i in "$top_srcdir"/tests/ehrhart_union/*; do + if test -f $i; then + for spec in 'random' 'bf' 'df'; do + opt="--specialization=$spec $options"; + echo $i $opt; + ./barvinok_union$EXEEXT -c $opt < $i || exit; + done + fi +done diff --git a/configure.ac b/configure.ac index 2f3cb46..881d703 100644 --- a/configure.ac +++ b/configure.ac @@ -412,6 +412,9 @@ if test "$topcom_package" != no; then fi fi AM_CONDITIONAL(HAVE_TOPCOM, test x$have_topcom = xtrue) +AM_COND_IF([HAVE_TOPCOM], [ + AC_SUBST(TOPCOM_CD, '--chamber-decomposition=topcom') +]) AX_DETECT_GIT_HEAD echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h @@ -449,6 +452,15 @@ AX_CREATE_PKGCONFIG_INFO AH_BOTTOM([#include "config_post.h"]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES(Makefile zsolve/Makefile doc/Makefile) +AC_CONFIG_FILES([check_approx.sh], [chmod +x check_approx.sh]) +AC_CONFIG_FILES([check_enumerate.sh], [chmod +x check_enumerate.sh]) +AC_CONFIG_FILES([check_enumerate_e.sh], [chmod +x check_enumerate_e.sh]) +AC_CONFIG_FILES([check_euler.sh], [chmod +x check_euler.sh]) +AC_CONFIG_FILES([check_iscc.sh], [chmod +x check_iscc.sh]) +AC_CONFIG_FILES([check_lexmin.sh], [chmod +x check_lexmin.sh]) +AC_CONFIG_FILES([check_pwqp.sh], [chmod +x check_pwqp.sh]) +AC_CONFIG_FILES([check_test.sh], [chmod +x check_test.sh]) +AC_CONFIG_FILES([check_union.sh], [chmod +x check_union.sh]) if test $with_polylib = bundled; then AC_CONFIG_SUBDIRS(polylib) fi -- 2.11.4.GIT