[SCM] Tcl interface to FITS Files branch, debian, updated. a14dbcfff7ab7d2fe9fe14c9d1491f3b2f99c3e9

Ole Streicher debian at liska.ath.cx
Wed Sep 26 08:22:03 UTC 2012


The following commit has been merged in the debian branch:
commit a14dbcfff7ab7d2fe9fe14c9d1491f3b2f99c3e9
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Wed Sep 26 10:21:55 2012 +0200

    temporarily include a cfitsio test to analyze FTBS

diff --git a/debian/changelog b/debian/changelog
index 26d6c59..243586a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
-tcl-fitstcl (2.3-2) unstable; urgency=low
+tcl-fitstcl (2.3-2~exp1) experimental; urgency=low
 
   * Add kFreeBSD and HURD support
+  * Include a cfitsio test (temporarily, to check FTBS)
 
  -- Ole Streicher <debian at liska.ath.cx>  Tue, 25 Sep 2012 14:55:00 +0200
 
diff --git a/debian/rules b/debian/rules
index c3b0ded..a83a829 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,11 @@ override_dh_auto_configure:
 	dh_auto_configure -- --with-tcl-includes=/usr/include/tcl
 
 override_dh_auto_test:
-	(cd debian/tests; TCLLIBPATH=../.. tclsh all.tcl)
+	( cd debian/tests; \
+	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o fitssize fitssize.c -lcfitsio; \
+	./fitssize; \
+	rm -f fitssize; \
+	TCLLIBPATH=../.. tclsh all.tcl)
 
 override_dh_installchangelogs:
 	dh_installchangelogs ReleaseNotes
diff --git a/debian/tests/fitssize.c b/debian/tests/fitssize.c
new file mode 100644
index 0000000..089398b
--- /dev/null
+++ b/debian/tests/fitssize.c
@@ -0,0 +1,52 @@
+/* gcc fitssize.c -lcfitsio -o fitssize */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <fitsio.h>
+
+int status = 0;
+
+void create_fits(const char *fname) {
+    fitsfile *fptr;
+    long naxes[2] = { 32, 32 };
+    short array[32][32];
+
+    memset(array, 0, sizeof(short)* naxes[0]*naxes[1]);
+
+    fits_create_file(&fptr, fname, &status);
+    fits_create_img(fptr, SHORT_IMG, 2, naxes, &status);
+    fits_write_img(fptr, TSHORT, 1, naxes[0] * naxes[1], array[0], &status);
+    fits_close_file(fptr, &status);
+}
+
+long get_size(const char *fname) {
+    fitsfile *infptr;
+    long filesize;
+    fits_open_file(&infptr, fname, READONLY, &status);
+    filesize = infptr->Fptr->filesize;
+    fits_close_file(infptr, &status);
+    return filesize;
+}
+
+int main(void) {
+    char fname[] = "fileXXXXXX";
+    long fitssize;
+    struct stat sbuf;
+    close(mkstemp(fname));
+    unlink(fname);
+
+    create_fits(fname);
+    fitssize = get_size(fname);
+    stat(fname, &sbuf);
+    unlink(fname);
+
+    printf("CFITSIO size check: cfitsio = %li;  stat = %li\n", fitssize, (long)sbuf.st_size);
+    if (fitssize != (long)sbuf.st_size)
+	printf("*** CFITSIO reported wrong length! ***\n");
+    if (status)
+	fits_report_error(stdout, status);
+    return status;
+}

-- 
Tcl interface to FITS Files



More information about the debian-science-commits mailing list