From: Mark Wielaard Date: Tue, 30 Jun 2020 15:51:49 +0000 (+0200) Subject: Add new auxchecks target that runs GNU Scientific Library tests. X-Git-Tag: VALGRIND_3_17_0~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5efd866df21ab1f13402b280bcbe021b3b50a032;p=thirdparty%2Fvalgrind.git Add new auxchecks target that runs GNU Scientific Library tests. Replace the gsl16test script under auxprogs that you run by hand with a new make target auxchecks which fetches the source code, patches, reconfigures and builds all tests. Then run all tests under valgrind. --- diff --git a/Makefile.am b/Makefile.am index 08db834019..f10517edca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,6 +94,10 @@ exp-regtest: check perf: check @PERL@ perf/vg_perf perf +# Auxiliary test suites run under valgrind +auxchecks: all + $(MAKE) -C auxprogs auxchecks + # Nb: no need to include any Makefile.am files here, or files included from # them, as automake includes them automatically. Also not COPYING, README # or NEWS. diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am index 56cc5efc70..83c887217b 100644 --- a/auxprogs/Makefile.am +++ b/auxprogs/Makefile.am @@ -4,7 +4,6 @@ dist_noinst_SCRIPTS = \ change-copyright-year \ dump_insn_ppc.sh \ gen-mdg \ - gsl16test \ gsl19test \ make_or_upd_vgversion_h \ nightly-build-summary \ @@ -14,8 +13,9 @@ dist_noinst_SCRIPTS = \ EXTRA_DIST = \ docs/valgrind-listener-manpage.xml \ docs/valgrind-di-server-manpage.xml \ - gsl16-badfree.patch \ - gsl16-wavelet.patch \ + gsl-1.6.patch \ + gsl-1.6.supp \ + gsl-1.6.out.x86.exp \ posixtestsuite-1.5.1-diff.txt \ ppcfround.c \ ppc64shifts.c \ @@ -117,13 +117,104 @@ getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS += -Wl,-read_only_relocs -Wl,supp endif endif +#---------------------------------------------------------------------------- +# Auxiliary testsuits +#---------------------------------------------------------------------------- + +auxchecks: gsl-check +auxclean: gsl-clean + +# You can override AUX_CHECK_DIR to use a previous download/build. +# Must be an absolute path. +# e.g. make auxchecks AUX_CHECK_DIR=$HOME/valgrind-auxtests +AUX_CHECK_DIR=$(abs_builddir)auxchecks + +# GNU Scientific Library 1.6 +GSL_DIR_NAME=gsl-1.6 +GSL_TAR_NAME=$(GSL_DIR_NAME).tar.gz +GSL_URL=https://ftpmirror.gnu.org/gsl/$(GSL_TAR_NAME) +GSL_SHA256_SUM=52e097b5228a617fef788d54eba6855c1addc62b8f68a1dfb5895cad25594f1f +GSL_TAR=$(AUX_CHECK_DIR)/$(GSL_TAR_NAME) +GSL_SRC_DIR=$(AUX_CHECK_DIR)/$(GSL_DIR_NAME) +# By default we like -O3 to hopefully get some loop vectorization +# You can also override GSL_CFLAGS if you want e.g. -march=core-avx2 +# Different GSL_CFLAGS will result in different build dirs (under AUX_CHECK_DIR) +GSL_CFLAGS=-g -O3 +# i386 needs sse to get rounding for floating point correct. +# But we only want this if the primary isn't AMD64 +if VGCONF_ARCHS_INCLUDE_X86 +if !VGCONF_ARCHS_INCLUDE_AMD64 +GSL_CFLAGS+=-mfpmath=sse -msse2 +endif +endif + +# Trick to get a literal space to use in substitutions +sp := $(subst ,, ) + +# Filter out spaces from GSL_CFLAGS to get unique build dir +GSL_BUILD_DIR=$(AUX_CHECK_DIR)/gsl-build$(subst $(sp),,$(GSL_CFLAGS)) + +# These are all the tests, except siman and randist which can take minutes. +GSL_TESTS=block cblas cdf cheb combination complex const deriv dht diff \ + eigen err fft fit histogram ieee-utils integration interpolation \ + linalg matrix min monte multifit multimin multiroots ntuple \ + ode-initval permutation poly qrng rng roots sort specfunc \ + statistics sum sys vector wavelet + +# Get the tar file if we don't have it yet. +$(GSL_TAR): + mkdir -p $(AUX_CHECK_DIR) + wget -q -O $(GSL_TAR) $(GSL_URL) + +# We need to autoreconf to make sure to get config.guess, config.sub +# and libtool for newer architectures. +$(GSL_SRC_DIR)/gsl-patched: $(GSL_TAR) + echo "$(GSL_SHA256_SUM) $(GSL_TAR)" | sha256sum --check - + (cd $(AUX_CHECK_DIR) && \ + tar zxf $(GSL_TAR_NAME) && \ + cd $(GSL_DIR_NAME) && \ + patch -p1 < $(abs_top_srcdir)/auxprogs/gsl-1.6.patch && \ + autoreconf -f -i -Wnone) + touch $@ + +# We need make check -k because +# some tests might fail even native (only on i386 though). +# make check doesn't work reliably with -j. +$(GSL_BUILD_DIR)/gsl-build: $(GSL_SRC_DIR)/gsl-patched + mkdir -p $(GSL_BUILD_DIR) + (cd $(GSL_BUILD_DIR) && \ + $(GSL_SRC_DIR)/configure CFLAGS="$(GSL_CFLAGS)" && \ + make -j $(nproc) && \ + make check -k || true) + touch $@ + +# We hope all tests PASS (so don't produce output except for the test names). +# But on x86 we get one FAIL, so that is "fine" too. +# We currently don't check stderr, but we probably should. +gsl-check: $(GSL_BUILD_DIR)/gsl-build + (cd $(GSL_BUILD_DIR); \ + for gsl_test in $(GSL_TESTS); do \ + echo $$gsl_test; \ + ./libtool --mode=execute $(abs_top_builddir)/vg-in-place -q \ + --suppressions=$(abs_top_srcdir)/auxprogs/gsl-1.6.supp \ + $$gsl_test/test; \ + done | grep --line-buffered -v ^PASS: | tee valgrind-gsl.out) + for gsl_test in $(GSL_TESTS); do echo $$gsl_test; done \ + | cmp - $(GSL_BUILD_DIR)/valgrind-gsl.out || \ + diff -u $(abs_top_srcdir)/auxprogs/gsl-1.6.out.x86.exp \ + $(GSL_BUILD_DIR)/valgrind-gsl.out + +# We keep the tarball but remove the unpacked sources and build +gsl-clean: + rm -rf $(GSL_SRC_NAME) $(GSL_BUILD_DIR) + #---------------------------------------------------------------------------- # General stuff #---------------------------------------------------------------------------- all-local: inplace-noinst_PROGRAMS inplace-noinst_DSYMS -clean-local: clean-noinst_DSYMS +clean-local: clean-noinst_DSYMS auxclean install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS diff --git a/auxprogs/gsl-1.6.out.x86.exp b/auxprogs/gsl-1.6.out.x86.exp new file mode 100644 index 0000000000..996f285df1 --- /dev/null +++ b/auxprogs/gsl-1.6.out.x86.exp @@ -0,0 +1,40 @@ +block +cblas +cdf +cheb +combination +complex +const +deriv +dht +diff +eigen +err +fft +fit +histogram +ieee-utils +integration +FAIL: qawo(f456) elist (7.25063790881233303e-15 observed vs 7.25922435194575979e-15 expected) +interpolation +linalg +matrix +min +monte +multifit +multimin +multiroots +ntuple +ode-initval +permutation +poly +qrng +rng +roots +sort +specfunc +statistics +sum +sys +vector +wavelet diff --git a/auxprogs/gsl-1.6.patch b/auxprogs/gsl-1.6.patch new file mode 100644 index 0000000000..a9ffd13c33 --- /dev/null +++ b/auxprogs/gsl-1.6.patch @@ -0,0 +1,36 @@ +diff -r -u gsl-1.6/vector/test_complex_source.c gsl-1.6-patched/vector/test_complex_source.c +--- gsl-1.6/vector/test_complex_source.c 2004-09-13 15:23:20.000000000 +0200 ++++ gsl-1.6-patched/vector/test_complex_source.c 2005-07-24 08:37:54.000000000 +0200 +@@ -75,7 +75,7 @@ + if (stride == 1) + { + v0 = FUNCTION (gsl_vector, alloc) (N); +- view = FUNCTION (gsl_vector, subvector) (v, 0, N); ++ view = FUNCTION (gsl_vector, subvector) (v0, 0, N); + v = &view.vector; + } + else +diff -r -u gsl-1.6/vector/test_source.c gsl-1.6-patched/vector/test_source.c +--- gsl-1.6/vector/test_source.c 2004-09-13 15:23:20.000000000 +0200 ++++ gsl-1.6-patched/vector/test_source.c 2005-07-24 08:37:54.000000000 +0200 +@@ -75,7 +75,7 @@ + if (stride == 1) + { + v0 = FUNCTION (gsl_vector, alloc) (N); +- view = FUNCTION (gsl_vector, subvector) (v, 0, N); ++ view = FUNCTION (gsl_vector, subvector) (v0, 0, N); + v = &view.vector; + } + else +diff -r -u gsl-1.6/wavelet/dwt.c gsl-1.6-patched/wavelet/dwt.c +--- gsl-1.6/wavelet/dwt.c 2004-12-24 14:57:34.000000000 +0100 ++++ gsl-1.6-patched/wavelet/dwt.c 2005-07-24 08:38:05.000000000 +0200 +@@ -30,7 +30,7 @@ + + static int binary_logn (const size_t n); + static void dwt_step (const gsl_wavelet * w, double *a, size_t stride, +- size_t n, int isign, gsl_wavelet_workspace * work); ++ size_t n, gsl_wavelet_direction dir, gsl_wavelet_workspace * work); + + static int + binary_logn (const size_t n) diff --git a/auxprogs/gsl-1.6.supp b/auxprogs/gsl-1.6.supp new file mode 100644 index 0000000000..addf5d8caf --- /dev/null +++ b/auxprogs/gsl-1.6.supp @@ -0,0 +1,14 @@ +{ + gsl-writes-uninit-data + Memcheck:Param + write(buf) + fun:write +} + +{ + gsl-writes-uninit-data-nocancel + Memcheck:Param + write(buf) + fun:__write_nocancel +} + diff --git a/auxprogs/gsl16-badfree.patch b/auxprogs/gsl16-badfree.patch deleted file mode 100644 index d07d3a1ba9..0000000000 --- a/auxprogs/gsl16-badfree.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: test_complex_source.c -=================================================================== -RCS file: /home/gsl-cvs/gsl/vector/test_complex_source.c,v -retrieving revision 1.23 -diff -u -r1.23 test_complex_source.c ---- test_complex_source.c 24 Jun 2005 11:33:25 -0000 1.23 -+++ test_complex_source.c 6 Jul 2005 11:18:33 -0000 -@@ -75,7 +75,7 @@ - if (stride == 1) - { - v0 = FUNCTION (gsl_vector, alloc) (N); -- view = FUNCTION (gsl_vector, subvector) (v, 0, N); -+ view = FUNCTION (gsl_vector, subvector) (v0, 0, N); - v = &view.vector; - } - else -Index: test_source.c -=================================================================== -RCS file: /home/gsl-cvs/gsl/vector/test_source.c,v -retrieving revision 1.26 -diff -u -r1.26 test_source.c ---- test_source.c 24 Jun 2005 11:33:26 -0000 1.26 -+++ test_source.c 6 Jul 2005 11:14:18 -0000 -@@ -75,7 +75,7 @@ - if (stride == 1) - { - v0 = FUNCTION (gsl_vector, alloc) (N); -- view = FUNCTION (gsl_vector, subvector) (v, 0, N); -+ view = FUNCTION (gsl_vector, subvector) (v0, 0, N); - v = &view.vector; - } - else diff --git a/auxprogs/gsl16-wavelet.patch b/auxprogs/gsl16-wavelet.patch deleted file mode 100644 index 525e9cf5e6..0000000000 --- a/auxprogs/gsl16-wavelet.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- wavelet/dwt.c~ 2004-12-24 14:57:34.000000000 +0100 -+++ wavelet/dwt.c 2005-07-08 23:31:32.000000000 +0200 -@@ -30,7 +30,7 @@ - - static int binary_logn (const size_t n); - static void dwt_step (const gsl_wavelet * w, double *a, size_t stride, -- size_t n, int isign, gsl_wavelet_workspace * work); -+ size_t n, gsl_wavelet_direction dir, gsl_wavelet_workspace * work); - - static int - binary_logn (const size_t n) diff --git a/auxprogs/gsl16test b/auxprogs/gsl16test deleted file mode 100755 index 22f7cab2e8..0000000000 --- a/auxprogs/gsl16test +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh - -# Do an automated test which involves building and regtesting version -# 1.6 of the GNU Scientific Library (gsl). This has proven to be a -# very thorough test of Vex's CPU simulations and has exposed bugs -# which had not been previously discovered. Gsl contains more -# than 100,000 tests as part of its regression suite, and so this -# script's purpose is to runs those tests using valgrind and compare -# against the same tests run natively. -# -# You can download gsl and get more info about it at -# http://www.gnu.org/software/gsl - - - -# Args: -# absolute name of gsl-1.6.tar.gz file -# name of C compiler -# args for C compiler -# name of Valgrind -# args for Valgrind - -# Results: 3.7.0 --tool=none -# x86 1 failure Ubuntu 10.10 -# FAIL: qawo(f456) elist (7.25063790881233303e-15 observed vs 7.25922435194575979e-15 expected) -# same failure was also present in 3.6.1 -# s390x 0 failures on z900 running RHEL4 - -if [ $# != 5 ] -then - echo "usage: gsl16test /absolute/name/of/gsl-1.6-patched.tar.gz" - echo " C-compiler-command" - echo " flags-for-C-compiler" - echo " Valgrind-command" - echo " flags-for-Valgrind" - exit 1 -fi - - -runcmd () { - echo -n " $1 ... " - shift - - (eval "$*") >> log.verbose 2>&1 - - if [ $? = 0 ] - then - echo "done" - return 0 - else - echo "failed" - return 1 - fi -} - -GSL_FILE=$1 -GSL_CC=$2 -GSL_CFLAGS=$3 -GSL_VV=$4 -GSL_VFLAGS=$5 - -TESTS1="block/test cblas/test cdf/test cheb/test combination/test" -TESTS2="complex/test const/test deriv/test dht/test diff/test" -TESTS3="eigen/test err/test fft/test fit/test histogram/test" -TESTS4="ieee-utils/test integration/test interpolation/test linalg/test" -TESTS5="matrix/test min/test monte/test multifit/test multimin/test" -TESTS6="multiroots/test ntuple/test ode-initval/test permutation/test" -TESTS7="poly/test qrng/test randist/test rng/test roots/test siman/test" -TESTS8="sort/test specfunc/test statistics/test sum/test sys/test" -TESTS9="vector/test wavelet/test" - -ALL_TESTS="$TESTS1 $TESTS2 $TESTS3 $TESTS4 $TESTS5 $TESTS6 $TESTS7 $TESTS8 $TESTS9" - -echo "gsl16test: src: " $GSL_FILE -echo "gsl16test: cc: " $GSL_CC -echo "gsl16test: cflags: " $GSL_CFLAGS -echo "gsl16test: valgrind: " $GSL_VV -echo "gsl16test: vflags: " $GSL_VFLAGS - -rm -rf log.verbose gsl-1.6-patched summary.txt - -echo > log.verbose - -echo > summary.txt -echo $0 $1 \"$2\" \"$3\" \"$4\" \"$5\" >> summary.txt -echo >> summary.txt - -runcmd "Untarring " \ - "rm -rf gsl-1.6-patched && tar xzf $GSL_FILE" && \ -\ -runcmd "Configuring " \ - "(cd gsl-1.6-patched && CC=$GSL_CC CFLAGS=\"$GSL_CFLAGS\" ./configure)" && \ -\ -runcmd "Building " \ - "(cd gsl-1.6-patched && make -j4 && make -k check)" - -echo -n " Collecting reference results " -rm -f out-REF -(cd gsl-1.6-patched && for f in $ALL_TESTS ; do ./$f ; done) &> out-REF -echo " ... done" - -echo -n " Collecting valgrinded results " -rm -f out-VAL -(cd gsl-1.6-patched && for f in $ALL_TESTS ; do eval $GSL_VV -v --trace-children=yes "$GSL_VFLAGS" ./$f ; done) &> out-VAL -echo " ... done" - -echo -n " Native fails: " && (grep FAIL: out-REF | wc -l) -echo -n " Native passes: " && (grep PASS: out-REF | wc -l) -echo -n " Valgrind fails: " && (grep FAIL: out-VAL | wc -l) -echo -n " Valgrind passes: " && (grep PASS: out-VAL | wc -l) - -(echo -n " Native fails: " && (grep FAIL: out-REF | wc -l)) >> summary.txt -(echo -n " Native passes: " && (grep PASS: out-REF | wc -l)) >> summary.txt -(echo -n " Valgrind fails: " && (grep FAIL: out-VAL | wc -l)) >> summary.txt -(echo -n " Valgrind passes: " && (grep PASS: out-VAL | wc -l)) >> summary.txt -echo >> summary.txt - -echo