[fftw3] 04/05: add autopkgtests for tools and basic usage

Julian Taylor jtaylor.debian at googlemail.com
Sat Oct 26 17:31:15 UTC 2013


This is an automated email from the git hooks/post-receive script.

jtaylor-guest pushed a commit to branch master
in repository fftw3.

commit 078ed1b5547a870d79beb72bf6171031b61a77ac
Author: Julian Taylor <jtaylor.debian at googlemail.com>
Date:   Sat Oct 26 18:03:00 2013 +0200

    add autopkgtests for tools and basic usage
---
 debian/changelog     |    1 +
 debian/control       |    1 +
 debian/tests/build   |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/tests/control |    5 +++++
 debian/tests/tools   |   11 ++++++++++
 5 files changed, 74 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 03154c2..104bd3a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ fftw3 (3.3.3-6) unstable; urgency=low
   * make transitional libfftw3-3 depend on libfftw3-long3 for compatibility
     with unpackaged software (Closes: #710890)
   * fix-fftw-wisdom-to-conf.patch: fix tool not accepting wisdom files
+  * add autopkgtests for tools and basic usage
 
  -- Julian Taylor <jtaylor.debian at googlemail.com>  Sat, 26 Oct 2013 17:05:33 +0200
 
diff --git a/debian/control b/debian/control
index 7d87341..dfc64b5 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Vcs-Git: git://anonscm.debian.org/debian-science/packages/fftw3.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/fftw3.git
 Homepage: http://fftw.org
 Standards-Version: 3.9.4
+XS-Testsuite: autopkgtest
 
 Package: libfftw3-3
 Architecture: any
diff --git a/debian/tests/build b/debian/tests/build
new file mode 100755
index 0000000..cb1e723
--- /dev/null
+++ b/debian/tests/build
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -efu
+
+cd $ADTTMP
+
+# only float and double are available on all platforms
+cat << EOF > double.c
+#include <fftw3.h>
+#include <math.h>
+#include <assert.h>
+#include <stdlib.h>
+int main(int argc, const char *argv[])
+{
+  int n = 1000;
+  double *in = fftw_malloc(sizeof(double) * n);
+
+  srand(3452);
+
+  for (int i = 0; i < n; i++) {
+    in[i] = rand() / (double)RAND_MAX;
+  }
+
+  int nc = (n / 2) + 1;
+  fftw_complex * out = fftw_malloc(sizeof(fftw_complex) * nc);
+  fftw_plan plan_forward = fftw_plan_dft_r2c_1d (n, in, out, FFTW_ESTIMATE);
+  fftw_execute(plan_forward);
+
+
+  double * in2 = fftw_malloc(sizeof(double) * n);
+  fftw_plan plan_backward = fftw_plan_dft_c2r_1d(n, out, in2, FFTW_ESTIMATE);
+  fftw_execute (plan_backward);
+
+  for (int i = 0; i < n; i++) { 
+    double diff = fabs((in2[i] / n) - in[i]);
+    assert(diff < PRECISION);
+  }
+  fftw_destroy_plan (plan_forward);
+  fftw_destroy_plan (plan_backward);
+
+  fftw_free (in);
+  fftw_free (in2);
+  fftw_free (out);
+
+  return 0;
+}
+EOF
+
+echo "smoke testing double library"
+gcc -std=c99 double.c -DPRECISION="1e-15" -lfftw3
+./a.out
+
+sed -e "s/double/float/g" -e "s/fftw_/fftwf_/g" double.c > float.c
+echo "smoke testing float library"
+gcc -std=c99 float.c  -DPRECISION="1e-6" -lfftw3f
+./a.out
+
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..2297e1e
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,5 @@
+Tests: tools
+Depends: libfftw3-bin
+
+Tests: build
+Depends: libfftw3-dev
diff --git a/debian/tests/tools b/debian/tests/tools
new file mode 100755
index 0000000..777ab06
--- /dev/null
+++ b/debian/tests/tools
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -efu
+
+cd $ADTTMP
+
+# only float and double are available on all platforms
+fftwf-wisdom -n -o wisdom cof1024 cob1024 r4096
+fftw-wisdom-to-conf < wisdom > conf.c
+
+fftw-wisdom -n -o wisdom cof1024 cob1024 r4096
+fftw-wisdom-to-conf < wisdom > conf.c

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/fftw3.git



More information about the debian-science-commits mailing list